diff options
author | msarett <msarett@google.com> | 2016-08-25 13:54:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-25 13:54:30 -0700 |
commit | 44df651ebefc284acc2f66425dff3ea0b0e14b36 (patch) | |
tree | 324bcf1b278ed44e168f0a6c548fd9a194014b6c /src/core/SkLiteDL.cpp | |
parent | 4d866dfc46bc381da1761d05ce8b5a3bb0cd7f00 (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/SkLiteDL.cpp')
-rw-r--r-- | src/core/SkLiteDL.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/SkLiteDL.cpp b/src/core/SkLiteDL.cpp index d94e1399d6..af4f5c2dbd 100644 --- a/src/core/SkLiteDL.cpp +++ b/src/core/SkLiteDL.cpp @@ -54,8 +54,8 @@ namespace { M(Save) M(Restore) M(SaveLayer) \ M(Concat) M(SetMatrix) M(Translate) M(TranslateZ) \ M(ClipPath) M(ClipRect) M(ClipRRect) M(ClipRegion) \ - M(DrawPaint) M(DrawPath) M(DrawRect) M(DrawOval) M(DrawArc) M(DrawRRect) \ - M(DrawDRRect) M(DrawAnnotation) M(DrawDrawable) M(DrawPicture) \ + M(DrawPaint) M(DrawPath) M(DrawRect) M(DrawRegion) M(DrawOval) M(DrawArc) \ + M(DrawRRect) M(DrawDRRect) M(DrawAnnotation) M(DrawDrawable) M(DrawPicture) \ M(DrawShadowedPicture) \ M(DrawImage) M(DrawImageNine) M(DrawImageRect) M(DrawImageLattice) \ M(DrawText) M(DrawPosText) M(DrawPosTextH) \ @@ -189,6 +189,13 @@ namespace { SkPaint paint; void draw(SkCanvas* c, const SkMatrix&) { c->drawRect(rect, paint); } }; + struct DrawRegion final : Op { + static const auto kType = Type::DrawRegion; + DrawRegion(const SkRegion& region, const SkPaint& paint) : region(region), paint(paint) {} + SkRegion region; + SkPaint paint; + void draw(SkCanvas* c, const SkMatrix&) { c->drawRegion(region, paint); } + }; struct DrawOval final : Op { static const auto kType = Type::DrawOval; DrawOval(const SkRect& oval, const SkPaint& paint) : oval(oval), paint(paint) {} @@ -592,6 +599,9 @@ void SkLiteDL::drawPath(const SkPath& path, const SkPaint& paint) { void SkLiteDL::drawRect(const SkRect& rect, const SkPaint& paint) { this->push<DrawRect>(0, rect, paint); } +void SkLiteDL::drawRegion(const SkRegion& region, const SkPaint& paint) { + this->push<DrawRegion>(0, region, paint); +} void SkLiteDL::drawOval(const SkRect& oval, const SkPaint& paint) { this->push<DrawOval>(0, oval, paint); } |