Bug 550537: Use a different optimal operator for Direct2D. r=jrmuizel

This commit is contained in:
Bas Schouten 2010-03-12 11:08:25 +01:00
parent 4a6761de48
commit 41977ad8e8
2 changed files with 23 additions and 1 deletions

View File

@ -630,7 +630,7 @@ void imgFrame::Draw(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter,
if ((op == gfxContext::OPERATOR_OVER || pushedGroup) &&
format == gfxASurface::ImageFormatRGB24) {
aContext->SetOperator(gfxContext::OPERATOR_SOURCE);
aContext->SetOperator(OptimalFillOperator());
}
// Phew! Now we can actually draw this image
@ -955,3 +955,18 @@ void imgFrame::SetCompositingFailed(PRBool val)
{
mCompositingFailed = val;
}
gfxContext::GraphicsOperator imgFrame::OptimalFillOperator()
{
#ifdef XP_WIN
if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() ==
gfxWindowsPlatform::RENDER_DIRECT2D) {
// D2D -really- hates operator source.
return gfxContext::OPERATOR_OVER;
} else {
#endif
return gfxContext::OPERATOR_SOURCE;
#ifdef XP_WIN
}
#endif
}

View File

@ -140,6 +140,13 @@ private: // methods
return ((1 << mPaletteDepth) * sizeof(PRUint32));
}
/**
* This returns the fastest operator to use for solid surfaces which have no
* alpha channel or their alpha channel is uniformly opaque.
* This differs per render mode.
*/
gfxContext::GraphicsOperator OptimalFillOperator();
private: // data
nsRefPtr<gfxImageSurface> mImageSurface;
nsRefPtr<gfxASurface> mOptSurface;