diff options
author | reed <reed@google.com> | 2015-10-19 08:24:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-19 08:24:21 -0700 |
commit | 59dc0d22f557a20669126fa425baefe6dd4b727a (patch) | |
tree | 7514a50448adfa5c3f3755ff6ce88e520801d7d8 /gm/spritebitmap.cpp | |
parent | 1a197ea31e0aac7ea312e9a6c0d9f5df626b0350 (diff) |
change SkImage_Gpu to handle all filters (w/ and w/o gpu support
The result is that the set of "generic" imagefilters (e.g. SkColorFilterImageFilter) that use drawing commands to return their results will now stay in the same domain as their src (i.e. gpu-src --> gpu-dst).
ApplyFilterGM exercises this, and now asserts this same-domain invariant.
BUG=skia:4467
Review URL: https://codereview.chromium.org/1401053003
Diffstat (limited to 'gm/spritebitmap.cpp')
-rw-r--r-- | gm/spritebitmap.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gm/spritebitmap.cpp b/gm/spritebitmap.cpp index 5cf0ece241..6aac09fbce 100644 --- a/gm/spritebitmap.cpp +++ b/gm/spritebitmap.cpp @@ -141,6 +141,11 @@ typedef SkImageFilter* (*ImageFilterFactory)(); // hence this cast function template <typename T> ImageFilterFactory IFCCast(T arg) { return arg; } +// We expect that applying the filter will keep us in the same domain (raster or gpu) +static void check_same_domain(SkImage* a, SkImage* b) { + SkASSERT(a->isTextureBacked() == b->isTextureBacked()); +} + /** * Compare output of drawSprite and drawBitmap (esp. clipping and imagefilters) */ @@ -180,6 +185,9 @@ protected: SkAutoTUnref<SkImage> image1(image0->applyFilter(filter, &offset1, true)); SkAutoTUnref<SkImage> image2(image0->applyFilter(filter, &offset2, false)); + check_same_domain(image0, image1); + check_same_domain(image0, image2); + canvas->save(); canvas->translate(30, 30); show_image(canvas, image0, SkIPoint::Make(0, 0)); // original |