Bug 621601. Part 4: Fix ImageLayers to handle null current image. r=bas,a=me
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 19 Jan 2011 21:27:54 +1300
changeset 60860 710c1a6faf99
parent 60859 1d293c9ffa95
child 60861 809aded51aad
push id18137
push userrocallahan@mozilla.com
push date2011-01-19 08:28 +0000
treeherdermozilla-central@710c1a6faf99 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas, me
bugs621601
milestone2.0b10pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 621601. Part 4: Fix ImageLayers to handle null current image. r=bas,a=me
gfx/layers/d3d10/ImageLayerD3D10.cpp
gfx/layers/d3d9/ImageLayerD3D9.cpp
gfx/layers/opengl/ImageLayerOGL.cpp
--- a/gfx/layers/d3d10/ImageLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ImageLayerD3D10.cpp
@@ -200,16 +200,19 @@ ImageLayerD3D10::GetLayer()
 void
 ImageLayerD3D10::RenderLayer()
 {
   if (!GetContainer()) {
     return;
   }
 
   nsRefPtr<Image> image = GetContainer()->GetCurrentImage();
+  if (!image) {
+    return;
+  }
 
   SetEffectTransformAndOpacity();
 
   ID3D10EffectTechnique *technique;
 
   if (GetContainer()->GetBackendType() != LayerManager::LAYERS_D3D10 ||
       image->GetFormat() == Image::CAIRO_SURFACE)
   {
--- a/gfx/layers/d3d9/ImageLayerD3D9.cpp
+++ b/gfx/layers/d3d9/ImageLayerD3D9.cpp
@@ -234,17 +234,20 @@ ImageLayerD3D9::GetLayer()
 void
 ImageLayerD3D9::RenderLayer()
 {
   if (!GetContainer()) {
     return;
   }
 
   nsRefPtr<Image> image = GetContainer()->GetCurrentImage();
-  
+  if (!image) {
+    return;
+  }
+
   SetShaderTransformAndOpacity();
 
   if (GetContainer()->GetBackendType() != LayerManager::LAYERS_D3D9)
   {
     gfxIntSize size;
     nsRefPtr<gfxASurface> surface =
       GetContainer()->GetCurrentAsSurface(&size);
     nsRefPtr<IDirect3DTexture9> texture =
--- a/gfx/layers/opengl/ImageLayerOGL.cpp
+++ b/gfx/layers/opengl/ImageLayerOGL.cpp
@@ -374,16 +374,19 @@ ImageLayerOGL::RenderLayer(int,
                            const nsIntPoint& aOffset)
 {
   if (!GetContainer())
     return;
 
   mOGLManager->MakeCurrent();
 
   nsRefPtr<Image> image = GetContainer()->GetCurrentImage();
+  if (!image) {
+    return;
+  }
 
   if (image->GetFormat() == Image::PLANAR_YCBCR) {
     PlanarYCbCrImageOGL *yuvImage =
       static_cast<PlanarYCbCrImageOGL*>(image.get());
 
     if (!yuvImage->HasData()) {
       return;
     }