diff options
| author | 2013-03-28 11:32:33 -0700 | |
|---|---|---|
| committer | 2013-03-28 11:32:33 -0700 | |
| commit | ce4a7dfc516ee61301e9af91fad17ca1320efaab (patch) | |
| tree | 3e0cfe4e2be851d15a5e240c4983ea5ecff1513b /libs/hwui/Layer.cpp | |
| parent | 4500a8d5d7fbec9dba5e693212da160849e401ff (diff) | |
Don't crash when making a layer larger than supported dimensions
Bug #8437401
A misplaced ref count decrement was causing a crash when attempting to
resize a layer to dimensions larger than the max texture size supported
by the GPU.
This change fixes the crash and clarifies the warnings to make it more
obvious what's happening.
Change-Id: I632dc1b90aaa2605969e10523491a81c4922d3dc
Diffstat (limited to 'libs/hwui/Layer.cpp')
| -rw-r--r-- | libs/hwui/Layer.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index 2998535c9916..7f4977adbb80 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -75,6 +75,13 @@ bool Layer::resize(const uint32_t width, const uint32_t height) { return true; } + const uint32_t maxTextureSize = Caches::getInstance().maxTextureSize; + if (desiredWidth > maxTextureSize || desiredHeight > maxTextureSize) { + ALOGW("Layer exceeds max. dimensions supported by the GPU (%dx%d, max=%dx%d)", + desiredWidth, desiredHeight, maxTextureSize, maxTextureSize); + return false; + } + uint32_t oldWidth = getWidth(); uint32_t oldHeight = getHeight(); |