aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkEdgeClipper.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-12-17 07:55:39 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-17 07:55:39 -0800
commit70509762c88df911c58c3984e6b1e673b5ecaeac (patch)
tree6e481a2abeeb1415b8084737d14b3e8a69458cce /src/core/SkEdgeClipper.cpp
parent96205ddedcd477ae737fb3ad9a8987fbb62f4b30 (diff)
check bounds of each cubic segment against clip
Timing against complex svg image (map), no tiling: no change or very slightly faster tiling (4x4): went from 3x slower (than untiled) to 2x slower no gold changes expected BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1532733002 Review URL: https://codereview.chromium.org/1532733002
Diffstat (limited to 'src/core/SkEdgeClipper.cpp')
-rw-r--r--src/core/SkEdgeClipper.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/SkEdgeClipper.cpp b/src/core/SkEdgeClipper.cpp
index c6a4fb2971..55f9192aea 100644
--- a/src/core/SkEdgeClipper.cpp
+++ b/src/core/SkEdgeClipper.cpp
@@ -358,14 +358,19 @@ void SkEdgeClipper::clipMonoCubic(const SkPoint src[4], const SkRect& clip) {
}
}
+static bool quick_reject_in_y(const SkPoint pts[4], const SkRect& clip) {
+ Sk4s ys(pts[0].fY, pts[1].fY, pts[2].fY, pts[3].fY);
+ Sk4s t(clip.top());
+ Sk4s b(clip.bottom());
+
+ return (ys < t).allTrue() || (ys > b).allTrue();
+}
+
bool SkEdgeClipper::clipCubic(const SkPoint srcPts[4], const SkRect& clip) {
fCurrPoint = fPoints;
fCurrVerb = fVerbs;
- SkRect bounds;
- bounds.set(srcPts, 4);
-
- if (!quick_reject(bounds, clip)) {
+ if (!quick_reject_in_y(srcPts, clip)) {
SkPoint monoY[10];
int countY = SkChopCubicAtYExtrema(srcPts, monoY);
for (int y = 0; y <= countY; y++) {