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.

Reverted CairoImage surface members to public access as they were
before the patch from bug 959123.
This commit is contained in:
Ali Akhtarzada 2014-01-24 08:42:12 -05:00
Родитель 63c79ad8a7
Коммит 667ea8a730
3 изменённых файлов: 4 добавлений и 6 удалений

Просмотреть файл

@ -960,8 +960,6 @@ public:
CairoImage() : Image(nullptr, CAIRO_SURFACE) {}
private:
nsCountedRef<nsMainThreadSurfaceRef> mDeprecatedSurface;
gfx::IntSize mSize;

Просмотреть файл

@ -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() != gfxContentType::ALPHA,
!static_cast<CairoImage*>(image)->mDeprecatedSurface ||
static_cast<CairoImage*>(image)->mDeprecatedSurface->GetContentType() != gfxContentType::ALPHA,
"Image layer has alpha image");
bool hasAlpha = false;

Просмотреть файл

@ -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() != gfxContentType::ALPHA,
!static_cast<CairoImage*>(image)->mDeprecatedSurface ||
static_cast<CairoImage*>(image)->mDeprecatedSurface->GetContentType() != gfxContentType::ALPHA,
"Image layer has alpha image");
bool hasAlpha = false;