From c0689e1446cec698727e2377a2bf77b6c1a37d10 Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Tue, 28 Feb 2012 04:02:21 +0100 Subject: [PATCH] Bug 729116: Try our best to have a valid mTarget even when having an invalid context. r=joe --- content/canvas/src/nsCanvasRenderingContext2DAzure.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp index 0f4c4390ca4..c96362ab625 100644 --- a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp @@ -1306,6 +1306,10 @@ nsCanvasRenderingContext2DAzure::InitializeWithTarget(DrawTarget *target, PRInt3 mTarget = target; } else { mValid = false; + // Create a dummy target in the hopes that it will help us deal with users + // calling into us after having changed the size where the size resulted + // in an inability to create a correct DrawTarget. + mTarget = gfxPlatform::GetPlatform()->CreateOffscreenDrawTarget(IntSize(1, 1), FORMAT_B8G8R8A8); } mResetLayer = true;