In GrClipStackClip check whether op bounds are inside RT before checking for empty clip stack.

Also fixes the bounds of aa bevel stroked rectangles.

Change-Id: I4c80deb9066ebbf9514ce3d4b270ff566bf12e02
Reviewed-on: https://skia-review.googlesource.com/9786
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Brian Salomon 2017-03-16 12:15:22 -04:00 committed by Skia Commit-Bot
parent 0c492cfe17
commit 510dd42a63
2 changed files with 13 additions and 5 deletions

View File

@ -250,15 +250,15 @@ static bool get_analytic_clip_processor(const ElementList& elements,
bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTargetContext,
bool useHWAA, bool hasUserStencilSettings, GrAppliedClip* out,
SkRect* bounds) const {
if (!fStack || fStack->isWideOpen()) {
return true;
}
SkRect devBounds = SkRect::MakeIWH(renderTargetContext->width(), renderTargetContext->height());
if (!devBounds.intersect(*bounds)) {
return false;
}
if (!fStack || fStack->isWideOpen()) {
return true;
}
const GrReducedClip reducedClip(*fStack, devBounds,
renderTargetContext->priv().maxWindowRectangles());

View File

@ -138,7 +138,15 @@ public:
compute_rects(&info.fDevOutside, &info.fDevOutsideAssist, &info.fDevInside,
&info.fDegenerate, viewMatrix, rect, stroke.getWidth(), isMiter);
info.fColor = color;
op->setBounds(info.fDevOutside, HasAABloat::kYes, IsZeroArea::kNo);
if (isMiter) {
op->setBounds(info.fDevOutside, HasAABloat::kYes, IsZeroArea::kNo);
} else {
// The outer polygon of the bevel stroke is an octagon specified by the points of a
// pair of overlapping rectangles where one is wide and the other is narrow.
SkRect bounds = info.fDevOutside;
bounds.joinPossiblyEmptyRect(info.fDevOutsideAssist);
op->setBounds(bounds, HasAABloat::kYes, IsZeroArea::kNo);
}
op->fViewMatrix = viewMatrix;
return std::unique_ptr<GrMeshDrawOp>(op);
}