diff options
author | brianosman <brianosman@google.com> | 2016-09-29 13:43:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-29 13:43:49 -0700 |
commit | 95e8d0a4ae3c755fd9ffbd0c276fc657999fecee (patch) | |
tree | b51069087b6199a542408c5f14d6e343d21609c5 /gm/drawatlas.cpp | |
parent | eb0d91cfa278bceba3ec9a3fdcbc7c47a2ed3a3f (diff) |
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
Diffstat (limited to 'gm/drawatlas.cpp')
-rw-r--r-- | gm/drawatlas.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp index a98b176a37..dd81628378 100644 --- a/gm/drawatlas.cpp +++ b/gm/drawatlas.cpp @@ -35,8 +35,6 @@ class DrawAtlasGM : public skiagm::GM { return surface->makeImageSnapshot(); } - sk_sp<SkImage> fAtlas; - public: DrawAtlasGM() {} @@ -52,9 +50,7 @@ protected: 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 @@ protected: 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: |