OSDN Git Service

fix a crasher in surfaceflinger
authorMathias Agopian <mathias@google.com>
Wed, 3 Aug 2011 01:29:51 +0000 (18:29 -0700)
committerMathias Agopian <mathias@google.com>
Wed, 3 Aug 2011 01:29:57 +0000 (18:29 -0700)
this would happen if being told to draw before a buffer
was available.

Change-Id: I46d121c73e883078cdbf952063e38b0076f79038

services/surfaceflinger/Layer.cpp

index 32f300f..383c045 100644 (file)
@@ -227,8 +227,13 @@ void Layer::setPerFrameData(hwc_layer_t* hwcl) {
     } else {
         hwcl->sourceCrop.left   = 0;
         hwcl->sourceCrop.top    = 0;
-        hwcl->sourceCrop.right  = buffer->width;
-        hwcl->sourceCrop.bottom = buffer->height;
+        if (buffer != NULL) {
+            hwcl->sourceCrop.right  = buffer->width;
+            hwcl->sourceCrop.bottom = buffer->height;
+        } else {
+            hwcl->sourceCrop.right  = mTransformedBounds.width();
+            hwcl->sourceCrop.bottom = mTransformedBounds.height();
+        }
     }
 }