Bug 934412 - Add header offset in SharedRGBImage::GetBuffer r=nical a=lsblakk
authorEdwin Flores <eflores@mozilla.com>
Mon, 16 Dec 2013 10:59:33 +1300
changeset 167707 297a28ff75f89f92577cfd805b13ee21bc84d3f1
parent 167706 d551dd374cfc2a40df0c412a5905f6f1208239d9
child 167708 b952d0e9de8659c2ae27d203b57cd9cc8e220974
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical, lsblakk
bugs934412
milestone27.0
Bug 934412 - Add header offset in SharedRGBImage::GetBuffer r=nical a=lsblakk
gfx/layers/ipc/SharedRGBImage.cpp
--- a/gfx/layers/ipc/SharedRGBImage.cpp
+++ b/gfx/layers/ipc/SharedRGBImage.cpp
@@ -4,16 +4,17 @@
 
 #include "SharedRGBImage.h"
 #include "ImageTypes.h"                 // for ImageFormat::SHARED_RGB, etc
 #include "Shmem.h"                      // for Shmem
 #include "gfx2DGlue.h"                  // for ImageFormatToSurfaceFormat, etc
 #include "gfxPlatform.h"                // for gfxPlatform, gfxImageFormat
 #include "mozilla/layers/ISurfaceAllocator.h"  // for ISurfaceAllocator, etc
 #include "mozilla/layers/ImageClient.h"  // for ImageClient
+#include "mozilla/layers/ImageDataSerializer.h"  // for ImageDataSerializer
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor, etc
 #include "mozilla/layers/TextureClient.h"  // for BufferTextureClient, etc
 #include "mozilla/layers/ImageBridgeChild.h"  // for ImageBridgeChild
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsDebug.h"                    // for NS_WARNING, NS_ASSERTION
 #include "nsISupportsImpl.h"            // for Image::AddRef, etc
 #include "nsRect.h"                     // for nsIntRect
@@ -201,18 +202,22 @@ SharedRGBImage::Allocate(gfx::IntSize aS
   mSize = aSize;
   mTextureClient = mCompositable->CreateBufferTextureClient(aFormat);
   return mTextureClient->AllocateForSurface(aSize);
 }
 
 uint8_t*
 SharedRGBImage::GetBuffer()
 {
-  return mTextureClient ? mTextureClient->GetBuffer()
-                        : nullptr;
+  if (!mTextureClient) {
+    return nullptr;
+  }
+
+  ImageDataSerializer serializer(mTextureClient->GetBuffer());
+  return serializer.GetData();
 }
 
 gfxIntSize
 SharedRGBImage::GetSize()
 {
   return ThebesIntSize(mSize);
 }