Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 13852049: Add GPU support for roundrects (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Add oval check to SkCanvas Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698