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

Side by Side Diff: gm/shadertext3.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/shadertext2.cpp ('k') | gm/spritebitmap.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 * 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 #include "gm.h" 7 #include "gm.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 #include "SkUnitMappers.h" 10 #include "SkUnitMappers.h"
11 11
12 namespace skiagm { 12 namespace skiagm {
13 13
14 static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) { 14 static void makebm(SkBitmap* bm, SkBitmap::Config config, int w, int h) {
15 bm->setConfig(config, w, h); 15 bm->allocConfigPixels(config, w, h);
16 bm->allocPixels();
17 bm->eraseColor(SK_ColorTRANSPARENT); 16 bm->eraseColor(SK_ColorTRANSPARENT);
18 17
19 SkCanvas canvas(*bm); 18 SkCanvas canvas(*bm);
20 SkScalar s = SkIntToScalar(SkMin32(w, h)); 19 SkScalar s = SkIntToScalar(SkMin32(w, h));
21 static const SkPoint kPts0[] = { { 0, 0 }, { s, s } }; 20 static const SkPoint kPts0[] = { { 0, 0 }, { s, s } };
22 static const SkPoint kPts1[] = { { s/2, 0 }, { s/2, s } }; 21 static const SkPoint kPts1[] = { { s/2, 0 }, { s/2, s } };
23 static const SkScalar kPos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; 22 static const SkScalar kPos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
24 static const SkColor kColors0[] = {0x80F00080, 0xF0F08000, 0x800080F0 }; 23 static const SkColor kColors0[] = {0x80F00080, 0xF0F08000, 0x800080F0 };
25 static const SkColor kColors1[] = {0xF08000F0, 0x8080F000, 0xF000F080 }; 24 static const SkColor kColors1[] = {0xF08000F0, 0x8080F000, 0xF000F080 };
26 25
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 typedef GM INHERITED; 134 typedef GM INHERITED;
136 }; 135 };
137 136
138 /////////////////////////////////////////////////////////////////////////////// 137 ///////////////////////////////////////////////////////////////////////////////
139 138
140 #ifndef SK_BUILD_FOR_ANDROID 139 #ifndef SK_BUILD_FOR_ANDROID
141 static GM* MyFactory(void*) { return new ShaderText3GM; } 140 static GM* MyFactory(void*) { return new ShaderText3GM; }
142 static GMRegistry reg(MyFactory); 141 static GMRegistry reg(MyFactory);
143 #endif 142 #endif
144 } 143 }
OLDNEW
« no previous file with comments | « gm/shadertext2.cpp ('k') | gm/spritebitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698