Bug 963962 - Fix use of CreateDrawTargetForData in CanvasLayerD3D9/10. r=Bas, a=sledru
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 09 Apr 2014 14:15:06 -0700
changeset 183692 635f912b3164
parent 183691 44a94313968a
child 183693 1244d500650c
push id3448
push userjgilbert@mozilla.com
push date2014-04-09 21:15 +0000
treeherdermozilla-beta@635f912b3164 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, sledru
bugs963962
milestone29.0
Bug 963962 - Fix use of CreateDrawTargetForData in CanvasLayerD3D9/10. r=Bas, a=sledru
gfx/layers/d3d10/CanvasLayerD3D10.cpp
gfx/layers/d3d9/CanvasLayerD3D9.cpp
--- a/gfx/layers/d3d10/CanvasLayerD3D10.cpp
+++ b/gfx/layers/d3d10/CanvasLayerD3D10.cpp
@@ -159,19 +159,20 @@ CanvasLayerD3D10::UpdateSurface()
         if (FAILED(hr)) {
           NS_WARNING("Failed to map CanvasLayer texture.");
           return;
         }
 
         DataSourceSurface* frameData = shareSurf->GetData();
         // Scope for DrawTarget, so it's destroyed before Unmap.
         {
+          IntSize boundsSize(mBounds.width, mBounds.height);
           RefPtr<DrawTarget> mapDt = Factory::CreateDrawTargetForData(BackendType::CAIRO,
                                                                       (uint8_t*)map.pData,
-                                                                      frameData->GetSize(),
+                                                                      boundsSize,
                                                                       map.RowPitch,
                                                                       SurfaceFormat::B8G8R8A8);
 
           Rect drawRect(0, 0, frameData->GetSize().width, frameData->GetSize().height);
           mapDt->DrawSurface(frameData, drawRect, drawRect,
                              DrawSurfaceOptions(),  DrawOptions(1.0F, CompositionOp::OP_SOURCE));
           mapDt->Flush();
         }
--- a/gfx/layers/d3d9/CanvasLayerD3D9.cpp
+++ b/gfx/layers/d3d9/CanvasLayerD3D9.cpp
@@ -95,23 +95,24 @@ CanvasLayerD3D9::UpdateSurface()
     // WebGL reads entire surface.
     LockTextureRectD3D9 textureLock(mTexture);
     if (!textureLock.HasLock()) {
       NS_WARNING("Failed to lock CanvasLayer texture.");
       return;
     }
 
     D3DLOCKED_RECT rect = textureLock.GetLockRect();
-    
+
     DataSourceSurface* frameData = shareSurf->GetData();
     // Scope for DrawTarget, so it's destroyed early.
     {
+      IntSize boundsSize(mBounds.width, mBounds.height);
       RefPtr<DrawTarget> rectDt = Factory::CreateDrawTargetForData(BackendType::CAIRO,
                                                                    (uint8_t*)rect.pBits,
-                                                                   frameData->GetSize(),
+                                                                   boundsSize,
                                                                    rect.Pitch,
                                                                    SurfaceFormat::B8G8R8A8);
 
       Rect drawRect(0, 0, frameData->GetSize().width, frameData->GetSize().height);
       rectDt->DrawSurface(frameData, drawRect, drawRect,
                           DrawSurfaceOptions(),  DrawOptions(1.0F, CompositionOp::OP_SOURCE));
       rectDt->Flush();
     }
@@ -183,17 +184,17 @@ CanvasLayerD3D9::RenderLayer()
     return;
   }
   FireDidTransactionCallback();
 
   if (!mTexture)
     return;
 
   /*
-   * We flip the Y axis here, note we can only do this because we are in 
+   * We flip the Y axis here, note we can only do this because we are in
    * CULL_NONE mode!
    */
 
   ShaderConstantRect quad(0, 0, mBounds.width, mBounds.height);
   if (mNeedsYFlip) {
     quad.mHeight = (float)-mBounds.height;
     quad.mY = (float)mBounds.height;
   }