| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 | 8 |
| 9 #include "gm.h" | 9 #include "gm.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| 11 #include "SkAAClip.h" | 11 #include "SkAAClip.h" |
| 12 | 12 |
| 13 namespace skiagm { | 13 namespace skiagm { |
| 14 | 14 |
| 15 static void paint_rgn(SkCanvas* canvas, const SkAAClip& clip, | 15 static void paint_rgn(SkCanvas* canvas, const SkAAClip& clip, |
| 16 const SkPaint& paint) { | 16 const SkPaint& paint) { |
| 17 SkMask mask; | 17 SkMask mask; |
| 18 SkBitmap bm; | 18 SkBitmap bm; |
| 19 | 19 |
| 20 clip.copyToMask(&mask); | 20 clip.copyToMask(&mask); |
| 21 | 21 |
| 22 SkAutoMaskFreeImage amfi(mask.fImage); | 22 SkAutoMaskFreeImage amfi(mask.fImage); |
| 23 | 23 |
| 24 bm.setConfig(SkBitmap::kA8_Config, mask.fBounds.width(), | 24 bm.installMaskPixels(mask); |
| 25 mask.fBounds.height(), mask.fRowBytes); | |
| 26 bm.setPixels(mask.fImage); | |
| 27 | 25 |
| 28 // need to copy for deferred drawing test to work | 26 // need to copy for deferred drawing test to work |
| 29 SkBitmap bm2; | 27 SkBitmap bm2; |
| 30 | 28 |
| 31 bm.deepCopyTo(&bm2, SkBitmap::kA8_Config); | 29 bm.deepCopyTo(&bm2, SkBitmap::kA8_Config); |
| 32 | 30 |
| 33 canvas->drawBitmap(bm2, | 31 canvas->drawBitmap(bm2, |
| 34 SK_Scalar1 * mask.fBounds.fLeft, | 32 SK_Scalar1 * mask.fBounds.fLeft, |
| 35 SK_Scalar1 * mask.fBounds.fTop, | 33 SK_Scalar1 * mask.fBounds.fTop, |
| 36 &paint); | 34 &paint); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 }; | 191 }; |
| 194 | 192 |
| 195 ////////////////////////////////////////////////////////////////////////////// | 193 ////////////////////////////////////////////////////////////////////////////// |
| 196 | 194 |
| 197 // rects | 195 // rects |
| 198 DEF_GM( return new SimpleClipGM(SimpleClipGM::kRect_GeomType); ) | 196 DEF_GM( return new SimpleClipGM(SimpleClipGM::kRect_GeomType); ) |
| 199 DEF_GM( return new SimpleClipGM(SimpleClipGM::kPath_GeomType); ) | 197 DEF_GM( return new SimpleClipGM(SimpleClipGM::kPath_GeomType); ) |
| 200 DEF_GM( return new SimpleClipGM(SimpleClipGM::kAAClip_GeomType); ) | 198 DEF_GM( return new SimpleClipGM(SimpleClipGM::kAAClip_GeomType); ) |
| 201 | 199 |
| 202 } | 200 } |
| OLD | NEW |