}
}
- SkTLazy<SkPaint> modifiedPaint;
+ SkTLazy<SkPaint> lazyShaderPaint;
SkPaint* shaderPaint = const_cast<SkPaint*>(&paint);
//Apply path effect [Skeletal-path -> Fillable-path].
}
bool fill = paint.getFillPath(*skeletalPath, fillablePath);
- shaderPaint = modifiedPaint.set(paint);
+ shaderPaint = lazyShaderPaint.set(*shaderPaint);
shaderPaint->setPathEffect(NULL);
if (fill) {
shaderPaint->setStyle(SkPaint::kFill_Style);
HRVM(shadedPath->SetGeometryLocal(shadedGeometry.get()),
"Could not add the shaded geometry to shaded path.");
+ SkRasterizer* rasterizer = paint.getRasterizer();
+ SkMaskFilter* filter = paint.getMaskFilter();
+
+ SkTLazy<SkPaint> lazyRasterizePaint;
+ const SkPaint* rasterizePaint = shaderPaint;
+
+ //Determine if we will draw or shade and mask.
+ if (rasterizer || filter) {
+ if (shaderPaint->getStyle() != SkPaint::kFill_Style) {
+ if (lazyShaderPaint.isValid()) {
+ rasterizePaint = lazyRasterizePaint.set(*shaderPaint);
+ } else {
+ rasterizePaint = shaderPaint;
+ shaderPaint = lazyShaderPaint.set(*shaderPaint);
+ }
+ shaderPaint->setStyle(SkPaint::kFill_Style);
+ }
+ }
+
//Set the brushes.
BOOL fill;
BOOL stroke;
&fill,
&stroke));
- SkMaskFilter* filter = paint.getMaskFilter();
-
//Rasterizer
- if (paint.getRasterizer()) {
+ if (rasterizer) {
SkIRect clipIRect;
SkVector ppuScale;
this->convertToPpm(filter,
//[Fillable-path -> Mask]
SkMask rasteredMask;
- if (paint.getRasterizer()->rasterize(
+ if (rasterizer->rasterize(
*fillablePath,
matrix,
&clipIRect,
&matrix,
&rasteredMask,
SkMask::kComputeBoundsAndRenderImage_CreateMode,
- shaderPaint->getStyle())) {
+ rasterizePaint->getStyle())) {
SkAutoMaskFreeImage rasteredAmi(rasteredMask.fImage);
mask = &rasteredMask;