aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-08 18:02:53 +0000
committerGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-08 18:02:53 +0000
commita8e33a92e27ca1523601226cad83c79a7e00c93b (patch)
treedc9418e3ba5b6876a2f1a8bb603665c2dc540999 /include
parent1510726d6044119fab42a887d46ba922b890531d (diff)
Add ability to ninepatch blurred rounded rectangle
Speed up drawing large blurry round rectangles by converting them to nine patches. SkDraw: Add drawRRect. SkBitmapDevice: Call SkDraw::drawRRect instead of converting SkRRect to an SkPath. SkMaskFilter/SkBlurMaskFilter: Create a nine patch of a blurred round rect and draw it instead of drawing the entire thing. SkPDFDevice: Override drawRRect to perform the old behavior in SkBitmapDevice::drawRect. Depends on https://codereview.chromium.org/52703003 Tests are in https://codereview.chromium.org/52793005 BUG=https://b.corp.google.com/issue?id=11174385 R=reed@google.com, robertphillips@google.com Review URL: https://codereview.chromium.org/48623006 git-svn-id: http://skia.googlecode.com/svn/trunk@12198 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkDraw.h2
-rw-r--r--include/core/SkMaskFilter.h15
-rw-r--r--include/pdf/SkPDFDevice.h3
3 files changed, 20 insertions, 0 deletions
diff --git a/include/core/SkDraw.h b/include/core/SkDraw.h
index 9183094679..f7ae1c6208 100644
--- a/include/core/SkDraw.h
+++ b/include/core/SkDraw.h
@@ -24,6 +24,7 @@ class SkRegion;
class SkRasterClip;
struct SkDrawProcs;
struct SkRect;
+class SkRRect;
class SkDraw {
public:
@@ -34,6 +35,7 @@ public:
void drawPoints(SkCanvas::PointMode, size_t count, const SkPoint[],
const SkPaint&, bool forceUseDevice = false) const;
void drawRect(const SkRect&, const SkPaint&) const;
+ void drawRRect(const SkRRect&, const SkPaint&) const;
/**
* To save on mallocs, we allow a flag that tells us that srcPath is
* mutable, so that we don't have to make copies of it as we transform it.
diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h
index 93e2d4bc33..f4448ddddb 100644
--- a/include/core/SkMaskFilter.h
+++ b/include/core/SkMaskFilter.h
@@ -21,6 +21,7 @@ class SkBounder;
class SkMatrix;
class SkPath;
class SkRasterClip;
+class SkRRect;
/** \class SkMaskFilter
@@ -162,6 +163,12 @@ protected:
const SkMatrix&,
const SkIRect& clipBounds,
NinePatch*) const;
+ /**
+ * Similar to filterRectsToNine, except it performs the work on a round rect.
+ */
+ virtual FilterReturn filterRRectToNine(const SkRRect&, const SkMatrix&,
+ const SkIRect& clipBounds,
+ NinePatch*) const;
private:
friend class SkDraw;
@@ -175,6 +182,14 @@ private:
const SkRasterClip&, SkBounder*, SkBlitter* blitter,
SkPaint::Style style) const;
+ /** Helper method that, given a roundRect in device space, will rasterize it into a kA8_Format
+ mask and then call filterMask(). If this returns true, the specified blitter will be called
+ to render that mask. Returns false if filterMask() returned false.
+ */
+ bool filterRRect(const SkRRect& devRRect, const SkMatrix& devMatrix,
+ const SkRasterClip&, SkBounder*, SkBlitter* blitter,
+ SkPaint::Style style) const;
+
typedef SkFlattenable INHERITED;
};
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index d8e1aa283f..8e1f41823f 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -33,6 +33,7 @@ class SkPDFObject;
class SkPDFResourceDict;
class SkPDFShader;
class SkPDFStream;
+class SkRRect;
template <typename T> class SkTSet;
// Private classes.
@@ -83,6 +84,8 @@ public:
size_t count, const SkPoint[],
const SkPaint& paint) SK_OVERRIDE;
virtual void drawRect(const SkDraw&, const SkRect& r, const SkPaint& paint);
+ virtual void drawRRect(const SkDraw&, const SkRRect& rr,
+ const SkPaint& paint) SK_OVERRIDE;
virtual void drawPath(const SkDraw&, const SkPath& origpath,
const SkPaint& paint, const SkMatrix* prePathMatrix,
bool pathIsMutable) SK_OVERRIDE;