OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkImageFilter.h" | 9 #include "SkImageFilter.h" |
10 #include "SkColorMatrixFilter.h" | 10 #include "SkColorMatrixFilter.h" |
11 | 11 |
12 /** | 12 /** |
13 * Test drawing a primitive w/ an imagefilter (in this case, just matrix w/ ide
ntity) to see | 13 * Test drawing a primitive w/ an imagefilter (in this case, just matrix w/ ide
ntity) to see |
14 * that we apply the xfermode *after* the image has been created and filtered,
and not during | 14 * that we apply the xfermode *after* the image has been created and filtered,
and not during |
15 * the creation step (i.e. before it is filtered). | 15 * the creation step (i.e. before it is filtered). |
16 * | 16 * |
17 * see skbug.com/3741 | 17 * see https://bug.skia.org/3741 |
18 */ | 18 */ |
19 static void do_draw(SkCanvas* canvas, SkXfermode::Mode mode, SkImageFilter* imf)
{ | 19 static void do_draw(SkCanvas* canvas, SkXfermode::Mode mode, SkImageFilter* imf)
{ |
20 SkAutoCanvasRestore acr(canvas, true); | 20 SkAutoCanvasRestore acr(canvas, true); |
21 canvas->clipRect(SkRect::MakeWH(220, 220)); | 21 canvas->clipRect(SkRect::MakeWH(220, 220)); |
22 | 22 |
23 // want to force a layer, so modes like DstIn can combine meaningfully,
but the final | 23 // want to force a layer, so modes like DstIn can combine meaningfully,
but the final |
24 // image can still be shown against our default (opaque) background. non
-opaque GMs | 24 // image can still be shown against our default (opaque) background. non
-opaque GMs |
25 // are a lot more trouble to compare/triage. | 25 // are a lot more trouble to compare/triage. |
26 canvas->saveLayer(nullptr, nullptr); | 26 canvas->saveLayer(nullptr, nullptr); |
27 canvas->drawColor(SK_ColorGREEN); | 27 canvas->drawColor(SK_ColorGREEN); |
(...skipping 27 matching lines...) Expand all Loading... |
55 for (size_t i = 0; i < SK_ARRAY_COUNT(modes); ++i) { | 55 for (size_t i = 0; i < SK_ARRAY_COUNT(modes); ++i) { |
56 canvas->save(); | 56 canvas->save(); |
57 do_draw(canvas, modes[i], nullptr); | 57 do_draw(canvas, modes[i], nullptr); |
58 canvas->translate(240, 0); | 58 canvas->translate(240, 0); |
59 do_draw(canvas, modes[i], imf); | 59 do_draw(canvas, modes[i], imf); |
60 canvas->restore(); | 60 canvas->restore(); |
61 | 61 |
62 canvas->translate(0, 240); | 62 canvas->translate(0, 240); |
63 } | 63 } |
64 } | 64 } |
OLD | NEW |