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

Unified Diff: include/core/SkPoint.h

Issue 615993003: optimize setRectFan and join -- from profiling drawText (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | src/core/SkPoint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPoint.h
diff --git a/include/core/SkPoint.h b/include/core/SkPoint.h
index 6f32d98c751c3827a10e98b86810b130c2351edf..18b371f2ca3910274fc0520de772c87ef90075d2 100644
--- a/include/core/SkPoint.h
+++ b/include/core/SkPoint.h
@@ -212,7 +212,16 @@ struct SK_API SkPoint {
v[2].set(r, b);
v[3].set(r, t);
}
- void setRectFan(SkScalar l, SkScalar t, SkScalar r, SkScalar b, size_t stride);
+
+ void setRectFan(SkScalar l, SkScalar t, SkScalar r, SkScalar b, size_t stride) {
+ SkASSERT(stride >= sizeof(SkPoint));
+
+ ((SkPoint*)((intptr_t)this + 0 * stride))->set(l, t);
+ ((SkPoint*)((intptr_t)this + 1 * stride))->set(l, b);
+ ((SkPoint*)((intptr_t)this + 2 * stride))->set(r, b);
+ ((SkPoint*)((intptr_t)this + 3 * stride))->set(r, t);
+ }
+
static void Offset(SkPoint points[], int count, const SkPoint& offset) {
Offset(points, count, offset.fX, offset.fY);
« no previous file with comments | « no previous file | src/core/SkPoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698