summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/jni/android/opengl/poly_clip.cpp6
-rw-r--r--core/jni/android_view_GraphicBuffer.cpp2
-rw-r--r--libs/hwui/DisplayListOp.h4
-rw-r--r--libs/hwui/Matrix.cpp2
-rw-r--r--libs/hwui/OpenGLRenderer.cpp2
-rw-r--r--libs/hwui/Properties.h4
-rw-r--r--libs/hwui/RenderProperties.h2
-rw-r--r--libs/hwui/font/FontUtil.h2
-rw-r--r--libs/hwui/utils/LinearAllocator.cpp4
9 files changed, 14 insertions, 14 deletions
diff --git a/core/jni/android/opengl/poly_clip.cpp b/core/jni/android/opengl/poly_clip.cpp
index 5c652205b223..271675c30766 100644
--- a/core/jni/android/opengl/poly_clip.cpp
+++ b/core/jni/android/opengl/poly_clip.cpp
@@ -35,12 +35,12 @@
namespace android {
-#define SWAP(a, b, temp) {temp = a; a = b; b = temp;}
+#define SWAP(a, b, temp) {(temp) = a; (a) = b; (b) = temp;}
#define COORD(vert, i) ((float *)(vert))[i]
#define CLIP_AND_SWAP(elem, sign, k, p, q, r) { \
- poly_clip_to_halfspace(p, q, &v->elem-(float *)v, sign, sign*k); \
- if (q->n==0) {p1->n = 0; return POLY_CLIP_OUT;} \
+ poly_clip_to_halfspace(p, q, &v->elem-(float *)v, sign, (sign)*(k)); \
+ if ((q)->n==0) {p1->n = 0; return POLY_CLIP_OUT;} \
SWAP(p, q, r); \
}
diff --git a/core/jni/android_view_GraphicBuffer.cpp b/core/jni/android_view_GraphicBuffer.cpp
index af975fbf7c9c..f32ea0048752 100644
--- a/core/jni/android_view_GraphicBuffer.cpp
+++ b/core/jni/android_view_GraphicBuffer.cpp
@@ -49,7 +49,7 @@ namespace android {
// Debug
static const bool kDebugGraphicBuffer = false;
-#define LOCK_CANVAS_USAGE GraphicBuffer::USAGE_SW_READ_OFTEN | GraphicBuffer::USAGE_SW_WRITE_OFTEN
+#define LOCK_CANVAS_USAGE (GraphicBuffer::USAGE_SW_READ_OFTEN | GraphicBuffer::USAGE_SW_WRITE_OFTEN)
// ----------------------------------------------------------------------------
// JNI Helpers
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index 8b4b4ba2b79e..0d7911c1daa4 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -639,8 +639,8 @@ public:
}
#define SET_TEXTURE(ptr, posRect, offsetRect, texCoordsRect, xDim, yDim) \
- TextureVertex::set(ptr++, posRect.xDim - offsetRect.left, posRect.yDim - offsetRect.top, \
- texCoordsRect.xDim, texCoordsRect.yDim)
+ TextureVertex::set((ptr)++, (posRect).xDim - (offsetRect).left, (posRect).yDim - (offsetRect).top, \
+ (texCoordsRect).xDim, (texCoordsRect).yDim)
/**
* This multi-draw operation builds a mesh on the stack by generating a quad
diff --git a/libs/hwui/Matrix.cpp b/libs/hwui/Matrix.cpp
index 06e67c0e85ad..872abde2c765 100644
--- a/libs/hwui/Matrix.cpp
+++ b/libs/hwui/Matrix.cpp
@@ -425,7 +425,7 @@ void Matrix4::mapPoint3d(Vector3& vec) const {
vec.z = orig.x * data[2] + orig.y * data[6] + orig.z * data[kScaleZ] + data[kTranslateZ];
}
-#define MUL_ADD_STORE(a, b, c) a = (a) * (b) + (c)
+#define MUL_ADD_STORE(a, b, c) ((a) = (a) * (b) + (c))
void Matrix4::mapPoint(float& x, float& y) const {
if (isSimple()) {
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 5233a2377d7f..2caadc7aa1f7 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -898,7 +898,7 @@ void OpenGLRenderer::composeLayerRect(Layer* layer, const Rect& rect) {
*/
#define DRAW_DOUBLE_STENCIL_IF(COND, DRAW_COMMAND) { \
DRAW_COMMAND; \
- if (CC_UNLIKELY(Properties::debugOverdraw && getTargetFbo() == 0 && COND)) { \
+ if (CC_UNLIKELY(Properties::debugOverdraw && getTargetFbo() == 0 && (COND))) { \
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); \
DRAW_COMMAND; \
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); \
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 26d8bf754ddb..5dea49387921 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -254,9 +254,9 @@ enum DebugLevel {
///////////////////////////////////////////////////////////////////////////////
// Converts a number of mega-bytes into bytes
-#define MB(s) s * 1024 * 1024
+#define MB(s) ((s) * 1024 * 1024)
// Converts a number of kilo-bytes into bytes
-#define KB(s) s * 1024
+#define KB(s) ((s) * 1024)
enum class ProfileType {
None,
diff --git a/libs/hwui/RenderProperties.h b/libs/hwui/RenderProperties.h
index 11abd701b9d8..56a7886f930f 100644
--- a/libs/hwui/RenderProperties.h
+++ b/libs/hwui/RenderProperties.h
@@ -46,7 +46,7 @@ class RenderNode;
class RenderProperties;
// The __VA_ARGS__ will be executed if a & b are not equal
-#define RP_SET(a, b, ...) (a != b ? (a = b, ##__VA_ARGS__, true) : false)
+#define RP_SET(a, b, ...) ((a) != (b) ? ((a) = (b), ##__VA_ARGS__, true) : false)
#define RP_SET_AND_DIRTY(a, b) RP_SET(a, b, mPrimitiveFields.mMatrixOrPivotDirty = true)
// Keep in sync with View.java:LAYER_TYPE_*
diff --git a/libs/hwui/font/FontUtil.h b/libs/hwui/font/FontUtil.h
index 4e5debe33c4a..db6b63602e13 100644
--- a/libs/hwui/font/FontUtil.h
+++ b/libs/hwui/font/FontUtil.h
@@ -44,7 +44,7 @@
typedef uint16_t glyph_t;
#define TO_GLYPH(g) g
#define GET_METRICS(cache, glyph) cache->getGlyphIDMetrics(glyph)
- #define GET_GLYPH(text) nextGlyph((const uint16_t**) &text)
+ #define GET_GLYPH(text) nextGlyph((const uint16_t**) &(text))
#define IS_END_OF_STRING(glyph) false
static inline glyph_t nextGlyph(const uint16_t** srcPtr) {
diff --git a/libs/hwui/utils/LinearAllocator.cpp b/libs/hwui/utils/LinearAllocator.cpp
index 59b12cf66a89..e2578041dbe1 100644
--- a/libs/hwui/utils/LinearAllocator.cpp
+++ b/libs/hwui/utils/LinearAllocator.cpp
@@ -48,8 +48,8 @@
#define ALIGN_SZ (sizeof(int))
#endif
-#define ALIGN(x) ((x + ALIGN_SZ - 1 ) & ~(ALIGN_SZ - 1))
-#define ALIGN_PTR(p) ((void*)(ALIGN((size_t)p)))
+#define ALIGN(x) (((x) + ALIGN_SZ - 1 ) & ~(ALIGN_SZ - 1))
+#define ALIGN_PTR(p) ((void*)(ALIGN((size_t)(p))))
#if LOG_NDEBUG
#define ADD_ALLOCATION(size)