Bug 963962 - Fix use of CreateDrawTargetForData in CanvasLayerD3D9/10. r=Bas, a=sledru
authorJeff Gilbert <jgilbert@mozilla.com>
Mon, 07 Apr 2014 10:24:14 -0400
changeset 191625 30c27cdcf4006765c2f813a04321076c7b81323b
parent 191624 b9e157748afbef3273973e2942885c0f1ec0fa7a
child 191626 362dc8525345e6988e486f64fd791c4689e626bd
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, sledru
bugs963962
milestone30.0a2
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
@@ -140,19 +140,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
@@ -94,19 +94,20 @@ 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();
+  IntSize boundsSize(mBounds.width, mBounds.height);
   RefPtr<DrawTarget> rectDt = Factory::CreateDrawTargetForData(BackendType::CAIRO,
                                                                (uint8_t*)rect.pBits,
-                                                               surface->GetSize(),
+                                                               boundsSize,
                                                                rect.Pitch,
                                                                SurfaceFormat::B8G8R8A8);
 
   Rect drawRect(0, 0, surface->GetSize().width, surface->GetSize().height);
   rectDt->DrawSurface(surface, drawRect, drawRect,
                       DrawSurfaceOptions(),  DrawOptions(1.0F, CompositionOp::OP_SOURCE));
   rectDt->Flush();
 }