Bug 715894 - Only draw dirty rect when using gralloc textures r=clord
authorJames Willcox <jwillcox@mozilla.com>
Fri, 06 Jan 2012 12:25:05 -0500
changeset 85168 42550933b54b662ca482e82ebfe33e26748be19b
parent 85167 f70cf8170972fd502b2c9b3e9cc92f69fa8d3e77
child 85169 4083764d3c63f35bc1a08832a83717f4b72e2217
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)
reviewersclord
bugs715894
milestone12.0a1
Bug 715894 - Only draw dirty rect when using gralloc textures r=clord
widget/android/nsWindow.cpp
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1198,17 +1198,17 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae)
     nsAutoString metadata;
     unsigned char *bits = NULL;
     if (sHasDirectTexture) {
       if (sDirectTexture->Width() != gAndroidBounds.width ||
           sDirectTexture->Height() != gAndroidBounds.height) {
         sDirectTexture->Reallocate(gAndroidBounds.width, gAndroidBounds.height);
       }
 
-      sDirectTexture->Lock(AndroidGraphicBuffer::UsageSoftwareWrite, &bits);
+      sDirectTexture->Lock(AndroidGraphicBuffer::UsageSoftwareWrite, ae->Rect(), &bits);
     } else {
       bits = client.LockBufferBits();
     }
     if (!bits) {
         ALOG("### Failed to lock buffer");
     } else {
         // If tile size is 0,0, we assume we only have a single tile
         int tileWidth = (gAndroidTileSize.width > 0) ? gAndroidTileSize.width : gAndroidBounds.width;
@@ -1230,23 +1230,18 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae)
 
                 offset += width * height * 2;
 
                 if (targetSurface->CairoStatus()) {
                     ALOG("### Failed to create a valid surface from the bitmap");
                     drawSuccess = false;
                     break;
                 } else {
-                    if (sHasDirectTexture) {
-                        // XXX: lock only the dirty rect above and pass it in here
-                        DrawTo(targetSurface);
-                    } else {
-                        targetSurface->SetDeviceOffset(gfxPoint(-x, -y));
-                        DrawTo(targetSurface, ae->Rect());
-                    }
+                    targetSurface->SetDeviceOffset(gfxPoint(-x, -y));
+                    DrawTo(targetSurface, ae->Rect());
                 }
             }
         }
 
         // Don't fill in the draw metadata on an unsuccessful draw
         if (drawSuccess && metadataProvider) {
             metadataProvider->GetDrawMetadata(metadata);
         }