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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
11 #include "SkShader.h" | 11 #include "SkShader.h" |
12 | 12 |
13 #include "SkArithmeticMode.h" | 13 #include "SkArithmeticMode.h" |
14 #include "SkGradientShader.h" | 14 #include "SkGradientShader.h" |
15 #define WW 100 | 15 #define WW 100 |
16 #define HH 32 | 16 #define HH 32 |
17 | 17 |
18 static SkBitmap make_bm() { | 18 static SkBitmap make_bm() { |
19 SkBitmap bm; | 19 SkBitmap bm; |
20 bm.setConfig(SkBitmap::kARGB_8888_Config, WW, HH); | 20 bm.allocN32Pixels(WW, HH); |
21 bm.allocPixels(); | |
22 bm.eraseColor(SK_ColorTRANSPARENT); | 21 bm.eraseColor(SK_ColorTRANSPARENT); |
23 return bm; | 22 return bm; |
24 } | 23 } |
25 | 24 |
26 static SkBitmap make_src() { | 25 static SkBitmap make_src() { |
27 SkBitmap bm = make_bm(); | 26 SkBitmap bm = make_bm(); |
28 SkCanvas canvas(bm); | 27 SkCanvas canvas(bm); |
29 SkPaint paint; | 28 SkPaint paint; |
30 SkPoint pts[] = { {0, 0}, {SkIntToScalar(WW), SkIntToScalar(HH)} }; | 29 SkPoint pts[] = { {0, 0}, {SkIntToScalar(WW), SkIntToScalar(HH)} }; |
31 SkColor colors[] = { | 30 SkColor colors[] = { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 123 } |
125 | 124 |
126 private: | 125 private: |
127 typedef GM INHERITED; | 126 typedef GM INHERITED; |
128 }; | 127 }; |
129 | 128 |
130 /////////////////////////////////////////////////////////////////////////////// | 129 /////////////////////////////////////////////////////////////////////////////// |
131 | 130 |
132 static skiagm::GM* MyFactory(void*) { return new ArithmodeGM; } | 131 static skiagm::GM* MyFactory(void*) { return new ArithmodeGM; } |
133 static skiagm::GMRegistry reg(MyFactory); | 132 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |