Remove caching from the draw-atlas GMs. Fixes bugs cycling backends.
When we would change backend or color type in SampleApp, we'd be rendering
from a no-longer-valid image, leading to missing output, etc...
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2381893004
Review-Url: https://codereview.chromium.org/2381893004
diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp
index a98b176..dd81628 100644
--- a/gm/drawatlas.cpp
+++ b/gm/drawatlas.cpp
@@ -35,8 +35,6 @@
return surface->makeImageSnapshot();
}
- sk_sp<SkImage> fAtlas;
-
public:
DrawAtlasGM() {}
@@ -52,9 +50,7 @@
void onDraw(SkCanvas* canvas) override {
const SkRect target = { 50, 50, 80, 90 };
- if (nullptr == fAtlas) {
- fAtlas = MakeAtlas(canvas, target);
- }
+ auto atlas = MakeAtlas(canvas, target);
const struct {
SkScalar fScale;
@@ -91,9 +87,9 @@
paint.setFilterQuality(kLow_SkFilterQuality);
paint.setAntiAlias(true);
- canvas->drawAtlas(fAtlas.get(), xform, tex, N, nullptr, &paint);
+ canvas->drawAtlas(atlas.get(), xform, tex, N, nullptr, &paint);
canvas->translate(0, 100);
- canvas->drawAtlas(fAtlas.get(), xform, tex, colors, N, SkXfermode::kSrcIn_Mode, nullptr, &paint);
+ canvas->drawAtlas(atlas.get(), xform, tex, colors, N, SkXfermode::kSrcIn_Mode, nullptr, &paint);
}
private: