Fix texture coordinates for sub-bitmap rendering.
Change-Id: I05a31775e03f5b223a55a5144d420351abac89be
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 8cf325b..8e9e8be 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1369,10 +1369,10 @@
const float width = texture->width;
const float height = texture->height;
- const float u1 = srcLeft / width;
- const float v1 = srcTop / height;
- const float u2 = srcRight / width;
- const float v2 = srcBottom / 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;
mCaches.unbindMeshBuffer();
resetDrawTextureTexCoords(u1, v1, u2, v2);