| 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.setConfig(SkBitmap::kA8_Config, mask.fBounds.width(), | 49 bm.installPixels(SkImageInfo::MakeA8(mask.fBounds.width(), |
| 50 mask.fBounds.height(), mask.fRowBytes); | 50 mask.fBounds.height()), |
| 51 bm.setPixels(mask.fImage); | 51 mask.fImage, mask.fRowBytes, NULL, NULL); |
| 52 | 52 |
| 53 SkPaint paint; | 53 SkPaint paint; |
| 54 canvas->drawBitmap(bm, | 54 canvas->drawBitmap(bm, |
| 55 SK_Scalar1 * mask.fBounds.fLeft, | 55 SK_Scalar1 * mask.fBounds.fLeft, |
| 56 SK_Scalar1 * mask.fBounds.fTop, | 56 SK_Scalar1 * mask.fBounds.fTop, |
| 57 &paint); | 57 &paint); |
| 58 } | 58 } |
| 59 | 59 |
| 60 class AAClipView : public SampleView { | 60 class AAClipView : public SampleView { |
| 61 public: | 61 public: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 118 } |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 typedef SkView INHERITED; | 121 typedef SkView INHERITED; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 ////////////////////////////////////////////////////////////////////////////// | 124 ////////////////////////////////////////////////////////////////////////////// |
| 125 | 125 |
| 126 static SkView* MyFactory() { return new AAClipView; } | 126 static SkView* MyFactory() { return new AAClipView; } |
| 127 static SkViewRegister reg(MyFactory); | 127 static SkViewRegister reg(MyFactory); |
| OLD | NEW |