OLD | NEW |
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 SkRect rect = SkRect::MakeXYWH(W / 4 + offset, | 101 SkRect rect = SkRect::MakeXYWH(W / 4 + offset, |
102 H / 4 + offset, | 102 H / 4 + offset, |
103 W / 2, H / 2); | 103 W / 2, H / 2); |
104 canvas->drawRect(rect, paint); | 104 canvas->drawRect(rect, paint); |
105 | 105 |
106 return H; | 106 return H; |
107 } | 107 } |
108 | 108 |
109 static SkShader* make_bg_shader() { | 109 static SkShader* make_bg_shader() { |
110 SkBitmap bm; | 110 SkBitmap bm; |
111 bm.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); | 111 bm.allocN32Pixels(2, 2); |
112 bm.allocPixels(); | |
113 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF; | 112 *bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF; |
114 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC, | 113 *bm.getAddr32(1, 0) = *bm.getAddr32(0, 1) = SkPackARGB32(0xFF, 0xCC, |
115 0xCC, 0xCC); | 114 0xCC, 0xCC); |
116 | 115 |
117 SkShader* s = SkShader::CreateBitmapShader(bm, | 116 SkShader* s = SkShader::CreateBitmapShader(bm, |
118 SkShader::kRepeat_TileMode, | 117 SkShader::kRepeat_TileMode, |
119 SkShader::kRepeat_TileMode); | 118 SkShader::kRepeat_TileMode); |
120 | 119 |
121 SkMatrix m; | 120 SkMatrix m; |
122 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); | 121 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 private: | 179 private: |
181 typedef GM INHERITED; | 180 typedef GM INHERITED; |
182 }; | 181 }; |
183 | 182 |
184 ////////////////////////////////////////////////////////////////////////////// | 183 ////////////////////////////////////////////////////////////////////////////// |
185 | 184 |
186 static GM* MyFactory(void*) { return new AARectModesGM; } | 185 static GM* MyFactory(void*) { return new AARectModesGM; } |
187 static GMRegistry reg(MyFactory); | 186 static GMRegistry reg(MyFactory); |
188 | 187 |
189 } | 188 } |
OLD | NEW |