aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/device/xps
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-05 18:57:53 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-05 18:57:53 +0000
commitd998cbdbb73ac11b10081a640e0a7975ac05262c (patch)
tree4c89d375cc9960180901802ab1fb8b568baa53b5 /src/device/xps
parentb0a7ace7cb2a7559bbc254a7c93698bc71bbd245 (diff)
XPS filter and rasterize hairlines.
Diffstat (limited to 'src/device/xps')
-rw-r--r--src/device/xps/SkXPSDevice.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp
index 0bf9ca705d..1896fef2f2 100644
--- a/src/device/xps/SkXPSDevice.cpp
+++ b/src/device/xps/SkXPSDevice.cpp
@@ -1671,7 +1671,7 @@ void SkXPSDevice::drawPath(const SkDraw& d,
}
}
- SkTLazy<SkPaint> modifiedPaint;
+ SkTLazy<SkPaint> lazyShaderPaint;
SkPaint* shaderPaint = const_cast<SkPaint*>(&paint);
//Apply path effect [Skeletal-path -> Fillable-path].
@@ -1683,7 +1683,7 @@ void SkXPSDevice::drawPath(const SkDraw& d,
}
bool fill = paint.getFillPath(*skeletalPath, fillablePath);
- shaderPaint = modifiedPaint.set(paint);
+ shaderPaint = lazyShaderPaint.set(*shaderPaint);
shaderPaint->setPathEffect(NULL);
if (fill) {
shaderPaint->setStyle(SkPaint::kFill_Style);
@@ -1707,6 +1707,25 @@ void SkXPSDevice::drawPath(const SkDraw& d,
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;
@@ -1716,10 +1735,8 @@ void SkXPSDevice::drawPath(const SkDraw& d,
&fill,
&stroke));
- SkMaskFilter* filter = paint.getMaskFilter();
-
//Rasterizer
- if (paint.getRasterizer()) {
+ if (rasterizer) {
SkIRect clipIRect;
SkVector ppuScale;
this->convertToPpm(filter,
@@ -1732,7 +1749,7 @@ void SkXPSDevice::drawPath(const SkDraw& d,
//[Fillable-path -> Mask]
SkMask rasteredMask;
- if (paint.getRasterizer()->rasterize(
+ if (rasterizer->rasterize(
*fillablePath,
matrix,
&clipIRect,
@@ -1785,7 +1802,7 @@ void SkXPSDevice::drawPath(const SkDraw& d,
&matrix,
&rasteredMask,
SkMask::kComputeBoundsAndRenderImage_CreateMode,
- shaderPaint->getStyle())) {
+ rasterizePaint->getStyle())) {
SkAutoMaskFreeImage rasteredAmi(rasteredMask.fImage);
mask = &rasteredMask;