| 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
| 11 #include "SkUnitMappers.h" | 11 #include "SkUnitMappers.h" |
| 12 | 12 |
| 13 namespace skiagm { | 13 namespace skiagm { |
| 14 | 14 |
| 15 static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) { | 15 static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) { |
| 16 bm->setConfig(config, w, h); | 16 bm->allocConfigPixels(config, w, h); |
| 17 bm->allocPixels(); | |
| 18 bm->eraseColor(SK_ColorTRANSPARENT); | 17 bm->eraseColor(SK_ColorTRANSPARENT); |
| 19 | 18 |
| 20 SkCanvas canvas(*bm); | 19 SkCanvas canvas(*bm); |
| 21 SkScalar s = SkIntToScalar(SkMin32(w, h)); | 20 SkScalar s = SkIntToScalar(SkMin32(w, h)); |
| 22 SkPoint pts[] = { { 0, 0 }, { s, s } }; | 21 SkPoint pts[] = { { 0, 0 }, { s, s } }; |
| 23 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; | 22 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; |
| 24 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; | 23 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; |
| 25 SkPaint paint; | 24 SkPaint paint; |
| 26 | 25 |
| 27 SkUnitMapper* um = NULL; | 26 SkUnitMapper* um = NULL; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 typedef GM INHERITED; | 205 typedef GM INHERITED; |
| 207 }; | 206 }; |
| 208 | 207 |
| 209 /////////////////////////////////////////////////////////////////////////////// | 208 /////////////////////////////////////////////////////////////////////////////// |
| 210 | 209 |
| 211 #ifndef SK_BUILD_FOR_ANDROID | 210 #ifndef SK_BUILD_FOR_ANDROID |
| 212 static GM* MyFactory(void*) { return new ShaderTextGM; } | 211 static GM* MyFactory(void*) { return new ShaderTextGM; } |
| 213 static GMRegistry reg(MyFactory); | 212 static GMRegistry reg(MyFactory); |
| 214 #endif | 213 #endif |
| 215 } | 214 } |
| OLD | NEW |