Bug 962288 - Don't call DeprecatedGetAsSurface unless it's Cairo. r=mattwoodrow

Changeset from Bug 959123 caused a performance decrease because
DeprecatedGetAsSurface was being called on an image that may not
be a CAIRO_SURFACE.
This commit is contained in:
Ali Akhtarzada 2014-01-22 14:12:02 -05:00
parent e3038b5dcb
commit 1051e4fa02
2 changed files with 4 additions and 4 deletions

View File

@ -213,14 +213,14 @@ ImageLayerD3D10::RenderLayer()
ID3D10EffectTechnique *technique;
nsRefPtr<IDXGIKeyedMutex> keyedMutex;
nsRefPtr<gfxASurface> surf = image->DeprecatedGetAsSurface();
if (image->GetFormat() == ImageFormat::CAIRO_SURFACE ||
image->GetFormat() == ImageFormat::REMOTE_IMAGE_BITMAP ||
image->GetFormat() == ImageFormat::REMOTE_IMAGE_DXGI_TEXTURE ||
image->GetFormat() == ImageFormat::D3D9_RGB32_TEXTURE) {
NS_ASSERTION(image->GetFormat() != ImageFormat::CAIRO_SURFACE ||
!surf || surf->GetContentType() != GFX_CONTENT_ALPHA,
!static_cast<CairoImage*>(image)->DeprecatedGetAsSurface().get() ||
static_cast<CairoImage*>(image)->DeprecatedGetAsSurface().get()->GetContentType() != GFX_CONTENT_ALPHA,
"Image layer has alpha image");
bool hasAlpha = false;

View File

@ -414,9 +414,9 @@ ImageLayerD3D9::RenderLayer()
image->GetFormat() == REMOTE_IMAGE_BITMAP ||
image->GetFormat() == D3D9_RGB32_TEXTURE)
{
nsRefPtr<gfxASurface> surf = image->DeprecatedGetAsSurface();
NS_ASSERTION(image->GetFormat() != CAIRO_SURFACE ||
!surf || surf->GetContentType() != GFX_CONTENT_ALPHA,
!static_cast<CairoImage*>(image)->DeprecatedGetAsSurface().get() ||
static_cast<CairoImage*>(image)->DeprecatedGetAsSurface().get()->GetContentType() != GFX_CONTENT_ALPHA,
"Image layer has alpha image");
bool hasAlpha = false;