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

Unified Diff: src/gpu/GrContext.cpp

Issue 220233011: Implement drawDRRect for GPU (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 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 | « include/gpu/SkGpuDevice.h ('k') | src/gpu/GrOvalRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 89548ab5c956ee4fd066cef2774746ef8264de18..90bf8c042e498cc2e1ec3f2547f1ea586a919b51 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1002,9 +1002,9 @@ void GrContext::drawVertices(const GrPaint& paint,
///////////////////////////////////////////////////////////////////////////////
void GrContext::drawRRect(const GrPaint& paint,
- const SkRRect& rect,
+ const SkRRect& rrect,
const SkStrokeRec& stroke) {
- if (rect.isEmpty()) {
+ if (rrect.isEmpty()) {
return;
}
@@ -1014,15 +1014,41 @@ void GrContext::drawRRect(const GrPaint& paint,
GR_CREATE_TRACE_MARKER("GrContext::drawRRect", target);
- if (!fOvalRenderer->drawSimpleRRect(target, this, paint.isAntiAlias(), rect, stroke)) {
+ if (!fOvalRenderer->drawRRect(target, this, paint.isAntiAlias(), rrect, stroke)) {
SkPath path;
- path.addRRect(rect);
+ path.addRRect(rrect);
this->internalDrawPath(target, paint.isAntiAlias(), path, stroke);
}
}
///////////////////////////////////////////////////////////////////////////////
+void GrContext::drawDRRect(const GrPaint& paint,
+ const SkRRect& outer,
+ const SkRRect& inner) {
+ if (outer.isEmpty()) {
+ return;
+ }
+
+ AutoRestoreEffects are;
+ AutoCheckFlush acf(this);
+ GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf);
+
+ GR_CREATE_TRACE_MARKER("GrContext::drawDRRect", target);
+
+ if (!fOvalRenderer->drawDRRect(target, this, paint.isAntiAlias(), outer, inner)) {
+ SkPath path;
+ path.addRRect(inner);
+ path.addRRect(outer);
+ path.setFillType(SkPath::kEvenOdd_FillType);
+
+ SkStrokeRec fillRec(SkStrokeRec::kFill_InitStyle);
+ this->internalDrawPath(target, paint.isAntiAlias(), path, fillRec);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
void GrContext::drawOval(const GrPaint& paint,
const SkRect& oval,
const SkStrokeRec& stroke) {
« no previous file with comments | « include/gpu/SkGpuDevice.h ('k') | src/gpu/GrOvalRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698