Fix misplaced guard
This fixes an error in https://codereview.chromium.org/2125333002 (Add choke point for modifying non-AA rect draws (e.g., applying clipping)). In GrDrawContext::drawRect, when we need to draw a filled rect, we always want to call drawFilledRect when useDrawInsteadOfClear is false. With the buggy code I believe we were falling back to drawing a path. TBR=bsalomon@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2135883002 Review-Url: https://codereview.chromium.org/2135883002
This commit is contained in:
parent
6092b6e0e5
commit
3ab14ca950
@ -337,31 +337,33 @@ void GrDrawContext::drawRect(const GrClip& clip,
|
||||
AutoCheckFlush acf(fDrawingManager);
|
||||
|
||||
const SkStrokeRec& stroke = style->strokeRec();
|
||||
if (stroke.getStyle() == SkStrokeRec::kFill_Style &&
|
||||
!fContext->caps()->useDrawInsteadOfClear()) {
|
||||
// Check if this is a full RT draw and can be replaced with a clear. We don't bother
|
||||
// checking cases where the RT is fully inside a stroke.
|
||||
SkRect rtRect;
|
||||
fRenderTarget->getBoundsRect(&rtRect);
|
||||
// Does the clip contain the entire RT?
|
||||
if (clip.quickContains(rtRect)) {
|
||||
SkMatrix invM;
|
||||
if (!viewMatrix.invert(&invM)) {
|
||||
return;
|
||||
}
|
||||
// Does the rect bound the RT?
|
||||
SkPoint srcSpaceRTQuad[4];
|
||||
invM.mapRectToQuad(srcSpaceRTQuad, rtRect);
|
||||
if (rect_contains_inclusive(rect, srcSpaceRTQuad[0]) &&
|
||||
rect_contains_inclusive(rect, srcSpaceRTQuad[1]) &&
|
||||
rect_contains_inclusive(rect, srcSpaceRTQuad[2]) &&
|
||||
rect_contains_inclusive(rect, srcSpaceRTQuad[3])) {
|
||||
// Will it blend?
|
||||
GrColor clearColor;
|
||||
if (paint.isConstantBlendedColor(&clearColor)) {
|
||||
this->getDrawTarget()->clear(nullptr, clearColor, true, this);
|
||||
if (stroke.getStyle() == SkStrokeRec::kFill_Style) {
|
||||
|
||||
if (!fContext->caps()->useDrawInsteadOfClear()) {
|
||||
// Check if this is a full RT draw and can be replaced with a clear. We don't bother
|
||||
// checking cases where the RT is fully inside a stroke.
|
||||
SkRect rtRect;
|
||||
fRenderTarget->getBoundsRect(&rtRect);
|
||||
// Does the clip contain the entire RT?
|
||||
if (clip.quickContains(rtRect)) {
|
||||
SkMatrix invM;
|
||||
if (!viewMatrix.invert(&invM)) {
|
||||
return;
|
||||
}
|
||||
// Does the rect bound the RT?
|
||||
SkPoint srcSpaceRTQuad[4];
|
||||
invM.mapRectToQuad(srcSpaceRTQuad, rtRect);
|
||||
if (rect_contains_inclusive(rect, srcSpaceRTQuad[0]) &&
|
||||
rect_contains_inclusive(rect, srcSpaceRTQuad[1]) &&
|
||||
rect_contains_inclusive(rect, srcSpaceRTQuad[2]) &&
|
||||
rect_contains_inclusive(rect, srcSpaceRTQuad[3])) {
|
||||
// Will it blend?
|
||||
GrColor clearColor;
|
||||
if (paint.isConstantBlendedColor(&clearColor)) {
|
||||
this->getDrawTarget()->clear(nullptr, clearColor, true, this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user