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 /* | 13 /* |
14 * Want to ensure that our bitmap sampler (in bitmap shader) keeps plenty of | 14 * Want to ensure that our bitmap sampler (in bitmap shader) keeps plenty of |
15 * precision when scaling very large images (where the dx might get very small. | 15 * precision when scaling very large images (where the dx might get very small. |
16 */ | 16 */ |
17 | 17 |
18 #define W 257 | 18 #define W 257 |
19 #define H 161 | 19 #define H 161 |
20 | 20 |
21 class GiantBitmapGM : public skiagm::GM { | 21 class GiantBitmapGM : public skiagm::GM { |
22 SkBitmap* fBM; | 22 SkBitmap* fBM; |
23 SkShader::TileMode fMode; | 23 SkShader::TileMode fMode; |
24 bool fDoFilter; | 24 bool fDoFilter; |
25 bool fDoRotate; | 25 bool fDoRotate; |
26 | 26 |
27 const SkBitmap& getBitmap() { | 27 const SkBitmap& getBitmap() { |
28 if (NULL == fBM) { | 28 if (NULL == fBM) { |
29 fBM = new SkBitmap; | 29 fBM = new SkBitmap; |
30 fBM->setConfig(SkBitmap::kARGB_8888_Config, W, H); | 30 fBM->allocN32Pixels(W, H); |
31 fBM->allocPixels(); | |
32 fBM->eraseColor(SK_ColorWHITE); | 31 fBM->eraseColor(SK_ColorWHITE); |
33 | 32 |
34 const SkColor colors[] = { | 33 const SkColor colors[] = { |
35 SK_ColorBLUE, SK_ColorRED, SK_ColorBLACK, SK_ColorGREEN | 34 SK_ColorBLUE, SK_ColorRED, SK_ColorBLACK, SK_ColorGREEN |
36 }; | 35 }; |
37 | 36 |
38 SkCanvas canvas(*fBM); | 37 SkCanvas canvas(*fBM); |
39 SkPaint paint; | 38 SkPaint paint; |
40 paint.setAntiAlias(true); | 39 paint.setAntiAlias(true); |
41 paint.setStrokeWidth(SkIntToScalar(20)); | 40 paint.setStrokeWidth(SkIntToScalar(20)); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 static skiagm::GMRegistry reg010(G010); | 144 static skiagm::GMRegistry reg010(G010); |
146 static skiagm::GMRegistry reg110(G110); | 145 static skiagm::GMRegistry reg110(G110); |
147 static skiagm::GMRegistry reg210(G210); | 146 static skiagm::GMRegistry reg210(G210); |
148 | 147 |
149 static skiagm::GMRegistry reg001(G001); | 148 static skiagm::GMRegistry reg001(G001); |
150 static skiagm::GMRegistry reg101(G101); | 149 static skiagm::GMRegistry reg101(G101); |
151 static skiagm::GMRegistry reg201(G201); | 150 static skiagm::GMRegistry reg201(G201); |
152 static skiagm::GMRegistry reg011(G011); | 151 static skiagm::GMRegistry reg011(G011); |
153 static skiagm::GMRegistry reg111(G111); | 152 static skiagm::GMRegistry reg111(G111); |
154 static skiagm::GMRegistry reg211(G211); | 153 static skiagm::GMRegistry reg211(G211); |
OLD | NEW |