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 "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 if (false) { // avoid bit rot, suppress warning | 223 if (false) { // avoid bit rot, suppress warning |
224 test_chromium_9005(); | 224 test_chromium_9005(); |
225 } | 225 } |
226 | 226 |
227 SkBitmap bm, bm2; | 227 SkBitmap bm, bm2; |
228 bm.allocN32Pixels(WIDTH + MARGIN*2, HEIGHT + MARGIN*2); | 228 bm.allocN32Pixels(WIDTH + MARGIN*2, HEIGHT + MARGIN*2); |
229 // this will erase our margin, which we want to always stay 0 | 229 // this will erase our margin, which we want to always stay 0 |
230 bm.eraseColor(SK_ColorTRANSPARENT); | 230 bm.eraseColor(SK_ColorTRANSPARENT); |
231 | 231 |
232 bm2.installPixels(SkImageInfo::MakeN32Premul(WIDTH, HEIGHT), | 232 bm2.installPixels(SkImageInfo::MakeN32Premul(WIDTH, HEIGHT), |
233 bm.getAddr32(MARGIN, MARGIN), bm.rowBytes(), | 233 bm.getAddr32(MARGIN, MARGIN), bm.rowBytes()); |
234 NULL, NULL); | |
235 | 234 |
236 SkCanvas c2(bm2); | 235 SkCanvas c2(bm2); |
237 SkPaint paint; | 236 SkPaint paint; |
238 paint.setAntiAlias(fDoAA); | 237 paint.setAntiAlias(fDoAA); |
239 paint.setStyle(SkPaint::kStroke_Style); | 238 paint.setStyle(SkPaint::kStroke_Style); |
240 | 239 |
241 bm2.eraseColor(SK_ColorTRANSPARENT); | 240 bm2.eraseColor(SK_ColorTRANSPARENT); |
242 gProcs[fProcIndex].fProc(&c2, paint, bm); | 241 gProcs[fProcIndex].fProc(&c2, paint, bm); |
243 canvas->drawBitmap(bm2, SkIntToScalar(10), SkIntToScalar(10), NULL); | 242 canvas->drawBitmap(bm2, SkIntToScalar(10), SkIntToScalar(10), NULL); |
244 | 243 |
(...skipping 20 matching lines...) Expand all Loading... |
265 | 264 |
266 | 265 |
267 private: | 266 private: |
268 typedef SampleView INHERITED; | 267 typedef SampleView INHERITED; |
269 }; | 268 }; |
270 | 269 |
271 ////////////////////////////////////////////////////////////////////////////// | 270 ////////////////////////////////////////////////////////////////////////////// |
272 | 271 |
273 static SkView* MyFactory() { return new HairlineView; } | 272 static SkView* MyFactory() { return new HairlineView; } |
274 static SkViewRegister reg(MyFactory); | 273 static SkViewRegister reg(MyFactory); |
OLD | NEW |