summaryrefslogtreecommitdiffstats
path: root/libs/hwui/TextDropShadowCache.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2013-04-08 19:40:31 -0700
committerRomain Guy <romainguy@google.com>2013-04-11 14:07:34 -0700
commitcf51a4199835e9604aa4c8b3854306f8fbabbf33 (patch)
tree9f5095c3243d0e5dc367c613eee01db80472f1a0 /libs/hwui/TextDropShadowCache.cpp
parentf8a67f4f5dd4c5499a6e7148331f0286e31203ec (diff)
downloadframeworks_base-cf51a4199835e9604aa4c8b3854306f8fbabbf33.zip
frameworks_base-cf51a4199835e9604aa4c8b3854306f8fbabbf33.tar.gz
frameworks_base-cf51a4199835e9604aa4c8b3854306f8fbabbf33.tar.bz2
Introduce PixelBuffer API to enable PBOs
PBOs (Pixel Buffer Objects) can be used on OpenGL ES 3.0 to perform asynchronous texture uploads to free up the CPU. This change does not enable the use of PBOs unless a specific property is set (Adreno drivers have issues with PBOs at the moment, Mali drivers work just fine.) This change also cleans up Font/FontRenderer a little bit and improves performance of drop shadows generations by using memcpy() instead of a manual byte-by-byte copy. On GL ES 2.0 devices, or when PBOs are disabled, a PixelBuffer instance behaves like a simple byte array. The extra APIs introduced for PBOs (map/unmap and bind/unbind) are pretty much no-ops for CPU pixel buffers and won't introduce any significant overhead. This change also fixes a bug with text drop shadows: if the drop shadow is larger than the max texture size, the renderer would leave the GL context in a bad state and generate 0x501 errors. This change simply skips drop shadows if they are too large. Change-Id: I2700aadb0c6093431dc5dee3d587d689190c4e23
Diffstat (limited to 'libs/hwui/TextDropShadowCache.cpp')
-rw-r--r--libs/hwui/TextDropShadowCache.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/hwui/TextDropShadowCache.cpp b/libs/hwui/TextDropShadowCache.cpp
index f1f35bd..6976eaa 100644
--- a/libs/hwui/TextDropShadowCache.cpp
+++ b/libs/hwui/TextDropShadowCache.cpp
@@ -178,6 +178,10 @@ ShadowTexture* TextDropShadowCache::get(SkPaint* paint, const char* text, uint32
FontRenderer::DropShadow shadow = mRenderer->renderDropShadow(&paintCopy, text, 0,
len, numGlyphs, radius, positions);
+ if (!shadow.image) {
+ return NULL;
+ }
+
texture = new ShadowTexture;
texture->left = shadow.penX;
texture->top = shadow.penY;