OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkColorMatrixFilter.h" | 9 #include "SkColorMatrixFilter.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 } | 28 } |
29 | 29 |
30 protected: | 30 protected: |
31 SkString onShortName() override { | 31 SkString onShortName() override { |
32 return SkString("colormatrix"); | 32 return SkString("colormatrix"); |
33 } | 33 } |
34 | 34 |
35 SkISize onISize() override { | 35 SkISize onISize() override { |
36 return SkISize::Make(WIDTH, HEIGHT); | 36 return SkISize::Make(WIDTH, HEIGHT); |
37 } | 37 } |
38 | 38 |
39 void onOnceBeforeDraw() override { | 39 void onOnceBeforeDraw() override { |
40 fSolidImg = CreateSolidBitmap(64, 64); | 40 fSolidImg = CreateSolidBitmap(64, 64); |
41 fTransparentImg = CreateTransparentBitmap(64, 64); | 41 fTransparentImg = CreateTransparentBitmap(64, 64); |
42 } | 42 } |
43 | 43 |
44 static sk_sp<SkImage> CreateSolidBitmap(int width, int height) { | 44 static sk_sp<SkImage> CreateSolidBitmap(int width, int height) { |
45 SkBitmap bm; | 45 SkBitmap bm; |
46 bm.allocN32Pixels(width, height); | 46 bm.allocN32Pixels(width, height); |
47 SkCanvas canvas(bm); | 47 SkCanvas canvas(bm); |
48 canvas.clear(0x0); | 48 canvas.clear(0x0); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 private: | 141 private: |
142 sk_sp<SkImage> fSolidImg; | 142 sk_sp<SkImage> fSolidImg; |
143 sk_sp<SkImage> fTransparentImg; | 143 sk_sp<SkImage> fTransparentImg; |
144 | 144 |
145 typedef skiagm::GM INHERITED; | 145 typedef skiagm::GM INHERITED; |
146 }; | 146 }; |
147 DEF_GM( return new ColorMatrixGM; ) | 147 DEF_GM( return new ColorMatrixGM; ) |
148 | |
OLD | NEW |