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 85806 c645bbfc747563fa469d07d78d39a97ef6a7b92c
parent 85805 c654ab313a6d00b408344e68ed494ece98bfc9f8
child 85807 0cbdbe1c65134a9a9fe2dd7f266c9951d21fc68b
push id21960
push userbmo@edmorley.co.uk
push dateTue, 31 Jan 2012 10:53:23 +0000
treeherdermozilla-central@060de47a1822 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs719136
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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)),