Bug 1208283 (part 5) - Pass a gfx::Color instead of a gfxRGBA to PaintRectToSurface(). r=jwatt.

This commit is contained in:
Nicholas Nethercote
2015-09-24 18:32:40 -07:00
parent e98d68d03b
commit fd1e73a1a2
2 changed files with 9 additions and 9 deletions

View File

@@ -3216,7 +3216,7 @@ PluginInstanceChild::PaintRectToPlatformSurface(const nsIntRect& aRect,
void void
PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect, PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect,
gfxASurface* aSurface, gfxASurface* aSurface,
const gfxRGBA& aColor) const Color& aColor)
{ {
// Render using temporary X surface, with copy to image surface // Render using temporary X surface, with copy to image surface
nsIntRect plPaintRect(aRect); nsIntRect plPaintRect(aRect);
@@ -3242,7 +3242,7 @@ PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect,
// Moz2D treats OP_SOURCE operations as unbounded, so we need to // Moz2D treats OP_SOURCE operations as unbounded, so we need to
// clip to the rect that we want to fill: // clip to the rect that we want to fill:
dt->PushClipRect(rect); dt->PushClipRect(rect);
dt->FillRect(rect, ColorPattern(ToColor(aColor)), // aColor is already a device color dt->FillRect(rect, ColorPattern(aColor), // aColor is already a device color
DrawOptions(1.f, CompositionOp::OP_SOURCE)); DrawOptions(1.f, CompositionOp::OP_SOURCE));
dt->PopClip(); dt->PopClip();
dt->Flush(); dt->Flush();
@@ -3325,7 +3325,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
// Paint the plugin directly onto the target, with a white // Paint the plugin directly onto the target, with a white
// background and copy the result // background and copy the result
PaintRectToSurface(rect, aSurface, gfxRGBA(1.0, 1.0, 1.0)); PaintRectToSurface(rect, aSurface, Color(1.f, 1.f, 1.f));
{ {
RefPtr<DrawTarget> dt = CreateDrawTargetForSurface(whiteImage); RefPtr<DrawTarget> dt = CreateDrawTargetForSurface(whiteImage);
RefPtr<SourceSurface> surface = RefPtr<SourceSurface> surface =
@@ -3335,7 +3335,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
// Paint the plugin directly onto the target, with a black // Paint the plugin directly onto the target, with a black
// background // background
PaintRectToSurface(rect, aSurface, gfxRGBA(0.0, 0.0, 0.0)); PaintRectToSurface(rect, aSurface, Color(0.f, 0.f, 0.f));
// Don't copy the result, just extract a subimage so that we can // Don't copy the result, just extract a subimage so that we can
// recover alpha directly into the target // recover alpha directly into the target
@@ -3345,7 +3345,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
#else #else
// Paint onto white background // Paint onto white background
whiteImage->SetDeviceOffset(deviceOffset); whiteImage->SetDeviceOffset(deviceOffset);
PaintRectToSurface(rect, whiteImage, gfxRGBA(1.0, 1.0, 1.0)); PaintRectToSurface(rect, whiteImage, Color(1.f, 1.f, 1.f));
if (useSurfaceSubimageForBlack) { if (useSurfaceSubimageForBlack) {
gfxImageSurface *surface = static_cast<gfxImageSurface*>(aSurface); gfxImageSurface *surface = static_cast<gfxImageSurface*>(aSurface);
@@ -3357,7 +3357,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
// Paint onto black background // Paint onto black background
blackImage->SetDeviceOffset(deviceOffset); blackImage->SetDeviceOffset(deviceOffset);
PaintRectToSurface(rect, blackImage, gfxRGBA(0.0, 0.0, 0.0)); PaintRectToSurface(rect, blackImage, Color(0.f, 0.f, 0.f));
#endif #endif
MOZ_ASSERT(whiteImage && blackImage, "Didn't paint enough!"); MOZ_ASSERT(whiteImage && blackImage, "Didn't paint enough!");
@@ -3517,7 +3517,7 @@ PluginInstanceChild::ShowPluginFrame()
} }
// ... and hand off to the plugin // ... and hand off to the plugin
// BEWARE: mBackground may die during this call // BEWARE: mBackground may die during this call
PaintRectToSurface(rect, mCurrentSurface, gfxRGBA(0.0, 0.0, 0.0, 0.0)); PaintRectToSurface(rect, mCurrentSurface, Color());
} else if (!temporarilyMakeVisible && mDoAlphaExtraction) { } else if (!temporarilyMakeVisible && mDoAlphaExtraction) {
// We don't want to pay the expense of alpha extraction for // We don't want to pay the expense of alpha extraction for
// phony paints. // phony paints.
@@ -3534,7 +3534,7 @@ PluginInstanceChild::ShowPluginFrame()
(temporarilyMakeVisible && mHelperSurface) ? (temporarilyMakeVisible && mHelperSurface) ?
mHelperSurface : mCurrentSurface; mHelperSurface : mCurrentSurface;
PaintRectToSurface(rect, target, gfxRGBA(0.0, 0.0, 0.0, 0.0)); PaintRectToSurface(rect, target, Color());
} }
mHasPainted = true; mHasPainted = true;

View File

@@ -514,7 +514,7 @@ private:
// Paint plugin content rectangle to surface with bg color filling // Paint plugin content rectangle to surface with bg color filling
void PaintRectToSurface(const nsIntRect& aRect, void PaintRectToSurface(const nsIntRect& aRect,
gfxASurface* aSurface, gfxASurface* aSurface,
const gfxRGBA& aColor); const gfx::Color& aColor);
// Render plugin content to surface using // Render plugin content to surface using
// white/black image alpha extraction algorithm // white/black image alpha extraction algorithm