Index: samplecode/SampleSlides.cpp |
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp |
index 914283aab022c7b95dc2d468a1991f0ae8c0ed88..ece96849f9fcc8c38f10f80a9dbb25d0ed1abd53 100644 |
--- a/samplecode/SampleSlides.cpp |
+++ b/samplecode/SampleSlides.cpp |
@@ -476,92 +476,92 @@ static void mesh_slide(SkCanvas* canvas) { |
/////////////////////////////////////////////////////////////////////////////// |
-static void r0(SkLayerRasterizer* rast, SkPaint& p) |
+static void r0(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) |
{ |
p.setMaskFilter(SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle, |
SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(3))))->unref(); |
- rast->addLayer(p, SkIntToScalar(3), SkIntToScalar(3)); |
+ rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3)); |
p.setMaskFilter(NULL); |
p.setStyle(SkPaint::kStroke_Style); |
p.setStrokeWidth(SK_Scalar1); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
p.setAlpha(0x11); |
p.setStyle(SkPaint::kFill_Style); |
p.setXfermodeMode(SkXfermode::kSrc_Mode); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
} |
-static void r1(SkLayerRasterizer* rast, SkPaint& p) |
+static void r1(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) |
{ |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
p.setAlpha(0x40); |
p.setXfermodeMode(SkXfermode::kSrc_Mode); |
p.setStyle(SkPaint::kStroke_Style); |
p.setStrokeWidth(SK_Scalar1*2); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
} |
-static void r2(SkLayerRasterizer* rast, SkPaint& p) |
+static void r2(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) |
{ |
p.setStyle(SkPaint::kStrokeAndFill_Style); |
p.setStrokeWidth(SK_Scalar1*4); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
p.setStyle(SkPaint::kStroke_Style); |
p.setStrokeWidth(SK_Scalar1*3/2); |
p.setXfermodeMode(SkXfermode::kClear_Mode); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
} |
-static void r3(SkLayerRasterizer* rast, SkPaint& p) |
+static void r3(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) |
{ |
p.setStyle(SkPaint::kStroke_Style); |
p.setStrokeWidth(SK_Scalar1*3); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
p.setAlpha(0x20); |
p.setStyle(SkPaint::kFill_Style); |
p.setXfermodeMode(SkXfermode::kSrc_Mode); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
} |
-static void r4(SkLayerRasterizer* rast, SkPaint& p) |
+static void r4(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) |
{ |
p.setAlpha(0x60); |
- rast->addLayer(p, SkIntToScalar(3), SkIntToScalar(3)); |
+ rastBuilder->addLayer(p, SkIntToScalar(3), SkIntToScalar(3)); |
p.setAlpha(0xFF); |
p.setXfermodeMode(SkXfermode::kClear_Mode); |
- rast->addLayer(p, SK_Scalar1*3/2, SK_Scalar1*3/2); |
+ rastBuilder->addLayer(p, SK_Scalar1*3/2, SK_Scalar1*3/2); |
p.setXfermode(NULL); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
} |
#include "SkDiscretePathEffect.h" |
-static void r5(SkLayerRasterizer* rast, SkPaint& p) |
+static void r5(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) |
{ |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
p.setPathEffect(SkDiscretePathEffect::Create(SK_Scalar1*4, SK_Scalar1*3))->unref(); |
p.setXfermodeMode(SkXfermode::kSrcOut_Mode); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
} |
-static void r6(SkLayerRasterizer* rast, SkPaint& p) |
+static void r6(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) |
{ |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
p.setAntiAlias(false); |
- SkLayerRasterizer* rast2 = new SkLayerRasterizer; |
- r5(rast2, p); |
- p.setRasterizer(rast2)->unref(); |
+ SkLayerRasterizer::Builder rastBuilder2; |
+ r5(&rastBuilder2, p); |
+ p.setRasterizer(rastBuilder2.detachRasterizer())->unref(); |
p.setXfermodeMode(SkXfermode::kClear_Mode); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
} |
#include "Sk2DPathEffect.h" |
@@ -572,52 +572,52 @@ static SkPathEffect* MakeDotEffect(SkScalar radius, const SkMatrix& matrix) { |
return SkPath2DPathEffect::Create(matrix, path); |
} |
-static void r7(SkLayerRasterizer* rast, SkPaint& p) |
+static void r7(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) |
{ |
SkMatrix lattice; |
lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0); |
lattice.postSkew(SK_Scalar1/3, 0, 0, 0); |
p.setPathEffect(MakeDotEffect(SK_Scalar1*4, lattice))->unref(); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
} |
-static void r8(SkLayerRasterizer* rast, SkPaint& p) |
+static void r8(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) |
{ |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
SkMatrix lattice; |
lattice.setScale(SK_Scalar1*6, SK_Scalar1*6, 0, 0); |
lattice.postSkew(SK_Scalar1/3, 0, 0, 0); |
p.setPathEffect(MakeDotEffect(SK_Scalar1*2, lattice))->unref(); |
p.setXfermodeMode(SkXfermode::kClear_Mode); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
p.setPathEffect(NULL); |
p.setXfermode(NULL); |
p.setStyle(SkPaint::kStroke_Style); |
p.setStrokeWidth(SK_Scalar1); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
} |
-static void r9(SkLayerRasterizer* rast, SkPaint& p) |
+static void r9(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p) |
{ |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
SkMatrix lattice; |
lattice.setScale(SK_Scalar1, SK_Scalar1*6, 0, 0); |
lattice.postRotate(SkIntToScalar(30), 0, 0); |
p.setPathEffect(SkLine2DPathEffect::Create(SK_Scalar1*2, lattice))->unref(); |
p.setXfermodeMode(SkXfermode::kClear_Mode); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
p.setPathEffect(NULL); |
p.setXfermode(NULL); |
p.setStyle(SkPaint::kStroke_Style); |
p.setStrokeWidth(SK_Scalar1); |
- rast->addLayer(p); |
+ rastBuilder->addLayer(p); |
} |
-typedef void (*raster_proc)(SkLayerRasterizer*, SkPaint&); |
+typedef void (*raster_proc)(SkLayerRasterizer::Builder*, SkPaint&); |
static const raster_proc gRastProcs[] = { |
r0, r1, r2, r3, r4, r5, r6, r7, r8, r9 |
@@ -626,11 +626,11 @@ static const raster_proc gRastProcs[] = { |
static void apply_shader(SkPaint* paint, int index) { |
raster_proc proc = gRastProcs[index]; |
SkPaint p; |
- SkLayerRasterizer* rast = new SkLayerRasterizer; |
+ SkLayerRasterizer::Builder rastBuilder; |
p.setAntiAlias(true); |
- proc(rast, p); |
- paint->setRasterizer(rast)->unref(); |
+ proc(&rastBuilder, p); |
+ paint->setRasterizer(rastBuilder.detachRasterizer())->unref(); |
paint->setColor(SK_ColorBLUE); |
} |