summaryrefslogtreecommitdiff
path: root/libs/hwui/Caches.cpp
diff options
context:
space:
mode:
author Chris Craik <ccraik@android.com> 2014-06-16 23:37:12 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2014-06-16 22:13:20 +0000
commit0d28bb47d771a2ac99cec6e4a071a98d2cd705dd (patch)
tree9498ed5f334444da66df25d34e47f6c9952eb5df /libs/hwui/Caches.cpp
parent5e7ef9489f3247c02395202d88fb4fb425aa8412 (diff)
parent4a473c7d9406a2d6f6792f0f48d933424740ec5c (diff)
Merge "Fix the texture ID reuse issue in HWUI."
Diffstat (limited to 'libs/hwui/Caches.cpp')
-rw-r--r--libs/hwui/Caches.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index f8d3589168b6..b0f4c2c7189d 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -554,11 +554,8 @@ void Caches::deleteTexture(GLuint texture) {
// call, any texture operation will be performed on the default
// texture (name=0)
- for (int i = 0; i < REQUIRED_TEXTURE_UNITS_COUNT; i++) {
- if (mBoundTextures[i] == texture) {
- mBoundTextures[i] = 0;
- }
- }
+ unbindTexture(texture);
+
glDeleteTextures(1, &texture);
}
@@ -566,6 +563,14 @@ void Caches::resetBoundTextures() {
memset(mBoundTextures, 0, REQUIRED_TEXTURE_UNITS_COUNT * sizeof(GLuint));
}
+void Caches::unbindTexture(GLuint texture) {
+ for (int i = 0; i < REQUIRED_TEXTURE_UNITS_COUNT; i++) {
+ if (mBoundTextures[i] == texture) {
+ mBoundTextures[i] = 0;
+ }
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// Scissor
///////////////////////////////////////////////////////////////////////////////