OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 static void draw_scene(SkCanvas* canvas, SkColorFilter* filter, | 28 static void draw_scene(SkCanvas* canvas, SkColorFilter* filter, |
29 SkXfermode::Mode mode, SkShader* s1, | 29 SkXfermode::Mode mode, SkShader* s1, |
30 SkShader* s2) { | 30 SkShader* s2) { |
31 SkPaint paint; | 31 SkPaint paint; |
32 paint.setAntiAlias(true); | 32 paint.setAntiAlias(true); |
33 SkRect r, c, bounds = SkRect::MakeWH(kSize, kSize); | 33 SkRect r, c, bounds = SkRect::MakeWH(kSize, kSize); |
34 | 34 |
35 c = bounds; | 35 c = bounds; |
36 c.fRight = bounds.centerX(); | 36 c.fRight = bounds.centerX(); |
| 37 paint.setARGB(0x20, 0, 0, 0xff); |
37 canvas->drawRect(bounds, paint); | 38 canvas->drawRect(bounds, paint); |
38 | 39 |
39 canvas->saveLayer(&bounds, NULL); | 40 canvas->saveLayer(&bounds, NULL); |
40 | 41 |
41 r = bounds; | 42 r = bounds; |
42 r.inset(kInset, 0); | 43 r.inset(kInset, 0); |
43 paint.setShader(s1); | 44 paint.setShader(s1); |
44 paint.setColor(s1 ? SK_ColorBLACK : SkColorSetA(kColor1, 0x80)); | 45 paint.setColor(s1 ? SK_ColorBLACK : SkColorSetA(kColor1, 0x80)); |
45 canvas->drawOval(r, paint); | 46 canvas->drawOval(r, paint); |
46 if (!s1) { | 47 if (!s1) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 private: | 144 private: |
144 SkAutoTUnref<SkColorFilter> fFilter; | 145 SkAutoTUnref<SkColorFilter> fFilter; |
145 SkAutoTUnref<SkShader> fGr1, fGr2; | 146 SkAutoTUnref<SkShader> fGr1, fGr2; |
146 | 147 |
147 typedef skiagm::GM INHERITED; | 148 typedef skiagm::GM INHERITED; |
148 }; | 149 }; |
149 | 150 |
150 ////////////////////////////////////////////////////////////////////////////// | 151 ////////////////////////////////////////////////////////////////////////////// |
151 | 152 |
152 DEF_GM( return SkNEW(LumaFilterGM); ) | 153 DEF_GM( return SkNEW(LumaFilterGM); ) |
OLD | NEW |