Bug 988793 - Make DocumentRendererChild::RenderDocument use Moz2D. r=mattwoodrow

This commit is contained in:
Jonathan Watt 2014-03-31 12:52:33 +01:00
parent a1c8f47ffe
commit 0831821e03

View File

@ -7,8 +7,9 @@
#include "base/basictypes.h"
#include "gfx2DGlue.h"
#include "gfxImageSurface.h"
#include "gfxPattern.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/RefPtr.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMWindow.h"
#include "nsIDocShell.h"
@ -26,6 +27,7 @@
#include "mozilla/gfx/Matrix.h"
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::ipc;
DocumentRendererChild::DocumentRendererChild()
@ -72,12 +74,13 @@ DocumentRendererChild::RenderDocument(nsIDOMWindow *window,
// Draw directly into the output array.
data.SetLength(renderSize.width * renderSize.height * 4);
nsRefPtr<gfxImageSurface> surf =
new gfxImageSurface(reinterpret_cast<uint8_t*>(data.BeginWriting()),
gfxIntSize(renderSize.width, renderSize.height),
4 * renderSize.width,
gfxImageFormat::ARGB32);
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
RefPtr<DrawTarget> dt =
Factory::CreateDrawTargetForData(BackendType::CAIRO,
reinterpret_cast<uint8_t*>(data.BeginWriting()),
IntSize(renderSize.width, renderSize.height),
4 * renderSize.width,
SurfaceFormat::B8G8R8A8);
nsRefPtr<gfxContext> ctx = new gfxContext(dt);
ctx->SetMatrix(mozilla::gfx::ThebesMatrix(transform));
nsCOMPtr<nsIPresShell> shell = presContext->PresShell();