From 0d338d7e193de6a57ab6681a2ff13c0fdb74215c Mon Sep 17 00:00:00 2001 From: Andreas Pehrson Date: Mon, 13 Jan 2014 20:06:22 +0100 Subject: [PATCH] Bug 877115 - Moz2Dify CanvasLayerD3D10 drawing shared surface into D3D10_MAPPED_TEXTURE2D. r=nical --- gfx/layers/d3d10/CanvasLayerD3D10.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/gfx/layers/d3d10/CanvasLayerD3D10.cpp b/gfx/layers/d3d10/CanvasLayerD3D10.cpp index f719eaf51273..3cb94d181f72 100644 --- a/gfx/layers/d3d10/CanvasLayerD3D10.cpp +++ b/gfx/layers/d3d10/CanvasLayerD3D10.cpp @@ -166,25 +166,17 @@ CanvasLayerD3D10::UpdateSurface() } DataSourceSurface* frameData = shareSurf->GetData(); - // Scope for gfxContext, so it's destroyed before Unmap. + // Scope for DrawTarget, so it's destroyed before Unmap. { RefPtr mapDt = Factory::CreateDrawTargetForData(BackendType::CAIRO, (uint8_t*)map.pData, - shareSurf->Size(), + frameData->GetSize(), map.RowPitch, SurfaceFormat::B8G8R8A8); - nsRefPtr thebesFrameData = - new gfxImageSurface(frameData->GetData(), - ThebesIntSize(frameData->GetSize()), - frameData->Stride(), - SurfaceFormatToImageFormat(frameData->GetFormat())); - - nsRefPtr ctx = new gfxContext(mapDt); - ctx->SetOperator(gfxContext::OPERATOR_SOURCE); - ctx->SetSource(thebesFrameData); - ctx->Paint(); - + Rect drawRect(0, 0, frameData->GetSize().width, frameData->GetSize().height); + mapDt->DrawSurface(frameData, drawRect, drawRect, + DrawSurfaceOptions(), DrawOptions(1.0F, CompositionOp::OP_SOURCE)); mapDt->Flush(); }