From 0a09d7195b8d9945e5c9c76cc4cfe6ef65d6d390 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Wed, 9 Apr 2014 21:26:11 +0000 Subject: 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 --- src/gpu/GrContext.cpp | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'src/gpu/GrContext.cpp') 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) { -- cgit v1.2.3