Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Unified Diff: src/core/SkEdgeClipper.cpp

Issue 1532733002: check bounds of each cubic segment against clip (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkScan_Hairline.cpp » ('j') | src/core/SkScan_Hairline.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkEdgeClipper.cpp
diff --git a/src/core/SkEdgeClipper.cpp b/src/core/SkEdgeClipper.cpp
index c6a4fb2971312217fa2eb4eb988e9b5594f671b7..55f9192aea198f77eb61232274c28cf746363aa4 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) {
mtklein 2015/12/17 14:58:15 Just for fun, let's compare speed with SkScalar
+ 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++) {
« no previous file with comments | « no previous file | src/core/SkScan_Hairline.cpp » ('j') | src/core/SkScan_Hairline.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698