From ca99fb8f65f3ea249c56fb6dccefffb54e87696e Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 14 Apr 2010 16:43:44 -0700 Subject: fix [2594950] Flash: Zooming in on some content crashes the Nexus One and causes it to reboot (runtime restart) We now limit the size of the surface to the maximum size supported by the GPU. On Nexus One this will 2048 -- it could be different on other devices. Surface creation fails if the limit is exceeded. Change-Id: I9ecfc2e9c58c9e283782b61ebfc6b590f71df785 --- libs/surfaceflinger/Layer.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'libs/surfaceflinger/Layer.cpp') diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index 4dc4a153e0..0a3254dec5 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -41,6 +41,10 @@ namespace android { +template inline T min(T a, T b) { + return amaxSurfaceDims) || (uint32_t(h)>maxSurfaceDims)) { + return BAD_VALUE; + } + PixelFormatInfo displayInfo; getPixelFormatInfo(hw.getFormat(), &displayInfo); const uint32_t hwFlags = hw.getFlags(); mFormat = format; - mWidth = w; + mWidth = w; mHeight = h; mSecure = (flags & ISurfaceComposer::eSecure) ? true : false; mNeedsBlending = (info.h_alpha - info.l_alpha) > 0; mNoEGLImageForSwBuffers = !(hwFlags & DisplayHardware::CACHED_BUFFERS); - + // we use the red index int displayRedSize = displayInfo.getSize(PixelFormatInfo::INDEX_RED); int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED); -- cgit v1.2.3-59-g8ed1b