OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SampleCode.h" | 9 #include "SampleCode.h" |
10 #include "SkView.h" | 10 #include "SkView.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 static void drawClip(SkCanvas* canvas, const SkAAClip& clip) { | 42 static void drawClip(SkCanvas* canvas, const SkAAClip& clip) { |
43 SkMask mask; | 43 SkMask mask; |
44 SkBitmap bm; | 44 SkBitmap bm; |
45 | 45 |
46 clip.copyToMask(&mask); | 46 clip.copyToMask(&mask); |
47 SkAutoMaskFreeImage amfi(mask.fImage); | 47 SkAutoMaskFreeImage amfi(mask.fImage); |
48 | 48 |
49 bm.installPixels(SkImageInfo::MakeA8(mask.fBounds.width(), | 49 bm.installMaskPixels(mask); |
50 mask.fBounds.height()), | |
51 mask.fImage, mask.fRowBytes, NULL, NULL); | |
52 | 50 |
53 SkPaint paint; | 51 SkPaint paint; |
54 canvas->drawBitmap(bm, | 52 canvas->drawBitmap(bm, |
55 SK_Scalar1 * mask.fBounds.fLeft, | 53 SK_Scalar1 * mask.fBounds.fLeft, |
56 SK_Scalar1 * mask.fBounds.fTop, | 54 SK_Scalar1 * mask.fBounds.fTop, |
57 &paint); | 55 &paint); |
58 } | 56 } |
59 | 57 |
60 class AAClipView : public SampleView { | 58 class AAClipView : public SampleView { |
61 public: | 59 public: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 116 } |
119 | 117 |
120 private: | 118 private: |
121 typedef SkView INHERITED; | 119 typedef SkView INHERITED; |
122 }; | 120 }; |
123 | 121 |
124 ////////////////////////////////////////////////////////////////////////////// | 122 ////////////////////////////////////////////////////////////////////////////// |
125 | 123 |
126 static SkView* MyFactory() { return new AAClipView; } | 124 static SkView* MyFactory() { return new AAClipView; } |
127 static SkViewRegister reg(MyFactory); | 125 static SkViewRegister reg(MyFactory); |
OLD | NEW |