From 969488c5d0d264e69ff0fa7164d1d2157158924c Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Mon, 30 Jun 2014 03:00:10 +0100 Subject: [PATCH] Bug 965967 - Use Moz2D instead of a Thebes backed gfxContext in PluginInstanceChild::PaintRectToSurface. r=mattwoodrow --- dom/plugins/ipc/PluginInstanceChild.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 60d27eb70b38..a54ab1dd623a 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -3199,12 +3199,16 @@ PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect, #endif if (mIsTransparent && !CanPaintOnBackground()) { - // Clear surface content for transparent rendering - nsRefPtr ctx = new gfxContext(renderSurface); - ctx->SetDeviceColor(aColor); - ctx->SetOperator(gfxContext::OPERATOR_SOURCE); - ctx->Rectangle(GfxFromNsRect(plPaintRect)); - ctx->Fill(); + RefPtr dt = CreateDrawTargetForSurface(renderSurface); + gfx::Rect rect(plPaintRect.x, plPaintRect.y, + plPaintRect.width, plPaintRect.height); + // Moz2D treats OP_SOURCE operations as unbounded, so we need to + // clip to the rect that we want to fill: + dt->PushClipRect(rect); + dt->FillRect(rect, ColorPattern(ToColor(aColor)), + DrawOptions(1.f, CompositionOp::OP_SOURCE)); + dt->PopClip(); + dt->Flush(); } PaintRectToPlatformSurface(plPaintRect, renderSurface);