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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 p.addOval(r); | 50 p.addOval(r); |
51 p.setFillType(SkPath::kInverseWinding_FillType); | 51 p.setFillType(SkPath::kInverseWinding_FillType); |
52 paint.setXfermodeMode(SkXfermode::kDstOut_Mode); | 52 paint.setXfermodeMode(SkXfermode::kDstOut_Mode); |
53 canvas->drawPath(p, paint); | 53 canvas->drawPath(p, paint); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 virtual void onDrawContent(SkCanvas* canvas) { | 57 virtual void onDrawContent(SkCanvas* canvas) { |
58 SkRect r; | 58 SkRect r; |
59 r.set(SkIntToScalar(20), SkIntToScalar(20), SkIntToScalar(120), SkIntToS
calar(120)); | 59 r.set(SkIntToScalar(20), SkIntToScalar(20), SkIntToScalar(120), SkIntToS
calar(120)); |
60 canvas->saveLayer(&r, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); | 60 canvas->saveLayer(&r, NULL); |
61 canvas->drawColor(SK_ColorRED); | 61 canvas->drawColor(SK_ColorRED); |
62 drawMask(canvas, r); | 62 drawMask(canvas, r); |
63 canvas->restore(); | 63 canvas->restore(); |
64 } | 64 } |
65 | 65 |
66 private: | 66 private: |
67 typedef SampleView INHERITED; | 67 typedef SampleView INHERITED; |
68 }; | 68 }; |
69 | 69 |
70 /////////////////////////////////////////////////////////////////////////////// | 70 /////////////////////////////////////////////////////////////////////////////// |
71 | 71 |
72 static SkView* MyFactory() { return new LayerMaskView; } | 72 static SkView* MyFactory() { return new LayerMaskView; } |
73 static SkViewRegister reg(MyFactory); | 73 static SkViewRegister reg(MyFactory); |
OLD | NEW |