aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrContext.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-09 21:26:11 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-09 21:26:11 +0000
commit0a09d7195b8d9945e5c9c76cc4cfe6ef65d6d390 (patch)
treec45daab7ffc6c83198376c64719b9762a7cddcd2 /src/gpu/GrContext.cpp
parent149e9a107c356b0151433fb23c2b1c8d0634947c (diff)
Implement drawDRRect for GPU
BUG=skia:2259 R=jvanverth@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/220233011 git-svn-id: http://skia.googlecode.com/svn/trunk@14118 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rw-r--r--src/gpu/GrContext.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 89548ab5c9..90bf8c042e 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) {