Chromium Code Reviews| Index: src/gpu/SkGpuDevice.cpp |
| diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp |
| index a3d2cc3db1b9c6e212e55b2c0c21fb33b745c371..cc8a3c188725b984ac1f0261ef7e21bd073d1497 100644 |
| --- a/src/gpu/SkGpuDevice.cpp |
| +++ b/src/gpu/SkGpuDevice.cpp |
| @@ -639,18 +639,22 @@ bool draw_mask(GrContext* context, |
| return true; |
| } |
|
robertphillips
2015/03/18 18:09:41
pass 'rect' by reference ?
|
| +static bool clip_bounds_quick_reject(const SkIRect& clipBounds, const SkIRect rect) { |
| + return clipBounds.isEmpty() || !SkIRect::Intersects(clipBounds, rect); |
|
jvanverth1
2015/03/18 18:10:07
Need to check if second argument "rect" is empty h
|
| +} |
| + |
| bool draw_with_mask_filter(GrContext* context, |
| GrRenderTarget* rt, |
| const GrClip& clipData, |
| const SkMatrix& viewMatrix, |
| const SkPath& devPath, |
| SkMaskFilter* filter, |
| - const SkRegion& clip, |
| + const SkIRect& clipBounds, |
| GrPaint* grp, |
| SkPaint::Style style) { |
| SkMask srcM, dstM; |
| - if (!SkDraw::DrawToMask(devPath, &clip.getBounds(), filter, &viewMatrix, &srcM, |
| + if (!SkDraw::DrawToMask(devPath, &clipBounds, filter, &viewMatrix, &srcM, |
| SkMask::kComputeBoundsAndRenderImage_CreateMode, style)) { |
| return false; |
| } |
| @@ -662,7 +666,7 @@ bool draw_with_mask_filter(GrContext* context, |
| // this will free-up dstM when we're done (allocated in filterMask()) |
| SkAutoMaskFreeImage autoDst(dstM.fImage); |
| - if (clip.quickReject(dstM.fBounds)) { |
| + if (clip_bounds_quick_reject(clipBounds, dstM.fBounds)) { |
| return false; |
| } |
| @@ -747,6 +751,13 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, |
| CHECK_SHOULD_DRAW(draw); |
| GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPath", fContext); |
| + return this->internalDrawPath(origSrcPath, paint, *draw.fMatrix, prePathMatrix, |
| + draw.fClip->getBounds(), pathIsMutable); |
| +} |
| + |
| +void SkGpuDevice::internalDrawPath(const SkPath& origSrcPath, const SkPaint& paint, |
| + const SkMatrix& origViewMatrix, const SkMatrix* prePathMatrix, |
| + const SkIRect& clipBounds, bool pathIsMutable) { |
| SkASSERT(!pathIsMutable || origSrcPath.isVolatile()); |
| GrStrokeInfo strokeInfo(paint); |
| @@ -759,7 +770,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, |
| SkTLazy<SkPath> effectPath; |
| SkPathEffect* pathEffect = paint.getPathEffect(); |
| - SkMatrix viewMatrix = *draw.fMatrix; |
| + SkMatrix viewMatrix = origViewMatrix; |
| if (prePathMatrix) { |
| // stroking and path effects are supposed to be applied *after* the prePathMatrix. |
| @@ -819,12 +830,12 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, |
| SkRect maskRect; |
| if (paint.getMaskFilter()->canFilterMaskGPU(devPathPtr->getBounds(), |
| - draw.fClip->getBounds(), |
| + clipBounds, |
| viewMatrix, |
| &maskRect)) { |
| SkIRect finalIRect; |
| maskRect.roundOut(&finalIRect); |
| - if (draw.fClip->quickReject(finalIRect)) { |
| + if (clip_bounds_quick_reject(clipBounds, finalIRect)) { |
| // clipped out |
| return; |
| } |
| @@ -874,7 +885,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, |
| SkPaint::Style style = stroke.isHairlineStyle() ? SkPaint::kStroke_Style : |
| SkPaint::kFill_Style; |
| draw_with_mask_filter(fContext, fRenderTarget, fClip, viewMatrix, *devPathPtr, |
| - paint.getMaskFilter(), *draw.fClip, &grPaint, style); |
| + paint.getMaskFilter(), clipBounds, &grPaint, style); |
| return; |
| } |