chop down huge rects before hairlining
Bug: skia: Change-Id: I18f4b1dc4f279e37832d4bced0a66b5c356d09c0 Reviewed-on: https://skia-review.googlesource.com/112572 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
73fb0c97e4
commit
c7fbda9540
@ -144,14 +144,25 @@ void SkScan::HairLineRgn(const SkPoint array[], int arrayCount, const SkRegion*
|
|||||||
|
|
||||||
// we don't just draw 4 lines, 'cause that can leave a gap in the bottom-right
|
// we don't just draw 4 lines, 'cause that can leave a gap in the bottom-right
|
||||||
// and double-hit the top-left.
|
// and double-hit the top-left.
|
||||||
void SkScan::HairRect(const SkRect& rect, const SkRasterClip& clip,
|
void SkScan::HairRect(const SkRect& rect, const SkRasterClip& clip, SkBlitter* blitter) {
|
||||||
SkBlitter* blitter) {
|
|
||||||
SkAAClipBlitterWrapper wrapper;
|
SkAAClipBlitterWrapper wrapper;
|
||||||
SkBlitterClipper clipper;
|
SkBlitterClipper clipper;
|
||||||
const SkIRect r = SkIRect::MakeLTRB(SkScalarFloorToInt(rect.fLeft),
|
// Create the enclosing bounds of the hairrect. i.e. we will stroke the interior of r.
|
||||||
SkScalarFloorToInt(rect.fTop),
|
SkIRect r = SkIRect::MakeLTRB(SkScalarFloorToInt(rect.fLeft),
|
||||||
SkScalarFloorToInt(rect.fRight) + 1,
|
SkScalarFloorToInt(rect.fTop),
|
||||||
SkScalarFloorToInt(rect.fBottom) + 1);
|
SkScalarFloorToInt(rect.fRight + 1),
|
||||||
|
SkScalarFloorToInt(rect.fBottom + 1));
|
||||||
|
|
||||||
|
// Note: r might be crazy big, if rect was huge, possibly getting pinned to max/min s32.
|
||||||
|
// We need to trim it back to something reasonable before we can query its width etc.
|
||||||
|
// since r.fRight - r.fLeft might wrap around to negative even if fRight > fLeft.
|
||||||
|
//
|
||||||
|
// We outset the clip bounds by 1 before intersecting, since r is being stroked and not filled
|
||||||
|
// so we don't want to pin an edge of it to the clip. The intersect's job is mostly to just
|
||||||
|
// get the actual edge values into a reasonable range (e.g. so width() can't overflow).
|
||||||
|
if (!r.intersect(clip.getBounds().makeOutset(1, 1))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (clip.quickReject(r)) {
|
if (clip.quickReject(r)) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user