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

Unified Diff: src/core/SkPathRef.cpp

Issue 2388903006: validate using nx to match bounds (Closed)
Patch Set: Created 4 years, 2 months 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 | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPathRef.cpp
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index e5efefcceb7c8b319efe065a5aa7ee9db17d8be6..844c40a505b1df9e20daa737f121bd60537f7c98 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;
}
« no previous file with comments | « no previous file | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698