Index: src/gpu/SkGpuDevice.cpp |
=================================================================== |
--- src/gpu/SkGpuDevice.cpp (revision 8845) |
+++ src/gpu/SkGpuDevice.cpp (working copy) |
@@ -21,6 +21,7 @@ |
#include "SkGlyphCache.h" |
#include "SkImageFilter.h" |
#include "SkPathEffect.h" |
+#include "SkRRect.h" |
#include "SkStroke.h" |
#include "SkUtils.h" |
@@ -707,6 +708,39 @@ |
/////////////////////////////////////////////////////////////////////////////// |
+void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect, |
+ const SkPaint& paint) { |
+ CHECK_FOR_NODRAW_ANNOTATION(paint); |
+ CHECK_SHOULD_DRAW(draw, false); |
+ |
+ bool usePath = !rect.isSimple() || !paint.isAntiAlias(); |
+ // another two reasons we might need to call drawPath... |
+ if (paint.getMaskFilter() || paint.getPathEffect()) { |
+ usePath = true; |
+ } |
+ // until we can rotate rrects... |
+ if (!usePath && !fContext->getMatrix().rectStaysRect()) { |
+ usePath = true; |
+ } |
+ |
+ if (usePath) { |
+ SkPath path; |
+ path.addRRect(rect); |
+ this->drawPath(draw, path, paint, NULL, true); |
+ return; |
+ } |
+ |
+ GrPaint grPaint; |
+ if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { |
+ return; |
+ } |
+ |
+ SkStrokeRec stroke(paint); |
+ fContext->drawRRect(grPaint, rect, stroke); |
+} |
+ |
+/////////////////////////////////////////////////////////////////////////////// |
+ |
void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, |
const SkPaint& paint) { |
CHECK_FOR_NODRAW_ANNOTATION(paint); |