aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRecordDraw.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-08-25 13:54:30 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-25 13:54:30 -0700
commit44df651ebefc284acc2f66425dff3ea0b0e14b36 (patch)
tree324bcf1b278ed44e168f0a6c548fd9a194014b6c /src/core/SkRecordDraw.cpp
parent4d866dfc46bc381da1761d05ce8b5a3bb0cd7f00 (diff)
Add drawRegion() API to SkCanvas
This will allow us to optimize for the RectGrid macrobench. Currently, SkiaGL is much slower than OpenGL. SkiaGL 12 items/s OpenGL 160 items/s This contains everything except for the fast implementation on GPU. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2277053002 Review-Url: https://codereview.chromium.org/2277053002
Diffstat (limited to 'src/core/SkRecordDraw.cpp')
-rw-r--r--src/core/SkRecordDraw.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 5b4bc6af6c..6545586499 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -128,6 +128,7 @@ DRAW(DrawPosText, drawPosText(r.text, r.byteLength, r.pos, r.paint));
DRAW(DrawPosTextH, drawPosTextH(r.text, r.byteLength, r.xpos, r.y, r.paint));
DRAW(DrawRRect, drawRRect(r.rrect, r.paint));
DRAW(DrawRect, drawRect(r.rect, r.paint));
+DRAW(DrawRegion, drawRegion(r.region, r.paint));
DRAW(DrawText, drawText(r.text, r.byteLength, r.x, r.y, r.paint));
DRAW(DrawTextBlob, drawTextBlob(r.blob.get(), r.x, r.y, r.paint));
DRAW(DrawTextOnPath, drawTextOnPath(r.text, r.byteLength, r.path, &r.matrix, r.paint));
@@ -413,6 +414,10 @@ private:
Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOps don't draw.
Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect, &op.paint); }
+ Bounds bounds(const DrawRegion& op) const {
+ SkRect rect = SkRect::Make(op.region.getBounds());
+ return this->adjustAndMap(rect, &op.paint);
+ }
Bounds bounds(const DrawOval& op) const { return this->adjustAndMap(op.oval, &op.paint); }
// Tighter arc bounds?
Bounds bounds(const DrawArc& op) const { return this->adjustAndMap(op.oval, &op.paint); }