Bug 719136: Don't attempt to upload when there's nothing to upload. r=jrmuizel
authorBas Schouten <bschouten@mozilla.com>
Tue, 31 Jan 2012 06:15:23 +0100
changeset 87031 c645bbfc747563fa469d07d78d39a97ef6a7b92c
parent 87030 c654ab313a6d00b408344e68ed494ece98bfc9f8
child 87032 0cbdbe1c65134a9a9fe2dd7f266c9951d21fc68b
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs719136
milestone12.0a1
Bug 719136: Don't attempt to upload when there's nothing to upload. r=jrmuizel
gfx/2d/DrawTargetD2D.cpp
--- a/gfx/2d/DrawTargetD2D.cpp
+++ b/gfx/2d/DrawTargetD2D.cpp
@@ -1980,16 +1980,22 @@ DrawTargetD2D::CreatePartialBitmapForSur
   rect.RoundOut();
 
   Rect uploadRect(0, 0, aSurface->mSize.width, aSurface->mSize.height);
 
   // Calculate the rectangle on the source bitmap that touches our
   // surface.
   uploadRect = uploadRect.Intersect(rect);
 
+  if (uploadRect.IsEmpty()) {
+    // This bitmap does not cover anything on the screen. XXX -
+    // we need to deal with EXTEND modes here!
+    return NULL;
+  }
+
   if (uploadRect.width <= mRT->GetMaximumBitmapSize() &&
       uploadRect.height <= mRT->GetMaximumBitmapSize()) {
             
     int Bpp = BytesPerPixel(aSurface->mFormat);
     int stride = Bpp * aSurface->mSize.width;
 
     // A partial upload will suffice.
     mRT->CreateBitmap(D2D1::SizeU(uint32_t(uploadRect.width), uint32_t(uploadRect.height)),