summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/AmbientShadow.cpp4
-rw-r--r--libs/hwui/Android.mk191
-rw-r--r--libs/hwui/DeferredDisplayList.cpp6
-rw-r--r--libs/hwui/DeferredDisplayList.h2
-rw-r--r--libs/hwui/DisplayList.h3
-rw-r--r--libs/hwui/DisplayListLogBuffer.cpp2
-rw-r--r--libs/hwui/DisplayListRenderer.cpp3
-rw-r--r--libs/hwui/FontRenderer.cpp2
-rw-r--r--libs/hwui/Interpolator.cpp4
-rw-r--r--libs/hwui/Layer.h2
-rw-r--r--libs/hwui/LayerCache.cpp24
-rw-r--r--libs/hwui/LayerCache.h8
-rw-r--r--libs/hwui/Matrix.cpp36
-rwxr-xr-xlibs/hwui/OpenGLRenderer.cpp25
-rw-r--r--libs/hwui/PathCache.cpp2
-rw-r--r--libs/hwui/PathTessellator.cpp8
-rw-r--r--libs/hwui/Program.h2
-rw-r--r--libs/hwui/Properties.h2
-rw-r--r--libs/hwui/RenderNode.cpp6
-rw-r--r--libs/hwui/ShadowTessellator.cpp1
-rw-r--r--libs/hwui/SkiaShader.h3
-rw-r--r--libs/hwui/SpotShadow.cpp8
-rw-r--r--libs/hwui/StatefulBaseRenderer.h3
-rw-r--r--libs/hwui/TessellationCache.h3
-rw-r--r--libs/hwui/TextDropShadowCache.cpp3
-rw-r--r--libs/hwui/font/Font.cpp16
-rw-r--r--libs/hwui/font/FontUtil.h11
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp4
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp6
-rw-r--r--libs/hwui/renderthread/RenderTask.cpp4
-rw-r--r--libs/hwui/renderthread/RenderThread.cpp6
-rw-r--r--libs/hwui/tests/main.cpp4
-rw-r--r--libs/hwui/thread/TaskManager.cpp6
33 files changed, 232 insertions, 178 deletions
diff --git a/libs/hwui/AmbientShadow.cpp b/libs/hwui/AmbientShadow.cpp
index b2dba00..5840107 100644
--- a/libs/hwui/AmbientShadow.cpp
+++ b/libs/hwui/AmbientShadow.cpp
@@ -121,14 +121,14 @@ inline void computeBufferSize(int* totalVertexCount, int* totalIndexCount,
*totalUmbraCount = 0;
if (!isCasterOpaque) {
// Add the centroid if occluder is translucent.
- *totalVertexCount++;
+ (*totalVertexCount)++;
*totalIndexCount += 2 * innerVertexCount + 1;
*totalUmbraCount = innerVertexCount;
}
}
inline bool needsExtraForEdge(float firstAlpha, float secondAlpha) {
- return abs(firstAlpha - secondAlpha) > ALPHA_THRESHOLD;
+ return fabsf(firstAlpha - secondAlpha) > ALPHA_THRESHOLD;
}
/**
diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk
index 49560ff..d0b9d82 100644
--- a/libs/hwui/Android.mk
+++ b/libs/hwui/Android.mk
@@ -1,110 +1,119 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+
+# Too many unused parameters in external/skia/include and this directory.
+# 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-gnu-static-float-init
# Only build libhwui when USE_OPENGL_RENDERER is
# defined in the current device/board configuration
ifeq ($(USE_OPENGL_RENDERER),true)
- LOCAL_SRC_FILES := \
- utils/Blur.cpp \
- utils/GLUtils.cpp \
- utils/SortedListImpl.cpp \
- thread/TaskManager.cpp \
- font/CacheTexture.cpp \
- font/Font.cpp \
- AmbientShadow.cpp \
- AnimationContext.cpp \
- Animator.cpp \
- AnimatorManager.cpp \
- AssetAtlas.cpp \
- DamageAccumulator.cpp \
- FontRenderer.cpp \
- GammaFontRenderer.cpp \
- Caches.cpp \
- DisplayList.cpp \
- DeferredDisplayList.cpp \
- DeferredLayerUpdater.cpp \
- DisplayListLogBuffer.cpp \
- DisplayListRenderer.cpp \
- Dither.cpp \
- DrawProfiler.cpp \
- Extensions.cpp \
- FboCache.cpp \
- GradientCache.cpp \
- Image.cpp \
- Interpolator.cpp \
- Layer.cpp \
- LayerCache.cpp \
- LayerRenderer.cpp \
- Matrix.cpp \
- OpenGLRenderer.cpp \
- Patch.cpp \
- PatchCache.cpp \
- PathCache.cpp \
- PathTessellator.cpp \
- PixelBuffer.cpp \
- Program.cpp \
- ProgramCache.cpp \
- RenderBufferCache.cpp \
- RenderNode.cpp \
- RenderProperties.cpp \
- RenderState.cpp \
- ResourceCache.cpp \
- ShadowTessellator.cpp \
- SkiaShader.cpp \
- Snapshot.cpp \
- SpotShadow.cpp \
- StatefulBaseRenderer.cpp \
- Stencil.cpp \
- TessellationCache.cpp \
- Texture.cpp \
- TextureCache.cpp \
- TextDropShadowCache.cpp
+ LOCAL_SRC_FILES := \
+ utils/Blur.cpp \
+ utils/GLUtils.cpp \
+ utils/SortedListImpl.cpp \
+ thread/TaskManager.cpp \
+ font/CacheTexture.cpp \
+ font/Font.cpp \
+ AmbientShadow.cpp \
+ AnimationContext.cpp \
+ Animator.cpp \
+ AnimatorManager.cpp \
+ AssetAtlas.cpp \
+ DamageAccumulator.cpp \
+ FontRenderer.cpp \
+ GammaFontRenderer.cpp \
+ Caches.cpp \
+ DisplayList.cpp \
+ DeferredDisplayList.cpp \
+ DeferredLayerUpdater.cpp \
+ DisplayListLogBuffer.cpp \
+ DisplayListRenderer.cpp \
+ Dither.cpp \
+ DrawProfiler.cpp \
+ Extensions.cpp \
+ FboCache.cpp \
+ GradientCache.cpp \
+ Image.cpp \
+ Interpolator.cpp \
+ Layer.cpp \
+ LayerCache.cpp \
+ LayerRenderer.cpp \
+ Matrix.cpp \
+ OpenGLRenderer.cpp \
+ Patch.cpp \
+ PatchCache.cpp \
+ PathCache.cpp \
+ PathTessellator.cpp \
+ PixelBuffer.cpp \
+ Program.cpp \
+ ProgramCache.cpp \
+ RenderBufferCache.cpp \
+ RenderNode.cpp \
+ RenderProperties.cpp \
+ RenderState.cpp \
+ ResourceCache.cpp \
+ ShadowTessellator.cpp \
+ SkiaShader.cpp \
+ Snapshot.cpp \
+ SpotShadow.cpp \
+ StatefulBaseRenderer.cpp \
+ Stencil.cpp \
+ TessellationCache.cpp \
+ Texture.cpp \
+ TextureCache.cpp \
+ TextDropShadowCache.cpp
# RenderThread stuff
- LOCAL_SRC_FILES += \
- renderthread/CanvasContext.cpp \
- renderthread/DrawFrameTask.cpp \
- renderthread/EglManager.cpp \
- renderthread/RenderProxy.cpp \
- renderthread/RenderTask.cpp \
- renderthread/RenderThread.cpp \
- renderthread/TimeLord.cpp
+ LOCAL_SRC_FILES += \
+ renderthread/CanvasContext.cpp \
+ renderthread/DrawFrameTask.cpp \
+ renderthread/EglManager.cpp \
+ renderthread/RenderProxy.cpp \
+ renderthread/RenderTask.cpp \
+ renderthread/RenderThread.cpp \
+ renderthread/TimeLord.cpp
+
+ intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,)
- intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,)
+ LOCAL_C_INCLUDES += \
+ external/skia/src/core
- LOCAL_C_INCLUDES += \
- external/skia/src/core
+ LOCAL_CFLAGS += -DUSE_OPENGL_RENDERER -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES
+ LOCAL_CFLAGS += -Wno-unused-parameter
+ LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+ LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libEGL libGLESv2 libskia libui libgui
+ LOCAL_MODULE := libhwui
+ LOCAL_MODULE_TAGS := optional
- LOCAL_CFLAGS += -DUSE_OPENGL_RENDERER -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES
- LOCAL_CFLAGS += -Wno-unused-parameter
- LOCAL_MODULE_CLASS := SHARED_LIBRARIES
- LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libEGL libGLESv2 libskia libui libgui
- LOCAL_MODULE := libhwui
- LOCAL_MODULE_TAGS := optional
+ ifneq (false,$(ANDROID_ENABLE_RENDERSCRIPT))
+ LOCAL_CFLAGS += -DANDROID_ENABLE_RENDERSCRIPT
+ LOCAL_SHARED_LIBRARIES += libRS libRScpp
+ LOCAL_C_INCLUDES += \
+ $(intermediates) \
+ frameworks/rs/cpp \
+ frameworks/rs \
- include external/stlport/libstlport.mk
+ endif
- ifneq (false,$(ANDROID_ENABLE_RENDERSCRIPT))
- LOCAL_CFLAGS += -DANDROID_ENABLE_RENDERSCRIPT
- LOCAL_SHARED_LIBRARIES += libRS libRScpp
- LOCAL_C_INCLUDES += \
- $(intermediates) \
- frameworks/rs/cpp \
- frameworks/rs
- endif
+ ifndef HWUI_COMPILE_SYMBOLS
+ LOCAL_CFLAGS += -fvisibility=hidden
+ endif
- ifndef HWUI_COMPILE_SYMBOLS
- LOCAL_CFLAGS += -fvisibility=hidden
- endif
+ ifdef HWUI_COMPILE_FOR_PERF
+ # TODO: Non-arm?
+ LOCAL_CFLAGS += -fno-omit-frame-pointer -marm -mapcs
+ endif
- ifdef HWUI_COMPILE_FOR_PERF
- LOCAL_CFLAGS += -fno-omit-frame-pointer -marm -mapcs
- endif
+ # Defaults for ATRACE_TAG and LOG_TAG for libhwui
+ LOCAL_CFLAGS += -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\"
- # 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
- include $(BUILD_SHARED_LIBRARY)
+ include $(BUILD_SHARED_LIBRARY)
- include $(call all-makefiles-under,$(LOCAL_PATH))
+ include $(call all-makefiles-under,$(LOCAL_PATH))
endif
diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp
index a998594..6fd0151 100644
--- a/libs/hwui/DeferredDisplayList.cpp
+++ b/libs/hwui/DeferredDisplayList.cpp
@@ -332,8 +332,8 @@ private:
class RestoreToCountBatch : public Batch {
public:
- RestoreToCountBatch(const StateOp* op, const DeferredDisplayState* state, int restoreCount) :
- mOp(op), mState(state), mRestoreCount(restoreCount) {}
+ RestoreToCountBatch(const StateOp* op, const DeferredDisplayState* state,
+ int restoreCount) : mState(state), mRestoreCount(restoreCount) {}
virtual status_t replay(OpenGLRenderer& renderer, Rect& dirty, int index) {
DEFER_LOGD("batch %p restoring to count %d", this, mRestoreCount);
@@ -345,7 +345,6 @@ public:
private:
// we use the state storage for the RestoreToCountOp, but don't replay the op itself
- const StateOp* mOp;
const DeferredDisplayState* mState;
/*
@@ -700,7 +699,6 @@ void DeferredDisplayList::discardDrawingBatches(const unsigned int maxIndex) {
for (unsigned int i = mEarliestUnclearedIndex; i <= maxIndex; i++) {
// leave deferred state ops alone for simplicity (empty save restore pairs may now exist)
if (mBatches[i] && mBatches[i]->purelyDrawBatch()) {
- DrawBatch* b = (DrawBatch*) mBatches[i];
delete mBatches[i];
mBatches.replaceAt(NULL, i);
}
diff --git a/libs/hwui/DeferredDisplayList.h b/libs/hwui/DeferredDisplayList.h
index 8a015b2..f7f30b1 100644
--- a/libs/hwui/DeferredDisplayList.h
+++ b/libs/hwui/DeferredDisplayList.h
@@ -79,7 +79,7 @@ public:
};
class DeferredDisplayList {
- friend class DeferStateStruct; // used to give access to allocator
+ friend struct DeferStateStruct; // used to give access to allocator
public:
DeferredDisplayList(const Rect& bounds, bool avoidOverdraw = true) :
mBounds(bounds), mAvoidOverdraw(avoidOverdraw) {
diff --git a/libs/hwui/DisplayList.h b/libs/hwui/DisplayList.h
index 7a43a2a..a9a9148 100644
--- a/libs/hwui/DisplayList.h
+++ b/libs/hwui/DisplayList.h
@@ -87,8 +87,7 @@ public:
}
};
-class DeferStateStruct : public PlaybackStateStruct {
-public:
+struct DeferStateStruct : public PlaybackStateStruct {
DeferStateStruct(DeferredDisplayList& deferredList, OpenGLRenderer& renderer, int replayFlags)
: PlaybackStateStruct(renderer, replayFlags, &(deferredList.mAllocator)),
mDeferredList(deferredList) {}
diff --git a/libs/hwui/DisplayListLogBuffer.cpp b/libs/hwui/DisplayListLogBuffer.cpp
index 45aacca..bc9e7bd 100644
--- a/libs/hwui/DisplayListLogBuffer.cpp
+++ b/libs/hwui/DisplayListLogBuffer.cpp
@@ -80,7 +80,7 @@ void DisplayListLogBuffer::outputCommands(FILE *file)
fprintf(file, "%*s%s\n", 2 * tmpBufferPtr->level, "", tmpBufferPtr->label);
- OpLog* nextOp = tmpBufferPtr++;
+ tmpBufferPtr++;
if (tmpBufferPtr > mBufferLast) {
tmpBufferPtr = mBufferFirst;
}
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index c2cb76e..42ac07e 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -178,7 +178,8 @@ bool DisplayListRenderer::clipRegion(const SkRegion* region, SkRegion::Op op) {
return StatefulBaseRenderer::clipRegion(region, op);
}
-status_t DisplayListRenderer::drawRenderNode(RenderNode* renderNode, Rect& dirty, int32_t flags) {
+status_t DisplayListRenderer::drawRenderNode(RenderNode* renderNode, Rect& dirty,
+ int32_t flags) {
LOG_ALWAYS_FATAL_IF(!renderNode, "missing rendernode");
// dirty is an out parameter and should not be recorded,
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index 3910381..5b5b098 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -358,7 +358,7 @@ void FontRenderer::cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyp
break;
}
case SkMask::kBW_Format: {
- uint32_t cacheX = 0, bX = 0, cacheY = 0, bY = 0;
+ uint32_t cacheX = 0, cacheY = 0;
uint32_t row = (startY - TEXTURE_BORDER_SIZE) * cacheWidth + startX
- TEXTURE_BORDER_SIZE;
static const uint8_t COLORS[2] = { 0, 255 };
diff --git a/libs/hwui/Interpolator.cpp b/libs/hwui/Interpolator.cpp
index ff8ff73..0e62d77 100644
--- a/libs/hwui/Interpolator.cpp
+++ b/libs/hwui/Interpolator.cpp
@@ -14,6 +14,10 @@
* 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"
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index 64d1d12..2d6a727 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -47,7 +47,7 @@ class RenderState;
class OpenGLRenderer;
class RenderNode;
class DeferredDisplayList;
-class DeferStateStruct;
+struct DeferStateStruct;
/**
* A layer has dimensions and is backed by an OpenGL texture or FBO.
diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp
index 3033dc6..3216cd2 100644
--- a/libs/hwui/LayerCache.cpp
+++ b/libs/hwui/LayerCache.cpp
@@ -80,8 +80,10 @@ int LayerCache::LayerEntry::compare(const LayerCache::LayerEntry& lhs,
void LayerCache::deleteLayer(Layer* layer) {
if (layer) {
- LAYER_LOGD("Destroying layer %dx%d, fbo %d", layer->getWidth(), layer->getHeight(),
- layer->getFbo());
+ if (kDebugLayers) {
+ ALOGD("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);
@@ -110,9 +112,13 @@ Layer* LayerCache::get(RenderState& renderState, const uint32_t width, const uin
layer->state = Layer::kState_RemovedFromCache;
mSize -= layer->getWidth() * layer->getHeight() * 4;
- LAYER_LOGD("Reusing layer %dx%d", layer->getWidth(), layer->getHeight());
+ if (kDebugLayers) {
+ ALOGD("Reusing layer %dx%d", layer->getWidth(), layer->getHeight());
+ }
} else {
- LAYER_LOGD("Creating new layer %dx%d", entry.mWidth, entry.mHeight);
+ if (kDebugLayers) {
+ ALOGD("Creating new layer %dx%d", entry.mWidth, entry.mHeight);
+ }
layer = new Layer(Layer::kType_DisplayList, renderState, entry.mWidth, entry.mHeight);
layer->setBlend(true);
@@ -137,7 +143,9 @@ void LayerCache::dump() {
size_t size = mCache.size();
for (size_t i = 0; i < size; i++) {
const LayerEntry& entry = mCache.itemAt(i);
- LAYER_LOGD(" Layer size %dx%d", entry.mWidth, entry.mHeight);
+ if (kDebugLayers) {
+ ALOGD(" Layer size %dx%d", entry.mWidth, entry.mHeight);
+ }
}
}
@@ -157,8 +165,10 @@ bool LayerCache::put(Layer* layer) {
deleteLayer(victim);
mCache.removeAt(position);
- LAYER_LOGD(" Deleting layer %.2fx%.2f", victim->layer.getWidth(),
- victim->layer.getHeight());
+ if (kDebugLayers) {
+ ALOGD(" 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 6b93e8f..81810ac 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -26,15 +26,11 @@ namespace uirenderer {
class RenderState;
-///////////////////////////////////////////////////////////////////////////////
-// Defines
-///////////////////////////////////////////////////////////////////////////////
-
// Debug
#if DEBUG_LAYERS
- #define LAYER_LOGD(...) ALOGD(__VA_ARGS__)
+static const bool kDebugLayers = true;
#else
- #define LAYER_LOGD(...)
+static const bool kDebugLayers = false;
#endif
///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/Matrix.cpp b/libs/hwui/Matrix.cpp
index 9f2014f..061d26a 100644
--- a/libs/hwui/Matrix.cpp
+++ b/libs/hwui/Matrix.cpp
@@ -203,6 +203,34 @@ void Matrix4::copyTo(SkMatrix& v) const {
}
void Matrix4::loadInverse(const Matrix4& v) {
+ // Fast case for common translation matrices
+ if (v.isPureTranslate()) {
+ // Reset the matrix
+ // Unnamed fields are never written to except by
+ // loadIdentity(), they don't need to be reset
+ data[kScaleX] = 1.0f;
+ data[kSkewX] = 0.0f;
+
+ data[kScaleY] = 1.0f;
+ data[kSkewY] = 0.0f;
+
+ data[kScaleZ] = 1.0f;
+
+ data[kPerspective0] = 0.0f;
+ data[kPerspective1] = 0.0f;
+ data[kPerspective2] = 1.0f;
+
+ // No need to deal with kTranslateZ because isPureTranslate()
+ // only returns true when the kTranslateZ component is 0
+ data[kTranslateX] = -v.data[kTranslateX];
+ data[kTranslateY] = -v.data[kTranslateY];
+ data[kTranslateZ] = 0.0f;
+
+ // A "pure translate" matrix can be identity or translation
+ mType = v.getType();
+ return;
+ }
+
double scale = 1.0 /
(v.data[kScaleX] * ((double) v.data[kScaleY] * v.data[kPerspective2] -
(double) v.data[kTranslateY] * v.data[kPerspective1]) +
@@ -212,18 +240,18 @@ void Matrix4::loadInverse(const Matrix4& v) {
(double) v.data[kScaleY] * v.data[kPerspective0]));
data[kScaleX] = (v.data[kScaleY] * v.data[kPerspective2] -
- v.data[kTranslateY] * v.data[kPerspective1]) * scale;
+ v.data[kTranslateY] * v.data[kPerspective1]) * scale;
data[kSkewX] = (v.data[kTranslateX] * v.data[kPerspective1] -
v.data[kSkewX] * v.data[kPerspective2]) * scale;
data[kTranslateX] = (v.data[kSkewX] * v.data[kTranslateY] -
- v.data[kTranslateX] * v.data[kScaleY]) * scale;
+ v.data[kTranslateX] * v.data[kScaleY]) * scale;
data[kSkewY] = (v.data[kTranslateY] * v.data[kPerspective0] -
v.data[kSkewY] * v.data[kPerspective2]) * scale;
data[kScaleY] = (v.data[kScaleX] * v.data[kPerspective2] -
- v.data[kTranslateX] * v.data[kPerspective0]) * scale;
+ v.data[kTranslateX] * v.data[kPerspective0]) * scale;
data[kTranslateY] = (v.data[kTranslateX] * v.data[kSkewY] -
- v.data[kScaleX] * v.data[kTranslateY]) * scale;
+ v.data[kScaleX] * v.data[kTranslateY]) * scale;
data[kPerspective0] = (v.data[kSkewY] * v.data[kPerspective1] -
v.data[kScaleY] * v.data[kPerspective0]) * scale;
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 6f1e8a2..355a31f 100755
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -402,6 +402,8 @@ void OpenGLRenderer::eventMarkDEBUG(const char* fmt, ...) const {
va_end(ap);
eventMark(buf);
+#else
+ (void)fmt;
#endif
}
@@ -457,7 +459,6 @@ void OpenGLRenderer::renderOverdraw() {
bool OpenGLRenderer::updateLayer(Layer* layer, bool inFrame) {
if (layer->deferredUpdateScheduled && layer->renderer
&& layer->renderNode.get() && layer->renderNode->isRenderable()) {
- Rect& dirty = layer->dirtyRect;
if (inFrame) {
endTiling();
@@ -736,8 +737,10 @@ int OpenGLRenderer::saveLayerDeferred(float left, float top, float right, float
*/
bool OpenGLRenderer::createLayer(float left, float top, float right, float bottom,
const SkPaint* paint, int flags, const SkPath* convexMask) {
- LAYER_LOGD("Requesting layer %.2fx%.2f", right - left, bottom - top);
- LAYER_LOGD("Layer cache size = %d", mCaches.layerCache.getSize());
+ if (kDebugLayers) {
+ ALOGD("Requesting layer %.2fx%.2f", right - left, bottom - top);
+ ALOGD("Layer cache size = %d", mCaches.layerCache.getSize());
+ }
const bool fboLayer = flags & SkCanvas::kClipToLayer_SaveFlag;
@@ -915,7 +918,9 @@ void OpenGLRenderer::composeLayer(const Snapshot& removed, const Snapshot& resto
// 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)) {
- LAYER_LOGD("Deleting layer");
+ if (kDebugLayers) {
+ ALOGD("Deleting layer");
+ }
layer->decStrong(0);
}
}
@@ -1931,8 +1936,6 @@ status_t OpenGLRenderer::drawRenderNode(RenderNode* renderNode, Rect& dirty, int
}
void OpenGLRenderer::drawAlphaBitmap(Texture* texture, float left, float top, const SkPaint* paint) {
- int color = paint != NULL ? paint->getColor() : 0;
-
float x = left;
float y = top;
@@ -2354,7 +2357,7 @@ status_t OpenGLRenderer::drawVertexBuffer(float translateX, float translateY,
setupDrawShaderUniforms(getShader(paint));
const void* vertices = vertexBuffer.getBuffer();
- bool force = mCaches.unbindMeshBuffer();
+ mCaches.unbindMeshBuffer();
mCaches.bindPositionVertexPointer(true, vertices, isAA ? gAlphaVertexStride : gVertexStride);
mCaches.resetTexCoordsVertexPointer();
@@ -3129,14 +3132,6 @@ status_t OpenGLRenderer::drawRects(const float* rects, int count, const SkPaint*
return drawColorRects(rects, count, paint, false, true, true);
}
-static void mapPointFakeZ(Vector3& point, const mat4& transformXY, const mat4& transformZ) {
- // map z coordinate with true 3d matrix
- point.z = transformZ.mapZ(point);
-
- // map x,y coordinates with draw/Skia matrix
- transformXY.mapPoint(point.x, point.y);
-}
-
status_t OpenGLRenderer::drawShadow(float casterAlpha,
const VertexBuffer* ambientShadowVertexBuffer, const VertexBuffer* spotShadowVertexBuffer) {
if (currentSnapshot()->isIgnored()) return DrawGlInfo::kStatusDone;
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp
index 6f48e4d..80f9c2f 100644
--- a/libs/hwui/PathCache.cpp
+++ b/libs/hwui/PathCache.cpp
@@ -212,7 +212,7 @@ void PathCache::removeTexture(PathTexture* texture) {
// before attempting our cleanup
const sp<Task<SkBitmap*> >& task = texture->task();
if (task != NULL) {
- SkBitmap* bitmap = task->getResult();
+ task->getResult();
texture->clearTask();
} else {
// If there is a pending task, the path was not added
diff --git a/libs/hwui/PathTessellator.cpp b/libs/hwui/PathTessellator.cpp
index 27ef06f..9f7dd50 100644
--- a/libs/hwui/PathTessellator.cpp
+++ b/libs/hwui/PathTessellator.cpp
@@ -279,7 +279,6 @@ void getStrokeVerticesFromUnclosedVertices(const PaintInfo& paintInfo,
- (vertices[lastIndex].x - vertices[lastIndex - 1].x),
vertices[lastIndex].y - vertices[lastIndex - 1].y);
const float dTheta = PI / (extra + 1);
- const float radialScale = 2.0f / (1 + cos(dTheta));
int capOffset;
for (int i = 0; i < extra; i++) {
@@ -290,14 +289,14 @@ void getStrokeVerticesFromUnclosedVertices(const PaintInfo& paintInfo,
}
beginTheta += dTheta;
- Vector2 beginRadialOffset = {cos(beginTheta), sin(beginTheta)};
+ Vector2 beginRadialOffset = {cosf(beginTheta), sinf(beginTheta)};
paintInfo.scaleOffsetForStrokeWidth(beginRadialOffset);
Vertex::set(&buffer[capOffset],
vertices[0].x + beginRadialOffset.x,
vertices[0].y + beginRadialOffset.y);
endTheta += dTheta;
- Vector2 endRadialOffset = {cos(endTheta), sin(endTheta)};
+ Vector2 endRadialOffset = {cosf(endTheta), sinf(endTheta)};
paintInfo.scaleOffsetForStrokeWidth(endRadialOffset);
Vertex::set(&buffer[allocSize - 1 - capOffset],
vertices[lastIndex].x + endRadialOffset.x,
@@ -468,7 +467,7 @@ inline static void storeCapAA(const PaintInfo& paintInfo, const Vector<Vertex>&
for (int i = 0; i < extra; i++) {
theta += dTheta;
- Vector2 radialOffset = {cos(theta), sin(theta)};
+ Vector2 radialOffset = {cosf(theta), sinf(theta)};
// scale to compensate for pinching at sharp angles, see totalOffsetFromNormals()
radialOffset *= radialScale;
@@ -831,7 +830,6 @@ void PathTessellator::tessellatePoints(const float* points, int count, const SkP
Rect bounds;
// tessellate, then duplicate outline across points
- int numPoints = count / 2;
VertexBuffer tempBuffer;
if (!paintInfo.isAA) {
getFillVerticesFromPerimeter(outlineVertices, tempBuffer);
diff --git a/libs/hwui/Program.h b/libs/hwui/Program.h
index d05b331..fc7d134 100644
--- a/libs/hwui/Program.h
+++ b/libs/hwui/Program.h
@@ -281,6 +281,8 @@ struct ProgramDescription {
programid k = key();
PROGRAM_LOGD("%s (key = 0x%.8x%.8x)", message, uint32_t(k >> 32),
uint32_t(k & 0xffffffff));
+#else
+ (void)message;
#endif
}
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index befed16..7b9459a 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -253,7 +253,7 @@ enum DebugLevel {
// Converts a number of kilo-bytes into bytes
#define KB(s) s * 1024
-static DebugLevel readDebugLevel() {
+static inline DebugLevel readDebugLevel() {
char property[PROPERTY_VALUE_MAX];
if (property_get(PROPERTY_DEBUG, property, NULL) > 0) {
return (DebugLevel) atoi(property);
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 787ee62..c993556 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -777,7 +777,6 @@ void RenderNode::issueOperationsOf3dChildren(ChildrenSelectMode mode,
int restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag);
DrawRenderNodeOp* childOp = zTranslatedNodes[drawIndex].value;
- RenderNode* child = childOp->mRenderNode;
renderer.concatMatrix(childOp->mTransformFromParent);
childOp->mSkipInOrderDraw = false; // this is horrible, I'm so sorry everyone
@@ -926,7 +925,7 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) {
initialTransform, zTranslatedNodes, renderer, handler);
- for (int opIndex = chunk.beginOpIndex; opIndex < chunk.endOpIndex; opIndex++) {
+ for (size_t opIndex = chunk.beginOpIndex; opIndex < chunk.endOpIndex; opIndex++) {
DisplayListOp *op = mDisplayListData->displayListOps[opIndex];
#if DEBUG_DISPLAY_LIST
op->output(level + 1);
@@ -934,7 +933,8 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) {
logBuffer.writeCommand(level, op->name());
handler(op, saveCountOffset, properties().getClipToBounds());
- if (CC_UNLIKELY(!mProjectedNodes.isEmpty() && opIndex == projectionReceiveIndex)) {
+ if (CC_UNLIKELY(!mProjectedNodes.isEmpty() && projectionReceiveIndex >= 0 &&
+ opIndex == static_cast<size_t>(projectionReceiveIndex))) {
issueOperationsOfProjectedChildren(renderer, handler);
}
}
diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp
index c1ffa0a..93d4b31 100644
--- a/libs/hwui/ShadowTessellator.cpp
+++ b/libs/hwui/ShadowTessellator.cpp
@@ -87,7 +87,6 @@ void ShadowTessellator::tessellateSpotShadow(bool isCasterOpaque,
reverseReceiverTransform.loadInverse(receiverTransform);
reverseReceiverTransform.mapPoint3d(adjustedLightCenter);
- const int lightVertexCount = 8;
if (CC_UNLIKELY(caches.propertyLightDiameter > 0)) {
lightRadius = caches.propertyLightDiameter;
}
diff --git a/libs/hwui/SkiaShader.h b/libs/hwui/SkiaShader.h
index 034c3f6..631305f 100644
--- a/libs/hwui/SkiaShader.h
+++ b/libs/hwui/SkiaShader.h
@@ -62,7 +62,8 @@ public:
// This shader is unsupported. Skip it.
}
static void setupProgram(Caches* caches, const mat4& modelViewMatrix,
- GLuint* textureUnit, const Extensions& extensions, const SkShader& shader) {
+ GLuint* textureUnit, const Extensions& extensions,
+ const SkShader& shader) {
// This shader is unsupported. Skip it.
}
diff --git a/libs/hwui/SpotShadow.cpp b/libs/hwui/SpotShadow.cpp
index b2dd899..3046fd5 100644
--- a/libs/hwui/SpotShadow.cpp
+++ b/libs/hwui/SpotShadow.cpp
@@ -797,11 +797,15 @@ inline void genNewPenumbraAndPairWithUmbra(const Vector2* penumbra, int penumbra
previousPenumbra * weightForPreviousPenumbra;
int skippedUmbraIndex = (previousClosestUmbraIndex + k + 1) % umbraLength;
- verticesPair[verticesPairIndex++] = {newPenumbraIndex, skippedUmbraIndex};
+ verticesPair[verticesPairIndex].outerIndex = newPenumbraIndex;
+ verticesPair[verticesPairIndex].innerIndex = skippedUmbraIndex;
+ verticesPairIndex++;
newPenumbra[newPenumbraIndex++] = interpolatedPenumbra;
}
}
- verticesPair[verticesPairIndex++] = {newPenumbraIndex, currentClosestUmbraIndex};
+ verticesPair[verticesPairIndex].outerIndex = newPenumbraIndex;
+ verticesPair[verticesPairIndex].innerIndex = currentClosestUmbraIndex;
+ verticesPairIndex++;
newPenumbra[newPenumbraIndex++] = currentPenumbraVertex;
previousClosestUmbraIndex = currentClosestUmbraIndex;
diff --git a/libs/hwui/StatefulBaseRenderer.h b/libs/hwui/StatefulBaseRenderer.h
index 745e48a..fcd6060 100644
--- a/libs/hwui/StatefulBaseRenderer.h
+++ b/libs/hwui/StatefulBaseRenderer.h
@@ -129,7 +129,8 @@ protected:
*
* Subclasses can override this method to handle layer restoration
*/
- virtual void onSnapshotRestored(const Snapshot& removed, const Snapshot& restored) {};
+ virtual void onSnapshotRestored(const Snapshot& removed,
+ const Snapshot& restored) {};
virtual void onViewportInitialized() {};
diff --git a/libs/hwui/TessellationCache.h b/libs/hwui/TessellationCache.h
index 688a699..7eca681 100644
--- a/libs/hwui/TessellationCache.h
+++ b/libs/hwui/TessellationCache.h
@@ -178,7 +178,8 @@ private:
// holds a pointer, and implicit strong ref to each shadow task of the frame
LruCache<ShadowDescription, Task<vertexBuffer_pair_t*>*> mShadowCache;
class BufferPairRemovedListener : public OnEntryRemoved<ShadowDescription, Task<vertexBuffer_pair_t*>*> {
- void operator()(ShadowDescription& description, Task<vertexBuffer_pair_t*>*& bufferPairTask) {
+ void operator()(ShadowDescription& description,
+ Task<vertexBuffer_pair_t*>*& bufferPairTask) {
bufferPairTask->decStrong(NULL);
}
};
diff --git a/libs/hwui/TextDropShadowCache.cpp b/libs/hwui/TextDropShadowCache.cpp
index 4eec462..96c09e6 100644
--- a/libs/hwui/TextDropShadowCache.cpp
+++ b/libs/hwui/TextDropShadowCache.cpp
@@ -40,7 +40,8 @@ hash_t ShadowText::hash() const {
hash = JenkinsHashMix(hash, android::hash_type(italicStyle));
hash = JenkinsHashMix(hash, android::hash_type(scaleX));
if (text) {
- hash = JenkinsHashMixShorts(hash, text, charCount);
+ hash = JenkinsHashMixShorts(
+ hash, reinterpret_cast<const uint16_t*>(text), charCount);
}
if (positions) {
for (uint32_t i = 0; i < charCount * 2; i++) {
diff --git a/libs/hwui/font/Font.cpp b/libs/hwui/font/Font.cpp
index af39f16..e1a38dd 100644
--- a/libs/hwui/font/Font.cpp
+++ b/libs/hwui/font/Font.cpp
@@ -139,7 +139,8 @@ void Font::invalidateTextureCache(CacheTexture* cacheTexture) {
}
void Font::measureCachedGlyph(CachedGlyphInfo *glyph, int x, int y,
- uint8_t* bitmap, uint32_t bitmapW, uint32_t bitmapH, Rect* bounds, const float* pos) {
+ uint8_t* bitmap, uint32_t bitmapW, uint32_t bitmapH, Rect* bounds,
+ const float* pos) {
int width = (int) glyph->mBitmapWidth;
int height = (int) glyph->mBitmapHeight;
@@ -161,7 +162,8 @@ void Font::measureCachedGlyph(CachedGlyphInfo *glyph, int x, int y,
}
void Font::drawCachedGlyph(CachedGlyphInfo* glyph, int x, int y,
- uint8_t* bitmap, uint32_t bitmapW, uint32_t bitmapH, Rect* bounds, const float* pos) {
+ uint8_t* bitmap, uint32_t bitmapW, uint32_t bitmapH, Rect* bounds,
+ const float* pos) {
float width = (float) glyph->mBitmapWidth;
float height = (float) glyph->mBitmapHeight;
@@ -180,7 +182,8 @@ void Font::drawCachedGlyph(CachedGlyphInfo* glyph, int x, int y,
}
void Font::drawCachedGlyphTransformed(CachedGlyphInfo* glyph, int x, int y,
- uint8_t* bitmap, uint32_t bitmapW, uint32_t bitmapH, Rect* bounds, const float* pos) {
+ uint8_t* bitmap, uint32_t bitmapW, uint32_t bitmapH, Rect* bounds,
+ const float* pos) {
float width = (float) glyph->mBitmapWidth;
float height = (float) glyph->mBitmapHeight;
@@ -210,7 +213,8 @@ void Font::drawCachedGlyphTransformed(CachedGlyphInfo* glyph, int x, int y,
}
void Font::drawCachedGlyphBitmap(CachedGlyphInfo* glyph, int x, int y, uint8_t* bitmap,
- uint32_t bitmapWidth, uint32_t bitmapHeight, Rect* bounds, const float* pos) {
+ uint32_t bitmapWidth, uint32_t bitmapHeight, Rect* bounds,
+ const float* pos) {
int dstX = x + glyph->mBitmapLeft;
int dstY = y + glyph->mBitmapTop;
@@ -378,7 +382,7 @@ void Font::precache(const SkPaint* paint, const char* text, int numGlyphs) {
break;
}
- CachedGlyphInfo* cachedGlyph = getCachedGlyph(paint, glyph, true);
+ getCachedGlyph(paint, glyph, true);
glyphsCount++;
}
}
@@ -403,8 +407,6 @@ void Font::render(const SkPaint* paint, const char* text, uint32_t start, uint32
text += start;
int glyphsCount = 0;
- const SkPaint::Align align = paint->getTextAlign();
-
while (glyphsCount < numGlyphs) {
glyph_t glyph = GET_GLYPH(text);
diff --git a/libs/hwui/font/FontUtil.h b/libs/hwui/font/FontUtil.h
index c2fd5f5..4e5debe 100644
--- a/libs/hwui/font/FontUtil.h
+++ b/libs/hwui/font/FontUtil.h
@@ -30,9 +30,12 @@
#define DEFAULT_TEXT_LARGE_CACHE_WIDTH 2048
#define DEFAULT_TEXT_LARGE_CACHE_HEIGHT 512
-#define TEXTURE_BORDER_SIZE 1
-#if TEXTURE_BORDER_SIZE != 1
-# error TEXTURE_BORDER_SIZE other than 1 is not currently supported
+#ifdef TEXTURE_BORDER_SIZE
+ #if TEXTURE_BORDER_SIZE != 1
+ #error TEXTURE_BORDER_SIZE other than 1 is not currently supported
+ #endif
+#else
+ #define TEXTURE_BORDER_SIZE 1
#endif
#define CACHE_BLOCK_ROUNDING_SIZE 4
@@ -44,7 +47,7 @@
#define GET_GLYPH(text) nextGlyph((const uint16_t**) &text)
#define IS_END_OF_STRING(glyph) false
- static glyph_t nextGlyph(const uint16_t** srcPtr) {
+ static inline glyph_t nextGlyph(const uint16_t** srcPtr) {
const uint16_t* src = *srcPtr;
glyph_t g = *src++;
*srcPtr = src;
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 75bd067..b7e1752 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -128,8 +128,8 @@ bool CanvasContext::pauseSurface(ANativeWindow* window) {
}
// TODO: don't pass viewport size, it's automatic via EGL
-void CanvasContext::setup(int width, int height, const Vector3& lightCenter, float lightRadius,
- uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) {
+void CanvasContext::setup(int width, int height, const Vector3& lightCenter,
+ float lightRadius, uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) {
if (!mCanvas) return;
mCanvas->initLight(lightCenter, lightRadius, ambientShadowAlpha, spotShadowAlpha);
}
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 6d063a4..36ba3a9 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -339,13 +339,19 @@ void RenderProxy::trimMemory(int level) {
}
}
+template <typename T>
+void UNUSED(T) {}
+
+
CREATE_BRIDGE0(fence) {
// Intentionally empty
+ UNUSED(args);
return NULL;
}
void RenderProxy::fence() {
SETUP_TASK(fence);
+ UNUSED(args);
postAndWait(task);
}
diff --git a/libs/hwui/renderthread/RenderTask.cpp b/libs/hwui/renderthread/RenderTask.cpp
index 7ca61e4..13970ba 100644
--- a/libs/hwui/renderthread/RenderTask.cpp
+++ b/libs/hwui/renderthread/RenderTask.cpp
@@ -14,6 +14,10 @@
* 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"
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 84826b7..37e11d8 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -16,10 +16,8 @@
#include "RenderThread.h"
-#if defined(HAVE_PTHREADS)
-#include <sys/resource.h>
-#endif
#include <gui/DisplayEventReceiver.h>
+#include <sys/resource.h>
#include <utils/Log.h>
#include "../RenderState.h"
@@ -250,9 +248,7 @@ void RenderThread::requestVsync() {
}
bool RenderThread::threadLoop() {
-#if defined(HAVE_PTHREADS)
setpriority(PRIO_PROCESS, 0, PRIORITY_DISPLAY);
-#endif
initThreadLocals();
int timeoutMillis = -1;
diff --git a/libs/hwui/tests/main.cpp b/libs/hwui/tests/main.cpp
index 2d99e9f..d847d13 100644
--- a/libs/hwui/tests/main.cpp
+++ b/libs/hwui/tests/main.cpp
@@ -66,7 +66,7 @@ sp<RenderNode> createCard(int x, int y, int width, int height) {
return node;
}
-int main(int argc, char* argv[]) {
+int main() {
createTestEnvironment();
// create the native surface
@@ -111,7 +111,7 @@ int main(int argc, char* argv[]) {
for (int i = 0; i < 150; i++) {
ATRACE_NAME("UI-Draw Frame");
- for (int ci = 0; ci < cards.size(); ci++) {
+ for (size_t ci = 0; ci < cards.size(); ci++) {
cards[ci]->mutateStagingProperties().setTranslationX(i);
cards[ci]->mutateStagingProperties().setTranslationY(i);
cards[ci]->setPropertyFieldsDirty(RenderNode::X | RenderNode::Y);
diff --git a/libs/hwui/thread/TaskManager.cpp b/libs/hwui/thread/TaskManager.cpp
index cb5401c..3c30aab 100644
--- a/libs/hwui/thread/TaskManager.cpp
+++ b/libs/hwui/thread/TaskManager.cpp
@@ -14,10 +14,8 @@
* limitations under the License.
*/
-#include <sys/sysinfo.h>
-#if defined(HAVE_PTHREADS)
#include <sys/resource.h>
-#endif
+#include <sys/sysinfo.h>
#include "TaskManager.h"
#include "Task.h"
@@ -83,9 +81,7 @@ bool TaskManager::addTaskBase(const sp<TaskBase>& task, const sp<TaskProcessorBa
///////////////////////////////////////////////////////////////////////////////
status_t TaskManager::WorkerThread::readyToRun() {
-#if defined(HAVE_PTHREADS)
setpriority(PRIO_PROCESS, 0, PRIORITY_FOREGROUND);
-#endif
return NO_ERROR;
}