summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/LayerCache.cpp2
-rw-r--r--libs/hwui/LayerCache.h6
-rw-r--r--libs/hwui/OpenGLRenderer.cpp8
-rw-r--r--libs/hwui/Properties.h6
4 files changed, 12 insertions, 10 deletions
diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp
index 0af017787305..52981259336e 100644
--- a/libs/hwui/LayerCache.cpp
+++ b/libs/hwui/LayerCache.cpp
@@ -162,7 +162,7 @@ bool LayerCache::put(Layer* layer) {
// TODO: Use an LRU
while (mSize + size > mMaxSize) {
size_t position = 0;
-#if LAYER_REMOVE_BIGGEST
+#if LAYER_REMOVE_BIGGEST_FIRST
position = mCache.size() - 1;
#endif
Layer* victim = mCache.itemAt(position).mLayer;
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h
index 63bb824c1281..c14c9caa9a5a 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -19,6 +19,7 @@
#include "Debug.h"
#include "Layer.h"
+#include "Properties.h"
#include "utils/SortedList.h"
namespace android {
@@ -28,11 +29,6 @@ namespace uirenderer {
// Defines
///////////////////////////////////////////////////////////////////////////////
-// Indicates whether to remove the biggest layers first, or the smaller ones
-#define LAYER_REMOVE_BIGGEST 0
-// Textures used by layers must have dimensions multiples of this number
-#define LAYER_SIZE 64
-
// Debug
#if DEBUG_LAYERS
#define LAYER_LOGD(...) LOGD(__VA_ARGS__)
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index a0f806a209ba..e89d6ecd469f 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1476,10 +1476,10 @@ void OpenGLRenderer::drawBitmap(SkBitmap* bitmap,
const float width = texture->width;
const float height = texture->height;
- const float u1 = (srcLeft + 0.5f) / width;
- const float v1 = (srcTop + 0.5f) / height;
- const float u2 = (srcRight - 0.5f) / width;
- const float v2 = (srcBottom - 0.5f) / height;
+ const float u1 = fmax(0.0f, srcLeft / width);
+ const float v1 = fmax(0.0f, srcTop / height);
+ const float u2 = fmin(1.0f, srcRight / width);
+ const float v2 = fmin(1.0f, srcBottom / height);
mCaches.unbindMeshBuffer();
resetDrawTextureTexCoords(u1, v1, u2, v2);
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index 923978f67d7a..5bd0d4ffd217 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -31,6 +31,12 @@
// If turned on, text is interpreted as glyphs instead of UTF-16
#define RENDER_TEXT_AS_GLYPHS 1
+// Indicates whether to remove the biggest layers first, or the smaller ones
+#define LAYER_REMOVE_BIGGEST_FIRST 0
+
+// Textures used by layers must have dimensions multiples of this number
+#define LAYER_SIZE 64
+
/**
* Debug level for app developers.
*/