Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: gm/shadertext.cpp

Issue 140593005: add legacy/helper allocN32Pixels, and convert gm to use it (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gm/scalebitmap.cpp ('k') | gm/shadertext2.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « gm/scalebitmap.cpp ('k') | gm/shadertext2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698