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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 private: | 272 private: |
274 typedef skiagm::GM INHERITED; | 273 typedef skiagm::GM INHERITED; |
275 }; | 274 }; |
276 | 275 |
277 ////////////////////////////////////////////////////////////////////////////// | 276 ////////////////////////////////////////////////////////////////////////////// |
278 | 277 |
279 DEF_GM( return new ScaledTilingGM(true); ) | 278 DEF_GM( return new ScaledTilingGM(true); ) |
280 DEF_GM( return new ScaledTilingGM(false); ) | 279 DEF_GM( return new ScaledTilingGM(false); ) |
281 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) | 280 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) |
282 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) | 281 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) |
OLD | NEW |