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

Unified Diff: src/core/SkRect.cpp

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 | « src/core/SkPoint.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRect.cpp
diff --git a/src/core/SkRect.cpp b/src/core/SkRect.cpp
index 2814375abba05bdfdaa1ae68832a09f1e69b71e3..12f76526a5d0fc0dc52e00430869156befc6f2bd 100644
--- a/src/core/SkRect.cpp
+++ b/src/core/SkRect.cpp
@@ -146,8 +146,7 @@ bool SkRect::intersect(const SkRect& a, const SkRect& b) {
return false;
}
-void SkRect::join(SkScalar left, SkScalar top, SkScalar right,
- SkScalar bottom) {
+void SkRect::join(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) {
// do nothing if the params are empty
if (left >= right || top >= bottom) {
return;
@@ -157,9 +156,9 @@ void SkRect::join(SkScalar left, SkScalar top, SkScalar right,
if (fLeft >= fRight || fTop >= fBottom) {
this->set(left, top, right, bottom);
} else {
- if (left < fLeft) fLeft = left;
- if (top < fTop) fTop = top;
- if (right > fRight) fRight = right;
- if (bottom > fBottom) fBottom = bottom;
+ fLeft = SkMinScalar(fLeft, left);
+ fTop = SkMinScalar(fTop, top);
+ fRight = SkMaxScalar(fRight, right);
+ fBottom = SkMaxScalar(fBottom, bottom);
}
}
« no previous file with comments | « src/core/SkPoint.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698