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

Side by Side Diff: gm/hairmodes.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/gmmain.cpp ('k') | gm/imagefiltersbase.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 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 SkScalar y = SkScalarSin(SkIntToScalar(angle) * (SK_ScalarPI * 2) / 24) * gHeight; 53 SkScalar y = SkScalarSin(SkIntToScalar(angle) * (SK_ScalarPI * 2) / 24) * gHeight;
54 paint.setStrokeWidth(SK_Scalar1 * angle * 2 / 24); 54 paint.setStrokeWidth(SK_Scalar1 * angle * 2 / 24);
55 canvas->drawLine(W/2, H/2, W/2 + x, H/2 + y, paint); 55 canvas->drawLine(W/2, H/2, W/2 + x, H/2 + y, paint);
56 } 56 }
57 57
58 return H; 58 return H;
59 } 59 }
60 60
61 static SkShader* make_bg_shader() { 61 static SkShader* make_bg_shader() {
62 SkBitmap bm; 62 SkBitmap bm;
63 bm.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); 63 bm.allocN32Pixels(2, 2);
64 bm.allocPixels();
65 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF; 64 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF;
66 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC, 0xCC, 0 xCC); 65 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC, 0xCC, 0 xCC);
67 66
68 SkShader* s = SkShader::CreateBitmapShader(bm, 67 SkShader* s = SkShader::CreateBitmapShader(bm,
69 SkShader::kRepeat_TileMode, 68 SkShader::kRepeat_TileMode,
70 SkShader::kRepeat_TileMode); 69 SkShader::kRepeat_TileMode);
71 70
72 SkMatrix m; 71 SkMatrix m;
73 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); 72 m.setScale(SkIntToScalar(6), SkIntToScalar(6));
74 s->setLocalMatrix(m); 73 s->setLocalMatrix(m);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 private: 130 private:
132 typedef GM INHERITED; 131 typedef GM INHERITED;
133 }; 132 };
134 133
135 //////////////////////////////////////////////////////////////////////////// // 134 //////////////////////////////////////////////////////////////////////////// //
136 135
137 static GM* MyFactory(void*) { return new HairModesGM; } 136 static GM* MyFactory(void*) { return new HairModesGM; }
138 static GMRegistry reg(MyFactory); 137 static GMRegistry reg(MyFactory);
139 138
140 } 139 }
OLDNEW
« no previous file with comments | « gm/gmmain.cpp ('k') | gm/imagefiltersbase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698