Fall back to using clip effect for outer rect in drawdrrect
R=jvanverth@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/310483010
This commit is contained in:
parent
5fb3392c3e
commit
8af0523b38
@ -49,6 +49,10 @@ downsamplebitmap_image_high_mandrill_512.png
|
||||
filterbitmap_checkerboard_192_192
|
||||
downsamplebitmap_text_high_72.00pt
|
||||
|
||||
# bsalomon: Slight anti-aliasing changes in gpu version of this test
|
||||
# https://codereview.chromium.org/306063002/
|
||||
drrect
|
||||
|
||||
# These are part of picture-version 27 -- removal of SkUnitMapp
|
||||
# just need to be rebaselined
|
||||
scaled_tilemode_bitmap
|
||||
|
@ -411,6 +411,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool isSet() const { return NULL != fDrawState; }
|
||||
|
||||
private:
|
||||
GrDrawState* fDrawState;
|
||||
int fColorEffectCnt;
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user