summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Layer.h
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2013-04-04 12:27:54 -0700
committerRomain Guy <romainguy@google.com>2013-04-04 12:27:54 -0700
commit0908764b2b3cf5075df4178a5f0a8547dcb7b317 (patch)
treec69db8d815ad1d0b0172e7a20827254627800dad /libs/hwui/Layer.h
parentdf1dc28ba0c63b195016ad0453fc58025ee82acb (diff)
downloadframeworks_base-0908764b2b3cf5075df4178a5f0a8547dcb7b317.zip
frameworks_base-0908764b2b3cf5075df4178a5f0a8547dcb7b317.tar.gz
frameworks_base-0908764b2b3cf5075df4178a5f0a8547dcb7b317.tar.bz2
First OpenGL ES 3.0 based optimization
This change uses a new OpenGL ES 3.0 feature to upload less data when the font cache needs to be update. This can result in significant performance improvements on device with large textures or with locales that use a lot of glyphs (CJK for instance.) This change also fixes various unpack alignment issues. The unpack alignment, as well as the unpack row length, is not texture specific but a global state that affect all glTex/SubImage2D calls. Some of them were missing the appropriate glPixelStorei() call. This could result in corrupted textures. Change-Id: Iefb429d4d0d0b4e0faeadf27daafee6d30a21d85
Diffstat (limited to 'libs/hwui/Layer.h')
-rw-r--r--libs/hwui/Layer.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index 27e0cf1..715dfa4 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -255,13 +255,14 @@ struct Layer {
texture.id = 0;
}
- inline void allocateTexture(GLenum format, GLenum storage) {
+ inline void allocateTexture() {
#if DEBUG_LAYERS
ALOGD(" Allocate layer: %dx%d", getWidth(), getHeight());
#endif
if (texture.id) {
- glTexImage2D(renderTarget, 0, format, getWidth(), getHeight(), 0,
- format, storage, NULL);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+ glTexImage2D(renderTarget, 0, GL_RGBA, getWidth(), getHeight(), 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
}
}