Make GMs with persistent SkImages that may be texture backed recreate

their images if the underlying GrContext is abandoned.

Change-Id: Ibcb6aa25c3bb5a2f705d56c86382295449fe2d7a
Reviewed-on: https://skia-review.googlesource.com/129983
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2018-05-24 13:22:01 -04:00 committed by Skia Commit-Bot
parent 5a5e08495e
commit 542685014b
3 changed files with 3 additions and 3 deletions

View File

@ -153,7 +153,7 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
if (!fImage) {
if (!fImage || !fImage->isValid(canvas->getGrContext())) {
this->setupImage(canvas);
}

View File

@ -67,7 +67,7 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
if (nullptr == fBitmap.pixelRef()) {
if (nullptr == fBitmap.pixelRef() || !fImage->isValid(canvas->getGrContext())) {
fImage = make_image(canvas, &fCenter);
image_to_bitmap(fImage.get(), &fBitmap);
}

View File

@ -136,7 +136,7 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
if (!fImage) {
if (!fImage || !fImage->isValid(canvas->getGrContext())) {
fImage = make_image(canvas, kCellSize, kCellSize);
}