Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: samplecode/SamplePathEffects.cpp

Issue 176873004: Builder class for SkLayerRasterizer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make ReadLayers private Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | samplecode/SampleSlides.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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);
OLDNEW
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | samplecode/SampleSlides.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698