aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-04 21:01:08 +0000
committerGravatar junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-04 21:01:08 +0000
commitaad7e2781de16e081833fcd896a02f6a9c89ca73 (patch)
treefd2f6a62daf1c01e23d6dcf60b5524b46539f1ec
parentcf3c7febb3b87a39f4f98414346ca61d43cd7243 (diff)
Fixing blurred shadows of hairline paths when rendered on the GPU
-rw-r--r--src/gpu/SkGpuDevice.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 750a4aa80f..437efbdc9b 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -750,7 +750,7 @@ inline bool shouldDrawBlurWithCPU(const SkRect& rect, SkScalar radius) {
bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path,
SkMaskFilter* filter, const SkMatrix& matrix,
const SkRegion& clip, SkBounder* bounder,
- GrPaint* grp) {
+ GrPaint* grp, GrPathFill pathFillType) {
#ifdef SK_DISABLE_GPU_BLUR
return false;
#endif
@@ -830,7 +830,7 @@ bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path,
tempPaint.fDstBlendCoeff = kISC_BlendCoeff;
}
// Draw hard shadow to pathTexture with path topleft at origin 0,0.
- context->drawPath(tempPaint, path, skToGrFillType(path.getFillType()), &offset);
+ context->drawPath(tempPaint, path, pathFillType, &offset);
GrAutoScratchTexture temp1, temp2;
// If we're doing a normal blur, we can clobber the pathTexture in the
@@ -895,12 +895,12 @@ bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path,
bool drawWithMaskFilter(GrContext* context, const SkPath& path,
SkMaskFilter* filter, const SkMatrix& matrix,
const SkRegion& clip, SkBounder* bounder,
- GrPaint* grp) {
+ GrPaint* grp, SkPaint::Style style) {
SkMask srcM, dstM;
if (!SkDraw::DrawToMask(path, &clip.getBounds(), filter, &matrix, &srcM,
SkMask::kComputeBoundsAndRenderImage_CreateMode,
- SkPaint::kFill_Style)) {
+ style)) {
return false;
}
SkAutoMaskFreeImage autoSrc(srcM.fImage);
@@ -1034,12 +1034,16 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
// transform the path into device space
pathPtr->transform(*draw.fMatrix, devPathPtr);
+ GrPathFill pathFillType = doFill ?
+ skToGrFillType(devPathPtr->getFillType()) : kHairLine_PathFill;
if (!drawWithGPUMaskFilter(fContext, *devPathPtr, paint.getMaskFilter(),
*draw.fMatrix, *draw.fClip, draw.fBounder,
- &grPaint)) {
+ &grPaint, pathFillType)) {
+ SkPaint::Style style = doFill ? SkPaint::kFill_Style :
+ SkPaint::kStroke_Style;
drawWithMaskFilter(fContext, *devPathPtr, paint.getMaskFilter(),
*draw.fMatrix, *draw.fClip, draw.fBounder,
- &grPaint);
+ &grPaint, style);
}
return;
}