aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-08-25 18:07:18 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-25 18:07:18 -0700
commitcc319b95a58ae15e88c3c028b8726e7cab9121ff (patch)
tree1881927ff1f29c854e429be5f096eded2731c848 /include
parent7d6fb2c92d096ac3630e23d561a4077a974a815c (diff)
GPU implementation of drawRegion()
Nexus 6P drawregion Bench Performance Before 48.0ms After 3.57ms BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2267273006 Review-Url: https://codereview.chromium.org/2267273006
Diffstat (limited to 'include')
-rw-r--r--include/core/SkCanvas.h4
-rw-r--r--include/gpu/GrDrawContext.h16
2 files changed, 19 insertions, 1 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 780af107af..d9b3282d3e 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -708,6 +708,10 @@ public:
@param paint The paint used to draw the region
*/
void drawRegion(const SkRegion& region, const SkPaint& paint) {
+ if (region.isEmpty()) {
+ return;
+ }
+
this->onDrawRegion(region, paint);
}
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h
index 993bb56f9e..29c7d1c12e 100644
--- a/include/gpu/GrDrawContext.h
+++ b/include/gpu/GrDrawContext.h
@@ -216,7 +216,21 @@ public:
const SkRSXform xform[],
const SkRect texRect[],
const SkColor colors[]);
-
+
+ /**
+ * Draws a region.
+ *
+ * @param paint describes how to color pixels
+ * @param viewMatrix transformation matrix
+ * @param region the region to be drawn
+ * @param style style to apply to the region
+ */
+ void drawRegion(const GrClip&,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRegion& region,
+ const GrStyle& style);
+
/**
* Draws an oval.
*