Index: src/core/SkDraw.cpp |
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp |
index df73f7ae3795829c09e40349a8671d805dd19d6c..05348235f4dacfb2b94dcb69f6f5ec33a59f812a 100644 |
--- a/src/core/SkDraw.cpp |
+++ b/src/core/SkDraw.cpp |
@@ -18,6 +18,7 @@ |
#include "SkPathEffect.h" |
#include "SkRasterClip.h" |
#include "SkRasterizer.h" |
+#include "SkRRect.h" |
#include "SkScan.h" |
#include "SkShader.h" |
#include "SkString.h" |
@@ -1022,6 +1023,51 @@ bool SkDrawTreatAsHairline(const SkPaint& paint, const SkMatrix& matrix, |
return false; |
} |
+void SkDraw::drawRRect(const SkRRect& rrect, const SkPaint& paint) const { |
+ SkDEBUGCODE(this->validate()); |
+ |
+ if (fRC->isEmpty()) { |
+ return; |
+ } |
+ |
+ { |
+ // TODO: Investigate optimizing these options. They are in the same |
+ // order as SkDraw::drawPath, which handles each case. It may be |
+ // that there is no way to optimize for these using the SkRRect path. |
+ SkScalar coverage; |
+ if (SkDrawTreatAsHairline(paint, *fMatrix, &coverage)) { |
+ goto DRAW_PATH; |
+ } |
+ |
+ if (paint.getPathEffect() || paint.getStyle() != SkPaint::kFill_Style) { |
+ goto DRAW_PATH; |
+ } |
+ |
+ if (paint.getRasterizer()) { |
+ goto DRAW_PATH; |
+ } |
+ } |
+ |
+ if (paint.getMaskFilter()) { |
+ // Transform the rrect into device space. |
+ SkRRect devRRect; |
+ if (rrect.transform(*fMatrix, &devRRect)) { |
+ SkAutoBlitterChoose blitter(*fBitmap, *fMatrix, paint); |
+ if (paint.getMaskFilter()->filterRRect(devRRect, *fMatrix, *fRC, |
+ fBounder, blitter.get(), |
+ SkPaint::kFill_Style)) { |
+ return; // filterRRect() called the blitter, so we're done |
+ } |
+ } |
+ } |
+ |
+DRAW_PATH: |
+ // Now fall back to the default case of using a path. |
+ SkPath path; |
+ path.addRRect(rrect); |
+ this->drawPath(path, paint, NULL, true); |
+} |
+ |
void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint, |
const SkMatrix* prePathMatrix, bool pathIsMutable) const { |
SkDEBUGCODE(this->validate();) |