OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkRegion.h" | 10 #include "SkRegion.h" |
11 #include "SkShader.h" | 11 #include "SkShader.h" |
12 #include "SkUtils.h" | 12 #include "SkUtils.h" |
13 #include "SkColorPriv.h" | 13 #include "SkColorPriv.h" |
14 #include "SkColorFilter.h" | 14 #include "SkColorFilter.h" |
15 #include "SkTypeface.h" | 15 #include "SkTypeface.h" |
16 | 16 |
17 // effects | 17 // effects |
18 #include "SkGradientShader.h" | 18 #include "SkGradientShader.h" |
19 #include "SkUnitMappers.h" | 19 #include "SkUnitMappers.h" |
20 #include "SkBlurDrawLooper.h" | 20 #include "SkBlurDrawLooper.h" |
21 | 21 |
22 static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) { | 22 static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) { |
23 bm->setConfig(config, w, h); | 23 bm->allocConfigPixels(config, w, h); |
24 bm->allocPixels(); | |
25 bm->eraseColor(SK_ColorTRANSPARENT); | 24 bm->eraseColor(SK_ColorTRANSPARENT); |
26 | 25 |
27 SkCanvas canvas(*bm); | 26 SkCanvas canvas(*bm); |
28 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h)} }; | 27 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h)} }; |
29 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; | 28 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; |
30 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; | 29 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; |
31 SkPaint paint; | 30 SkPaint paint; |
32 | 31 |
33 SkUnitMapper* um = NULL; | 32 SkUnitMapper* um = NULL; |
34 | 33 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 private: | 261 private: |
263 typedef skiagm::GM INHERITED; | 262 typedef skiagm::GM INHERITED; |
264 }; | 263 }; |
265 | 264 |
266 ////////////////////////////////////////////////////////////////////////////// | 265 ////////////////////////////////////////////////////////////////////////////// |
267 | 266 |
268 DEF_GM( return new TilingGM(true); ) | 267 DEF_GM( return new TilingGM(true); ) |
269 DEF_GM( return new TilingGM(false); ) | 268 DEF_GM( return new TilingGM(false); ) |
270 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) | 269 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) |
271 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) | 270 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) |
OLD | NEW |