Cleanup

Change-Id: I91ffb9c66697741116fdeaa31abdf6cfd79155df
diff --git a/libs/hwui/Android.common.mk b/libs/hwui/Android.common.mk
index 536912a..fba7254 100644
--- a/libs/hwui/Android.common.mk
+++ b/libs/hwui/Android.common.mk
@@ -1,7 +1,6 @@
 # getConfig in external/skia/include/core/SkBitmap.h is deprecated.
 # Allow Gnu extension: in-class initializer of static 'const float' member.
 LOCAL_CLANG_CFLAGS += \
-    -Wno-unused-parameter \
     -Wno-deprecated-declarations \
     -Wno-gnu-static-float-init
 
@@ -77,7 +76,6 @@
     external/skia/src/core
 
 LOCAL_CFLAGS += -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES
-LOCAL_CFLAGS += -Wno-unused-parameter
 LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libEGL libGLESv2 libskia libui libgui
 
 ifneq (false,$(ANDROID_ENABLE_RENDERSCRIPT))
@@ -102,4 +100,4 @@
 # Defaults for ATRACE_TAG and LOG_TAG for libhwui
 LOCAL_CFLAGS += -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\"
 
-LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
\ No newline at end of file
+LOCAL_CFLAGS += -Wall -Werror -Wno-unused-parameter -Wunused -Wunreachable-code
diff --git a/libs/hwui/DisplayList.h b/libs/hwui/DisplayList.h
index e168786..26637a7 100644
--- a/libs/hwui/DisplayList.h
+++ b/libs/hwui/DisplayList.h
@@ -67,7 +67,7 @@
 /**
  * Holds data used in the playback a tree of DisplayLists.
  */
-class PlaybackStateStruct {
+struct PlaybackStateStruct {
 protected:
     PlaybackStateStruct(OpenGLRenderer& renderer, int replayFlags, LinearAllocator* allocator)
             : mRenderer(renderer)
@@ -96,8 +96,7 @@
     DeferredDisplayList& mDeferredList;
 };
 
-class ReplayStateStruct : public PlaybackStateStruct {
-public:
+struct ReplayStateStruct : public PlaybackStateStruct {
     ReplayStateStruct(OpenGLRenderer& renderer, Rect& dirty, int replayFlags)
             : PlaybackStateStruct(renderer, replayFlags, &mReplayAllocator),
             mDirty(dirty) {}
diff --git a/libs/hwui/Interpolator.cpp b/libs/hwui/Interpolator.cpp
index 0e62d77..2623f53 100644
--- a/libs/hwui/Interpolator.cpp
+++ b/libs/hwui/Interpolator.cpp
@@ -14,12 +14,6 @@
  * limitations under the License.
  */
 
-// LOG_TAG is being provided by the Makefile, reset.
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "Interpolator"
-
 #include "Interpolator.h"
 
 #include <cmath>
diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp
index 3216cd2..d6703f2 100644
--- a/libs/hwui/LayerCache.cpp
+++ b/libs/hwui/LayerCache.cpp
@@ -80,10 +80,8 @@
 
 void LayerCache::deleteLayer(Layer* layer) {
     if (layer) {
-        if (kDebugLayers) {
-            ALOGD("Destroying layer %dx%d, fbo %d", layer->getWidth(), layer->getHeight(),
-                    layer->getFbo());
-        }
+        LAYER_LOGD("Destroying layer %dx%d, fbo %d", layer->getWidth(), layer->getHeight(),
+                layer->getFbo());
         mSize -= layer->getWidth() * layer->getHeight() * 4;
         layer->state = Layer::kState_DeletedFromCache;
         layer->decStrong(0);
@@ -112,13 +110,9 @@
         layer->state = Layer::kState_RemovedFromCache;
         mSize -= layer->getWidth() * layer->getHeight() * 4;
 
-        if (kDebugLayers) {
-            ALOGD("Reusing layer %dx%d", layer->getWidth(), layer->getHeight());
-        }
+        LAYER_LOGD("Reusing layer %dx%d", layer->getWidth(), layer->getHeight());
     } else {
-        if (kDebugLayers) {
-            ALOGD("Creating new layer %dx%d", entry.mWidth, entry.mHeight);
-        }
+        LAYER_LOGD("Creating new layer %dx%d", entry.mWidth, entry.mHeight);
 
         layer = new Layer(Layer::kType_DisplayList, renderState, entry.mWidth, entry.mHeight);
         layer->setBlend(true);
@@ -143,9 +137,7 @@
     size_t size = mCache.size();
     for (size_t i = 0; i < size; i++) {
         const LayerEntry& entry = mCache.itemAt(i);
-        if (kDebugLayers) {
-            ALOGD("  Layer size %dx%d", entry.mWidth, entry.mHeight);
-        }
+        ALOGD("  Layer size %dx%d", entry.mWidth, entry.mHeight);
     }
 }
 
@@ -165,10 +157,8 @@
             deleteLayer(victim);
             mCache.removeAt(position);
 
-            if (kDebugLayers) {
-                ALOGD("  Deleting layer %.2fx%.2f", victim->layer.getWidth(),
-                        victim->layer.getHeight());
-            }
+            LAYER_LOGD("  Deleting layer %.2fx%.2f", victim->layer.getWidth(),
+                    victim->layer.getHeight());
         }
 
         layer->cancelDefer();
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h
index 81810ac..0ff8f3e 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -26,11 +26,14 @@
 
 class RenderState;
 
-// Debug
+///////////////////////////////////////////////////////////////////////////////
+// Defines
+///////////////////////////////////////////////////////////////////////////////
+
 #if DEBUG_LAYERS
-static const bool kDebugLayers = true;
+    #define LAYER_LOGD(...) ALOGD(__VA_ARGS__)
 #else
-static const bool kDebugLayers = false;
+    #define LAYER_LOGD(...)
 #endif
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 3f67f54..f200c55 100755
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -740,10 +740,8 @@
  */
 bool OpenGLRenderer::createLayer(float left, float top, float right, float bottom,
         const SkPaint* paint, int flags, const SkPath* convexMask) {
-    if (kDebugLayers) {
-        ALOGD("Requesting layer %.2fx%.2f", right - left, bottom - top);
-        ALOGD("Layer cache size = %d", mCaches.layerCache.getSize());
-    }
+    LAYER_LOGD("Requesting layer %.2fx%.2f", right - left, bottom - top);
+    LAYER_LOGD("Layer cache size = %d", mCaches.layerCache.getSize());
 
     const bool fboLayer = flags & SkCanvas::kClipToLayer_SaveFlag;
 
@@ -921,9 +919,7 @@
     // Failing to add the layer to the cache should happen only if the layer is too large
     layer->setConvexMask(NULL);
     if (!mCaches.layerCache.put(layer)) {
-        if (kDebugLayers) {
-            ALOGD("Deleting layer");
-        }
+        LAYER_LOGD("Deleting layer");
         layer->decStrong(0);
     }
 }
diff --git a/libs/hwui/renderthread/RenderTask.cpp b/libs/hwui/renderthread/RenderTask.cpp
index 13970ba..b14f580 100644
--- a/libs/hwui/renderthread/RenderTask.cpp
+++ b/libs/hwui/renderthread/RenderTask.cpp
@@ -14,15 +14,8 @@
  * limitations under the License.
  */
 
-// LOG_TAG is being provided by the Makefile, reset.
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "RenderTask"
-
 #include "RenderTask.h"
 
-#include <utils/Log.h>
 #include <utils/Condition.h>
 #include <utils/Mutex.h>