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

Side by Side Diff: samplecode/SampleAARectModes.cpp

Issue 169063002: use SkColorType instead of SkBitmap::Config in samplecode (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | « samplecode/SampleAAClip.cpp ('k') | samplecode/SampleAARects.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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 SkRect rect = SkRect::MakeXYWH(W / 4 + offset, 56 SkRect rect = SkRect::MakeXYWH(W / 4 + offset,
57 H / 4 + offset, 57 H / 4 + offset,
58 W / 2, H / 2); 58 W / 2, H / 2);
59 canvas->drawRect(rect, paint); 59 canvas->drawRect(rect, paint);
60 60
61 return H; 61 return H;
62 } 62 }
63 63
64 static SkShader* make_bg_shader() { 64 static SkShader* make_bg_shader() {
65 SkBitmap bm; 65 SkBitmap bm;
66 bm.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); 66 bm.allocN32Pixels(2, 2);
67 bm.allocPixels();
68 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF; 67 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF;
69 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC, 68 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC,
70 0xCC, 0xCC); 69 0xCC, 0xCC);
71 70
72 SkShader* s = SkShader::CreateBitmapShader(bm, 71 SkShader* s = SkShader::CreateBitmapShader(bm,
73 SkShader::kRepeat_TileMode, 72 SkShader::kRepeat_TileMode,
74 SkShader::kRepeat_TileMode); 73 SkShader::kRepeat_TileMode);
75 74
76 SkMatrix m; 75 SkMatrix m;
77 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); 76 m.setScale(SkIntToScalar(6), SkIntToScalar(6));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 129 }
131 130
132 private: 131 private:
133 typedef SampleView INHERITED; 132 typedef SampleView INHERITED;
134 }; 133 };
135 134
136 /////////////////////////////////////////////////////////////////////////////// 135 ///////////////////////////////////////////////////////////////////////////////
137 136
138 static SkView* MyFactory() { return new AARectsModesView; } 137 static SkView* MyFactory() { return new AARectsModesView; }
139 static SkViewRegister reg(MyFactory); 138 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleAAClip.cpp ('k') | samplecode/SampleAARects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698