Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 1012143005: Simple patch to have draw path call an internal drawPath (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index a3d2cc3db1b9c6e212e55b2c0c21fb33b745c371..a97e42ece0d12072ff7056e7f8fd2bd3120ed62f 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -639,18 +639,22 @@ bool draw_mask(GrContext* context,
return true;
}
+static bool clip_bounds_quick_reject(const SkIRect& clipBounds, const SkIRect& rect) {
+ return clipBounds.isEmpty() || rect.isEmpty() || !SkIRect::Intersects(clipBounds, rect);
+}
+
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;
}
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698