revert 6766, thereby re-landing 6762-6763 now that the bots are ready
git-svn-id: http://skia.googlecode.com/svn/trunk@6770 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 34310c8..3efdd22 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -17,6 +17,7 @@
#include "SkMetaData.h"
#include "SkPicture.h"
#include "SkRasterClip.h"
+#include "SkRRect.h"
#include "SkScalarCompare.h"
#include "SkSurface_Base.h"
#include "SkTemplates.h"
@@ -1125,6 +1126,18 @@
}
}
+bool SkCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+ if (rrect.isRect()) {
+ // call the non-virtual version
+ return this->SkCanvas::clipRect(rrect.getBounds(), op, doAA);
+ } else {
+ SkPath path;
+ path.addRRect(rrect);
+ // call the non-virtual version
+ return this->SkCanvas::clipPath(path, op, doAA);
+ }
+}
+
bool SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
#ifdef SK_ENABLE_CLIP_QUICKREJECT
if (SkRegion::kIntersect_Op == op && !path.isInverseFillType()) {
@@ -1466,6 +1479,40 @@
LOOPER_END
}
+void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) {
+ if (paint.canComputeFastBounds()) {
+ SkRect storage;
+ if (this->quickReject(paint.computeFastBounds(oval, &storage))) {
+ return;
+ }
+ }
+
+ SkPath path;
+ path.addOval(oval);
+ // call the non-virtual version
+ this->SkCanvas::drawPath(path, paint);
+}
+
+void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+ if (paint.canComputeFastBounds()) {
+ SkRect storage;
+ if (this->quickReject(paint.computeFastBounds(rrect.getBounds(), &storage))) {
+ return;
+ }
+ }
+
+ if (rrect.isRect()) {
+ // call the non-virtual version
+ this->SkCanvas::drawRect(rrect.getBounds(), paint);
+ } else {
+ SkPath path;
+ path.addRRect(rrect);
+ // call the non-virtual version
+ this->SkCanvas::drawPath(path, paint);
+ }
+}
+
+
void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
if (!path.isFinite()) {
return;
@@ -1898,17 +1945,7 @@
SkRect r;
r.set(cx - radius, cy - radius, cx + radius, cy + radius);
-
- if (paint.canComputeFastBounds()) {
- SkRect storage;
- if (this->quickReject(paint.computeFastBounds(r, &storage))) {
- return;
- }
- }
-
- SkPath path;
- path.addOval(r);
- this->drawPath(path, paint);
+ this->drawOval(r, paint);
}
void SkCanvas::drawRoundRect(const SkRect& r, SkScalar rx, SkScalar ry,
@@ -1920,28 +1957,14 @@
return;
}
}
-
- SkPath path;
- path.addRoundRect(r, rx, ry, SkPath::kCW_Direction);
- this->drawPath(path, paint);
+ SkRRect rrect;
+ rrect.setRectXY(r, rx, ry);
+ this->drawRRect(rrect, paint);
} else {
this->drawRect(r, paint);
}
}
-void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) {
- if (paint.canComputeFastBounds()) {
- SkRect storage;
- if (this->quickReject(paint.computeFastBounds(oval, &storage))) {
- return;
- }
- }
-
- SkPath path;
- path.addOval(oval);
- this->drawPath(path, paint);
-}
-
void SkCanvas::drawArc(const SkRect& oval, SkScalar startAngle,
SkScalar sweepAngle, bool useCenter,
const SkPaint& paint) {