reduce clip-limit for scan converter to avoid quad-edge overflow
For raster drawing, we already have a more conservative guard in SkBitmapDevice, which "tiles" the drawing on 8K boundaries (the smaller limit needed for antialiasing scan converters). This change is just needed for non-drawing uses of the scan converter. Bug: skia:7998 Bug: oss-fuzz:8483 Change-Id: Icfee9ca1ffcf93a2a8a3078d9ee10494fa04a6c7 Reviewed-on: https://skia-review.googlesource.com/129628 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
f104fec6d7
commit
5bedc80b26
@ -550,7 +550,9 @@ SkScanClipper::SkScanClipper(SkBlitter* blitter, const SkRegion* clip,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool clip_to_limit(const SkRegion& orig, SkRegion* reduced) {
|
||||
const int32_t limit = 32767;
|
||||
// need to limit coordinates such that the width/height of our rect can be represented
|
||||
// in SkFixed (16.16). See skbug.com/7998
|
||||
const int32_t limit = 32767 >> 1;
|
||||
|
||||
SkIRect limitR;
|
||||
limitR.set(-limit, -limit, limit, limit);
|
||||
|
@ -434,3 +434,13 @@ DEF_TEST(region_inverse_union_skbug_7491, reporter) {
|
||||
REPORTER_ASSERT(reporter, clip == rgn);
|
||||
}
|
||||
|
||||
DEF_TEST(giant_path_region, reporter) {
|
||||
const SkScalar big = 32767;
|
||||
SkPath path;
|
||||
path.moveTo(-big, 0);
|
||||
path.quadTo(big, 0, big, big);
|
||||
SkIRect ir = path.getBounds().round();
|
||||
SkRegion rgn;
|
||||
rgn.setPath(path, SkRegion(ir));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user