do reject vertical lines if they are outside of the clip
Bug: skia:7981 Change-Id: Icae11ac2934bc6db5a5c3ad0f17aaf615efa2fe5 Reviewed-on: https://skia-review.googlesource.com/149291 Auto-Submit: Mike Reed <reed@google.com> Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
This commit is contained in:
parent
95be425f5b
commit
3054989426
@ -137,10 +137,12 @@ bool SkLineClipper::IntersectLine(const SkPoint src[2], const SkRect& clip,
|
||||
}
|
||||
|
||||
// check for quick-reject in X again, now that we may have been chopped
|
||||
if ((tmp[index1].fX <= clip.fLeft || tmp[index0].fX >= clip.fRight) &&
|
||||
tmp[index0].fX < tmp[index1].fX) {
|
||||
// only reject if we have a non-zero width
|
||||
return false;
|
||||
if ((tmp[index1].fX <= clip.fLeft || tmp[index0].fX >= clip.fRight)) {
|
||||
// usually we will return false, but we don't if the line is vertical and coincident
|
||||
// with the clip.
|
||||
if (tmp[0].fX != tmp[1].fX || tmp[0].fX < clip.fLeft || tmp[0].fX > clip.fRight) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp[index0].fX < clip.fLeft) {
|
||||
|
@ -156,3 +156,14 @@ DEF_TEST(Clipper, reporter) {
|
||||
test_edgeclipper();
|
||||
test_hairclipping(reporter);
|
||||
}
|
||||
|
||||
#include "SkLineClipper.h"
|
||||
|
||||
DEF_TEST(LineClipper_skbug_7981, r) {
|
||||
SkPoint src[] = {{ -5.77698802E+17f, -1.81758057E+23f}, {38127, 2}};
|
||||
SkPoint dst[2];
|
||||
SkRect clip = { -32767, -32767, 32767, 32767 };
|
||||
|
||||
SkLineClipper::IntersectLine(src, clip, dst);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user