summaryrefslogtreecommitdiff
path: root/libs/hwui/DeferredDisplayList.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-05-05 19:09:33 -0700
committerChris Craik <ccraik@google.com>2014-05-15 16:36:12 -0700
commitdeeda3d337aed1eee218b89a7aba5992ced371f0 (patch)
tree15e13e84727baebce58b735e34ef5d198fd84389 /libs/hwui/DeferredDisplayList.cpp
parentfe4c1e225d147fe9cb5d7c121b7d6d11a312844e (diff)
Round rect outline clipping
Change-Id: Iee9cf4f719f6f1917507b69189ad114fa365917b
Diffstat (limited to 'libs/hwui/DeferredDisplayList.cpp')
-rw-r--r--libs/hwui/DeferredDisplayList.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp
index 45b6624029c0..3016814deafc 100644
--- a/libs/hwui/DeferredDisplayList.cpp
+++ b/libs/hwui/DeferredDisplayList.cpp
@@ -28,6 +28,7 @@
#include "DeferredDisplayList.h"
#include "DisplayListOp.h"
#include "OpenGLRenderer.h"
+#include "utils/MathUtils.h"
#if DEBUG_DEFER
#define DEFER_LOGD(...) ALOGD(__VA_ARGS__)
@@ -146,10 +147,6 @@ private:
mergeid_t mMergeId;
};
-// compare alphas approximately, with a small margin
-#define NEQ_FALPHA(lhs, rhs) \
- fabs((float)lhs - (float)rhs) > 0.001f
-
class MergingDrawBatch : public DrawBatch {
public:
MergingDrawBatch(DeferInfo& deferInfo, int width, int height) :
@@ -196,7 +193,11 @@ public:
const DeferredDisplayState* lhs = state;
const DeferredDisplayState* rhs = mOps[0].state;
- if (NEQ_FALPHA(lhs->mAlpha, rhs->mAlpha)) return false;
+ if (!MathUtils::areEqual(lhs->mAlpha, rhs->mAlpha)) return false;
+
+ // Identical round rect clip state means both ops will clip in the same way, or not at all.
+ // As the state objects are const, we can compare their pointers to determine mergeability
+ if (lhs->mRoundRectClipState != rhs->mRoundRectClipState) return false;
/* Clipping compatibility check
*