From 7065a5f7a1f22d6a2849895f8495c2b06214fe46 Mon Sep 17 00:00:00 2001 From: Reed Koser Date: Fri, 4 Jul 2014 03:36:21 +0100 Subject: [PATCH] Bug 965967, part 2 - Get rid of the remaining Thebes backed gfxContexts in PluginInstanceChild.cpp. r=mattwoodrow --- dom/plugins/ipc/PluginInstanceChild.cpp | 30 ++++++++++--------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index a54ab1dd623a..50791ba61833 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -12,7 +12,6 @@ #include "StreamNotifyChild.h" #include "PluginProcessChild.h" #include "gfxASurface.h" -#include "gfxContext.h" #include "gfxPlatform.h" #include "gfx2DGlue.h" #include "nsNPAPIPluginInstance.h" @@ -2787,12 +2786,6 @@ PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType, } } -static inline gfxRect -GfxFromNsRect(const nsIntRect& aRect) -{ - return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height); -} - bool PluginInstanceChild::CreateOptSurface(void) { @@ -3454,12 +3447,14 @@ PluginInstanceChild::ShowPluginFrame() PLUGIN_LOG_DEBUG((" (on background)")); // Source the background pixels ... { - nsRefPtr ctx = - new gfxContext(mHelperSurface ? mHelperSurface : mCurrentSurface); - ctx->SetSource(mBackground); - ctx->SetOperator(gfxContext::OPERATOR_SOURCE); - ctx->Rectangle(gfxRect(rect.x, rect.y, rect.width, rect.height)); - ctx->Fill(); + nsRefPtr surface = + mHelperSurface ? mHelperSurface : mCurrentSurface; + RefPtr dt = CreateDrawTargetForSurface(surface); + RefPtr backgroundSurface = + gfxPlatform::GetSourceSurfaceForSurface(dt, mBackground); + dt->CopySurface(backgroundSurface, + ToIntRect(rect), + ToIntPoint(rect.TopLeft())); } // ... and hand off to the plugin // BEWARE: mBackground may die during this call @@ -3583,18 +3578,17 @@ PluginInstanceChild::ReadbackDifferenceRect(const nsIntRect& rect) mSurfaceDifferenceRect.width, mSurfaceDifferenceRect.height)); // Read back previous content - nsRefPtr ctx = new gfxContext(mCurrentSurface); - ctx->SetOperator(gfxContext::OPERATOR_SOURCE); - ctx->SetSource(mBackSurface); + RefPtr dt = CreateDrawTargetForSurface(mCurrentSurface); + RefPtr source = + gfxPlatform::GetSourceSurfaceForSurface(dt, mBackSurface); // Subtract from mSurfaceDifferenceRect area which is overlapping with rect nsIntRegion result; result.Sub(mSurfaceDifferenceRect, nsIntRegion(rect)); nsIntRegionRectIterator iter(result); const nsIntRect* r; while ((r = iter.Next()) != nullptr) { - ctx->Rectangle(GfxFromNsRect(*r)); + dt->CopySurface(source, ToIntRect(*r), ToIntPoint(r->TopLeft())); } - ctx->Fill(); return true; }