aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPathRef.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-10-05 12:16:52 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-05 12:16:52 -0700
commit0c52b1740e9714bdfaa111bec923a3f61a55d5b4 (patch)
tree4b58beacc0f9df2c655cf9ae58d1ca146c2e5415 /src/core/SkPathRef.cpp
parent2f036965f0ab7abf79866fb5a35f57d959b81022 (diff)
validate using nx to match bounds
Check the path against the bounds using Nx instead of straight scalars, R=mtklein@google.com BUG=skia:5541 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2388903006 Review-Url: https://codereview.chromium.org/2388903006
Diffstat (limited to 'src/core/SkPathRef.cpp')
-rw-r--r--src/core/SkPathRef.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index e5efefcceb..844c40a505 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -677,6 +677,9 @@ uint8_t SkPathRef::Iter::peek() const {
}
#ifdef SK_DEBUG
+
+#include "SkNx.h"
+
void SkPathRef::validate() const {
SkASSERT(static_cast<ptrdiff_t>(fFreeSpace) >= 0);
SkASSERT(reinterpret_cast<intptr_t>(fVerbs) - reinterpret_cast<intptr_t>(fPoints) >= 0);
@@ -700,11 +703,13 @@ void SkPathRef::validate() const {
if (!fBoundsIsDirty && !fBounds.isEmpty()) {
bool isFinite = true;
+ Sk2s leftTop = Sk2s(fBounds.fLeft, fBounds.fTop);
+ Sk2s rightBot = Sk2s(fBounds.fRight, fBounds.fBottom);
for (int i = 0; i < fPointCnt; ++i) {
+ Sk2s point = Sk2s(fPoints[i].fX, fPoints[i].fY);
#ifdef SK_DEBUG
if (fPoints[i].isFinite() &&
- (fPoints[i].fX < fBounds.fLeft || fPoints[i].fX > fBounds.fRight ||
- fPoints[i].fY < fBounds.fTop || fPoints[i].fY > fBounds.fBottom)) {
+ ((point < leftTop).anyTrue() || (point > rightBot).anyTrue())) {
SkDebugf("bounds: %f %f %f %f\n",
fBounds.fLeft, fBounds.fTop, fBounds.fRight, fBounds.fBottom);
for (int j = 0; j < fPointCnt; ++j) {
@@ -717,8 +722,7 @@ void SkPathRef::validate() const {
#endif
SkASSERT(!fPoints[i].isFinite() ||
- (fPoints[i].fX >= fBounds.fLeft && fPoints[i].fX <= fBounds.fRight &&
- fPoints[i].fY >= fBounds.fTop && fPoints[i].fY <= fBounds.fBottom));
+ (!(point < leftTop).anyTrue() && !(point > rightBot).anyTrue()));
if (!fPoints[i].isFinite()) {
isFinite = false;
}