OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 bm->eraseColor(SK_ColorRED); | 21 bm->eraseColor(SK_ColorRED); |
22 | 22 |
23 SkCanvas canvas(*bm); | 23 SkCanvas canvas(*bm); |
24 canvas.drawCircle(10, 10, 5, bluePaint); | 24 canvas.drawCircle(10, 10, 5, bluePaint); |
25 } | 25 } |
26 | 26 |
27 static void draw_mask(SkBitmap* bm) { | 27 static void draw_mask(SkBitmap* bm) { |
28 SkPaint circlePaint; | 28 SkPaint circlePaint; |
29 circlePaint.setColor(SK_ColorBLACK); | 29 circlePaint.setColor(SK_ColorBLACK); |
30 | 30 |
31 bm->allocConfigPixels(SkBitmap::kA8_Config, 20, 20); | 31 bm->allocPixels(SkImageInfo::MakeA8(20, 20)); |
32 bm->eraseColor(SK_ColorTRANSPARENT); | 32 bm->eraseColor(SK_ColorTRANSPARENT); |
33 | 33 |
34 SkCanvas canvas(*bm); | 34 SkCanvas canvas(*bm); |
35 canvas.drawCircle(10, 10, 10, circlePaint); | 35 canvas.drawCircle(10, 10, 10, circlePaint); |
36 } | 36 } |
37 | 37 |
38 class BitmapShaderGM : public GM { | 38 class BitmapShaderGM : public GM { |
39 public: | 39 public: |
40 | 40 |
41 BitmapShaderGM() { | 41 BitmapShaderGM() { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 typedef GM INHERITED; | 93 typedef GM INHERITED; |
94 }; | 94 }; |
95 | 95 |
96 ////////////////////////////////////////////////////////////////////////////// | 96 ////////////////////////////////////////////////////////////////////////////// |
97 | 97 |
98 static GM* MyFactory(void*) { return new BitmapShaderGM; } | 98 static GM* MyFactory(void*) { return new BitmapShaderGM; } |
99 static GMRegistry reg(MyFactory); | 99 static GMRegistry reg(MyFactory); |
100 | 100 |
101 } | 101 } |
OLD | NEW |