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 "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 outer->unref(); | 67 outer->unref(); |
68 inner->unref(); | 68 inner->unref(); |
69 return pe; | 69 return pe; |
70 } | 70 } |
71 | 71 |
72 /////////////////////////////////////////////////////////// | 72 /////////////////////////////////////////////////////////// |
73 | 73 |
74 #include "SkColorFilter.h" | 74 #include "SkColorFilter.h" |
75 #include "SkLayerRasterizer.h" | 75 #include "SkLayerRasterizer.h" |
76 | 76 |
77 class testrast : public SkLayerRasterizer { | 77 class TestRastBuilder : public SkLayerRasterizer::Builder { |
78 public: | 78 public: |
79 testrast() { | 79 TestRastBuilder() { |
80 SkPaint paint; | 80 SkPaint paint; |
81 paint.setAntiAlias(true); | 81 paint.setAntiAlias(true); |
82 | 82 |
83 #if 0 | 83 #if 0 |
84 paint.setStyle(SkPaint::kStroke_Style); | 84 paint.setStyle(SkPaint::kStroke_Style); |
85 paint.setStrokeWidth(SK_Scalar1*4); | 85 paint.setStrokeWidth(SK_Scalar1*4); |
86 this->addLayer(paint); | 86 this->addLayer(paint); |
87 | 87 |
88 paint.setStrokeWidth(SK_Scalar1*1); | 88 paint.setStrokeWidth(SK_Scalar1*1); |
89 paint.setXfermode(SkXfermode::kClear_Mode); | 89 paint.setXfermode(SkXfermode::kClear_Mode); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 canvas->translate(0, SkIntToScalar(50)); | 170 canvas->translate(0, SkIntToScalar(50)); |
171 | 171 |
172 paint.setARGB(0xFF, 0, 0xBB, 0); | 172 paint.setARGB(0xFF, 0, 0xBB, 0); |
173 paint.setPathEffect(make_pe(3))->unref(); | 173 paint.setPathEffect(make_pe(3))->unref(); |
174 canvas->drawPath(fPath, paint); | 174 canvas->drawPath(fPath, paint); |
175 | 175 |
176 canvas->translate(0, SkIntToScalar(50)); | 176 canvas->translate(0, SkIntToScalar(50)); |
177 | 177 |
178 paint.setARGB(0xFF, 0, 0, 0); | 178 paint.setARGB(0xFF, 0, 0, 0); |
179 paint.setPathEffect(make_warp_pe())->unref(); | 179 paint.setPathEffect(make_warp_pe())->unref(); |
180 paint.setRasterizer(new testrast)->unref(); | 180 TestRastBuilder testRastBuilder; |
| 181 paint.setRasterizer(testRastBuilder.detachRasterizer())->unref(); |
181 canvas->drawPath(fPath, paint); | 182 canvas->drawPath(fPath, paint); |
182 } | 183 } |
183 | 184 |
184 private: | 185 private: |
185 typedef SampleView INHERITED; | 186 typedef SampleView INHERITED; |
186 }; | 187 }; |
187 | 188 |
188 ////////////////////////////////////////////////////////////////////////////// | 189 ////////////////////////////////////////////////////////////////////////////// |
189 | 190 |
190 static SkView* MyFactory() { return new PathEffectView; } | 191 static SkView* MyFactory() { return new PathEffectView; } |
191 static SkViewRegister reg(MyFactory); | 192 static SkViewRegister reg(MyFactory); |
OLD | NEW |