diff options
author | Chris Craik <ccraik@google.com> | 2015-06-30 17:56:13 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2015-06-30 17:58:21 -0700 |
commit | df72b63928cc1492b72ba9a4e99d5e714f93ccc6 (patch) | |
tree | 38b94479dabc9aea2dfcde3a64348c51bc39cecf /libs/hwui/DisplayListOp.h | |
parent | 82b3f67711246ad5beaf7702ce16e9d433406d1e (diff) | |
download | frameworks_base-df72b63928cc1492b72ba9a4e99d5e714f93ccc6.zip frameworks_base-df72b63928cc1492b72ba9a4e99d5e714f93ccc6.tar.gz frameworks_base-df72b63928cc1492b72ba9a4e99d5e714f93ccc6.tar.bz2 |
Switch from fminf/fmaxf to std::min/max
bug:22208220
Shows considerable improvement in performance, especially in tight
loops.
Change-Id: I4bcf6584a3c145bfc55e73c9c73dcf6199290b3c
Diffstat (limited to 'libs/hwui/DisplayListOp.h')
-rw-r--r-- | libs/hwui/DisplayListOp.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h index fb2852a..d2bf138 100644 --- a/libs/hwui/DisplayListOp.h +++ b/libs/hwui/DisplayListOp.h @@ -29,6 +29,8 @@ #include "utils/LinearAllocator.h" #include "utils/PaintUtils.h" +#include <algorithm> + #include <SkColor.h> #include <SkPath.h> #include <SkPathOps.h> @@ -184,7 +186,7 @@ public: // TODO: it would be nice if this could take scale into account, but scale isn't stable // since higher levels of the view hierarchy can change scale out from underneath it. - return fmaxf(mPaint->getStrokeWidth(), 1) * 0.5f; + return std::max(mPaint->getStrokeWidth(), 1.0f) * 0.5f; } protected: @@ -235,10 +237,10 @@ public: DrawBoundedOp(const float* points, int count, const SkPaint* paint) : DrawOp(paint), mLocalBounds(points[0], points[1], points[0], points[1]) { for (int i = 2; i < count; i += 2) { - mLocalBounds.left = fminf(mLocalBounds.left, points[i]); - mLocalBounds.right = fmaxf(mLocalBounds.right, points[i]); - mLocalBounds.top = fminf(mLocalBounds.top, points[i + 1]); - mLocalBounds.bottom = fmaxf(mLocalBounds.bottom, points[i + 1]); + mLocalBounds.left = std::min(mLocalBounds.left, points[i]); + mLocalBounds.right = std::max(mLocalBounds.right, points[i]); + mLocalBounds.top = std::min(mLocalBounds.top, points[i + 1]); + mLocalBounds.bottom = std::max(mLocalBounds.bottom, points[i + 1]); } } |