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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 193193002: plumbing for GPU fast blur (Closed) Base URL: https://skia.googlesource.com/skia.git@fast_rrect_blur_cpu_plumb
Patch Set: fix indentation issue Created 6 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/effects/SkBlurMaskFilter.cpp ('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 7cecf25bb2d834ce60976e37f280f13ceb5a86c3..82862414fc682968f7b164007a65ad5bb93c25fc 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -19,11 +19,13 @@
#include "SkGrTexturePixelRef.h"
+#include "SkBounder.h"
#include "SkColorFilter.h"
#include "SkDeviceImageFilterProxy.h"
#include "SkDrawProcs.h"
#include "SkGlyphCache.h"
#include "SkImageFilter.h"
+#include "SkMaskFilter.h"
#include "SkPathEffect.h"
#include "SkRRect.h"
#include "SkStroke.h"
@@ -739,6 +741,44 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
CHECK_FOR_ANNOTATION(paint);
CHECK_SHOULD_DRAW(draw, false);
+ GrPaint grPaint;
+ if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
+ return;
+ }
+
+ SkStrokeRec stroke(paint);
+ if (paint.getMaskFilter()) {
+ // try to hit the fast path for drawing filtered round rects
+
+ SkRRect devRRect;
+ if (rect.transform(fContext->getMatrix(), &devRRect)) {
+ if (devRRect.allCornersCircular()) {
+ SkRect maskRect;
+ if (paint.getMaskFilter()->canFilterMaskGPU(devRRect.rect(),
+ draw.fClip->getBounds(),
+ fContext->getMatrix(),
+ &maskRect)) {
+ SkIRect finalIRect;
+ maskRect.roundOut(&finalIRect);
+ if (draw.fClip->quickReject(finalIRect)) {
+ // clipped out
+ return;
+ }
+ if (NULL != draw.fBounder && !draw.fBounder->doIRect(finalIRect)) {
+ // nothing to draw
+ return;
+ }
+ if (paint.getMaskFilter()->directFilterRRectMaskGPU(fContext, &grPaint,
+ stroke, devRRect)) {
+ return;
+ }
+ }
+
+ }
+ }
+
+ }
+
bool usePath = !rect.isSimple();
// another two reasons we might need to call drawPath...
if (paint.getMaskFilter() || paint.getPathEffect()) {
@@ -756,16 +796,10 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
return;
}
- GrPaint grPaint;
- if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
- return;
- }
-
- SkStrokeRec stroke(paint);
fContext->drawRRect(grPaint, rect, stroke);
}
-///////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval,
const SkPaint& paint) {
@@ -1011,7 +1045,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
}
if (paint.getMaskFilter()->directFilterMaskGPU(fContext, &grPaint,
- SkStrokeRec(paint), *devPathPtr)) {
+ stroke, *devPathPtr)) {
// the mask filter was able to draw itself directly, so there's nothing
// left to do.
return;
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698