Bug 1251808 - Construct the SourceSurfaceImage with the correct size in RasterImage::GetCurrentImage(). r=seth
authorSeth Fowler <mark.seth.fowler@gmail.com>
Fri, 26 Feb 2016 21:01:50 -0800
changeset 322257 39a1e216208199904ef3a562eb5d643efc08223d
parent 322256 93a262a768d62f6dc05e00833e43bb99bd974047
child 322258 debf6c7316b7a0514dbf2c85bb7df4b4a40d5972
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth
bugs1251808
milestone47.0a1
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 1251808 - Construct the SourceSurfaceImage with the correct size in RasterImage::GetCurrentImage(). r=seth
gfx/layers/ImageContainer.cpp
gfx/layers/ImageContainer.h
image/RasterImage.cpp
--- a/gfx/layers/ImageContainer.cpp
+++ b/gfx/layers/ImageContainer.cpp
@@ -544,16 +544,22 @@ PlanarYCbCrImage::GetAsSourceSurface()
 }
 
 SourceSurfaceImage::SourceSurfaceImage(const gfx::IntSize& aSize, gfx::SourceSurface* aSourceSurface)
   : Image(nullptr, ImageFormat::CAIRO_SURFACE),
     mSize(aSize),
     mSourceSurface(aSourceSurface)
 {}
 
+SourceSurfaceImage::SourceSurfaceImage(gfx::SourceSurface* aSourceSurface)
+  : Image(nullptr, ImageFormat::CAIRO_SURFACE),
+    mSize(aSourceSurface->GetSize()),
+    mSourceSurface(aSourceSurface)
+{}
+
 SourceSurfaceImage::~SourceSurfaceImage()
 {
 }
 
 TextureClient*
 SourceSurfaceImage::GetTextureClient(CompositableClient *aClient)
 {
   if (!aClient) {
--- a/gfx/layers/ImageContainer.h
+++ b/gfx/layers/ImageContainer.h
@@ -819,16 +819,17 @@ public:
     return surface.forget();
   }
 
   virtual TextureClient* GetTextureClient(CompositableClient* aClient) override;
 
   virtual gfx::IntSize GetSize() override { return mSize; }
 
   SourceSurfaceImage(const gfx::IntSize& aSize, gfx::SourceSurface* aSourceSurface);
+  SourceSurfaceImage(gfx::SourceSurface* aSourceSurface);
   ~SourceSurfaceImage();
 
 private:
   gfx::IntSize mSize;
   nsCountedRef<nsOwningThreadSourceSurfaceRef> mSourceSurface;
   nsDataHashtable<nsUint32HashKey, RefPtr<TextureClient> >  mTextureClients;
 };
 
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -623,21 +623,17 @@ RasterImage::GetCurrentImage(ImageContai
   Tie(drawResult, surface) =
     GetFrameInternal(mSize, FRAME_CURRENT, aFlags | FLAG_ASYNC_NOTIFY);
   if (!surface) {
     // The OS threw out some or all of our buffer. We'll need to wait for the
     // redecode (which was automatically triggered by GetFrame) to complete.
     return MakePair(drawResult, RefPtr<layers::Image>());
   }
 
-  IntSize size;
-  GetWidth(&size.width);
-  GetHeight(&size.height);
-
-  RefPtr<layers::Image> image = new layers::SourceSurfaceImage(size, surface);
+  RefPtr<layers::Image> image = new layers::SourceSurfaceImage(surface);
   return MakePair(drawResult, Move(image));
 }
 
 NS_IMETHODIMP_(bool)
 RasterImage::IsImageContainerAvailable(LayerManager* aManager, uint32_t aFlags)
 {
   int32_t maxTextureSize = aManager->GetMaxTextureSize();
   if (!mHasSize ||