aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/core/SkRect.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 96bf0f4d90..91765424c7 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -843,15 +843,13 @@ public:
* other. When this returns, left <= right && top <= bottom
*/
void sort() {
- SkScalar min = SkMinScalar(fLeft, fRight);
- SkScalar max = SkMaxScalar(fLeft, fRight);
- fLeft = min;
- fRight = max;
-
- min = SkMinScalar(fTop, fBottom);
- max = SkMaxScalar(fTop, fBottom);
- fTop = min;
- fBottom = max;
+ if (fLeft > fRight) {
+ SkTSwap<SkScalar>(fLeft, fRight);
+ }
+
+ if (fTop > fBottom) {
+ SkTSwap<SkScalar>(fTop, fBottom);
+ }
}
/**