Defer drawOval to SkDraw
- this bottlenecks ovals (along with rects/rrects) in SkDraw
- ... where we have the opportunity to use RawShapes in the future
- also must makes the code read more in-parallel with other shapes
Change-Id: Ic9eaf3ac4e5ed07f12a489d53bf1f33ff84378a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1027476
Reviewed-by: Florin Malita <fmalita@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Mike Reed <mike@reedtribe.org>
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index f2d0e24..1881c28 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -370,7 +370,7 @@
}
void SkBitmapDevice::drawOval(const SkRect& oval, const SkPaint& paint) {
- this->drawPath(SkPath::Oval(oval), paint, true);
+ LOOP_TILER( drawOval(oval, paint), Bounder(oval, paint))
}
void SkBitmapDevice::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
diff --git a/src/core/SkDrawBase.cpp b/src/core/SkDrawBase.cpp
index 4914def..2cbd44d 100644
--- a/src/core/SkDrawBase.cpp
+++ b/src/core/SkDrawBase.cpp
@@ -279,6 +279,16 @@
return false;
}
+void SkDrawBase::drawOval(const SkRect& oval, const SkPaint& paint) const {
+ SkDEBUGCODE(this->validate());
+
+ if (fRC->isEmpty()) {
+ return;
+ }
+
+ this->drawPath(SkPath::Oval(oval), paint, nullptr, true);
+}
+
void SkDrawBase::drawRRect(const SkRRect& rrect, const SkPaint& paint) const {
SkDEBUGCODE(this->validate());
diff --git a/src/core/SkDrawBase.h b/src/core/SkDrawBase.h
index fe536dd..5964735 100644
--- a/src/core/SkDrawBase.h
+++ b/src/core/SkDrawBase.h
@@ -49,6 +49,7 @@
void drawRect(const SkRect& rect, const SkPaint& paint) const {
this->drawRect(rect, paint, nullptr, nullptr);
}
+ void drawOval(const SkRect&, const SkPaint&) const;
void drawRRect(const SkRRect&, const SkPaint&) const;
// Specialized draw for RRect that only draws if it is nine-patchable.
bool drawRRectNinePatch(const SkRRect&, const SkPaint&) const;