aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private/SkPathRef.h
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-08-15 16:08:48 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-15 20:29:07 +0000
commit03776fc0d7eaf3f05886d7eaf6c2563c8fc2dfb1 (patch)
tree29c3037bdb4908dcb0cc4ec77e3b99bde34109be /include/private/SkPathRef.h
parent15bb26ec70c9df6dbfc259918d9d9b0d8b2fcccc (diff)
Speed up convexpaths GM in debug builds
That GM has a path with 16k points, arranged in a rectangle. When we try to draw it in Ganesh, we first check to see if it's a (closed) rectangle. We eventually decide that it is a rectangle, but not closed, so it gets passed along. Then we construct a GrShape, which tries to simplify the shape, again asking if it's a rectangle... Each isRect query was iterating over the 16k verbs, and for each one, calling atVerb(i). That, internally, calls verbs(), which calls validate() in debug builds. So we were walking all 16k points 16k times (to ensure the bounds were correct). The end result is that the GM took over 11 seconds to draw, and now takes 3 ms. Bug: skia: Change-Id: If5f7a067b8c25f049dc64275d94a42ae4a50f6a9 Reviewed-on: https://skia-review.googlesource.com/34723 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include/private/SkPathRef.h')
-rw-r--r--include/private/SkPathRef.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/private/SkPathRef.h b/include/private/SkPathRef.h
index 560d933c59..f75b999f60 100644
--- a/include/private/SkPathRef.h
+++ b/include/private/SkPathRef.h
@@ -244,14 +244,14 @@ public:
static void Rewind(sk_sp<SkPathRef>* pathRef);
~SkPathRef();
- int countPoints() const { SkDEBUGCODE(this->validate();) return fPointCnt; }
- int countVerbs() const { SkDEBUGCODE(this->validate();) return fVerbCnt; }
- int countWeights() const { SkDEBUGCODE(this->validate();) return fConicWeights.count(); }
+ int countPoints() const { return fPointCnt; }
+ int countVerbs() const { return fVerbCnt; }
+ int countWeights() const { return fConicWeights.count(); }
/**
* Returns a pointer one beyond the first logical verb (last verb in memory order).
*/
- const uint8_t* verbs() const { SkDEBUGCODE(this->validate();) return fVerbs; }
+ const uint8_t* verbs() const { return fVerbs; }
/**
* Returns a const pointer to the first verb in memory (which is the last logical verb).
@@ -261,15 +261,15 @@ public:
/**
* Returns a const pointer to the first point.
*/
- const SkPoint* points() const { SkDEBUGCODE(this->validate();) return fPoints; }
+ const SkPoint* points() const { return fPoints; }
/**
* Shortcut for this->points() + this->countPoints()
*/
const SkPoint* pointsEnd() const { return this->points() + this->countPoints(); }
- const SkScalar* conicWeights() const { SkDEBUGCODE(this->validate();) return fConicWeights.begin(); }
- const SkScalar* conicWeightsEnd() const { SkDEBUGCODE(this->validate();) return fConicWeights.end(); }
+ const SkScalar* conicWeights() const { return fConicWeights.begin(); }
+ const SkScalar* conicWeightsEnd() const { return fConicWeights.end(); }
/**
* Convenience methods for getting to a verb or point by index.