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

Unified Diff: src/gpu/GrOvalRenderer.cpp

Issue 310483010: Fall back to using clip effect for outer rrect in drawdrrect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add test to ignored-tests.txt Created 6 years, 7 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/GrDrawState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrOvalRenderer.cpp
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 45564bcce049c8c3cbf457d39da9a1efe3cd702f..8a76646b5b1946fdbc096ac08a9f724319b95e65 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -884,7 +884,10 @@ GrIndexBuffer* GrOvalRenderer::rRectIndexBuffer(GrGpu* gpu) {
}
bool GrOvalRenderer::drawDRRect(GrDrawTarget* target, GrContext* context, bool useAA,
- const SkRRect& outer, const SkRRect& origInner) {
+ const SkRRect& origOuter, const SkRRect& origInner) {
+ bool applyAA = useAA &&
+ !target->getDrawState().getRenderTarget()->isMultisampled() &&
+ !target->shouldDisableCoverageAAForBlend();
GrDrawState::AutoRestoreEffects are;
if (!origInner.isEmpty()) {
SkTCopyOnFirstWrite<SkRRect> inner(origInner);
@@ -893,9 +896,6 @@ bool GrOvalRenderer::drawDRRect(GrDrawTarget* target, GrContext* context, bool u
return false;
}
}
- bool applyAA = useAA &&
- !target->getDrawState().getRenderTarget()->isMultisampled() &&
- !target->shouldDisableCoverageAAForBlend();
GrEffectEdgeType edgeType = applyAA ? kInverseFillAA_GrEffectEdgeType :
kInverseFillBW_GrEffectEdgeType;
GrEffectRef* effect = GrRRectEffect::Create(edgeType, *inner);
@@ -907,7 +907,37 @@ bool GrOvalRenderer::drawDRRect(GrDrawTarget* target, GrContext* context, bool u
}
SkStrokeRec fillRec(SkStrokeRec::kFill_InitStyle);
- return this->drawRRect(target, context, useAA, outer, fillRec);
+ if (this->drawRRect(target, context, useAA, origOuter, fillRec)) {
+ return true;
+ }
+
+ SkASSERT(!origOuter.isEmpty());
+ SkTCopyOnFirstWrite<SkRRect> outer(origOuter);
+ if (!context->getMatrix().isIdentity()) {
+ if (!origOuter.transform(context->getMatrix(), outer.writable())) {
+ return false;
+ }
+ }
+ GrEffectEdgeType edgeType = applyAA ? kFillAA_GrEffectEdgeType :
+ kFillBW_GrEffectEdgeType;
+ GrEffectRef* effect = GrRRectEffect::Create(edgeType, *outer);
+ if (NULL == effect) {
+ return false;
+ }
+ if (!are.isSet()) {
+ are.set(target->drawState());
+ }
+ GrDrawState::AutoViewMatrixRestore avmr;
+ if (!avmr.setIdentity(target->drawState())) {
+ return false;
+ }
+ target->drawState()->addCoverageEffect(effect)->unref();
+ SkRect bounds = outer->getBounds();
+ if (applyAA) {
+ bounds.outset(SK_ScalarHalf, SK_ScalarHalf);
+ }
+ target->drawRect(bounds, NULL, NULL, NULL);
+ return true;
}
bool GrOvalRenderer::drawRRect(GrDrawTarget* target, GrContext* context, bool useAA,
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698