Bug 740580 - Make GetShmInfoPtr() a static method on the gfxSharedImageSurface class. r=Bas
authorGeorge Wright <gwright@mozilla.com>
Tue, 02 Oct 2012 22:09:12 -0400
changeset 109096 0cd12dcf7f8f2e5fb55951dec5e5bfa876e177fa
parent 109095 4d5e812682389945e07e5a4bc40a1d695cba6d61
child 109097 5ff5e81e6de6b5640188f03294be1ec643c3dd11
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersBas
bugs740580
milestone18.0a1
Bug 740580 - Make GetShmInfoPtr() a static method on the gfxSharedImageSurface class. r=Bas
gfx/thebes/gfxSharedImageSurface.cpp
gfx/thebes/gfxSharedImageSurface.h
--- a/gfx/thebes/gfxSharedImageSurface.cpp
+++ b/gfx/thebes/gfxSharedImageSurface.cpp
@@ -9,24 +9,18 @@
 #include "cairo.h"
 
 #define MOZ_ALIGN_WORD(x) (((x) + 3) & ~3)
 
 using namespace mozilla::ipc;
 
 static const cairo_user_data_key_t SHM_KEY = {0};
 
-struct SharedImageInfo {
-    int32_t width;
-    int32_t height;
-    int32_t format;
-};
-
-static SharedImageInfo*
-GetShmInfoPtr(const Shmem& aShmem)
+/*static*/ SharedImageInfo*
+gfxSharedImageSurface::GetShmInfoPtr(const Shmem& aShmem)
 {
     return reinterpret_cast<SharedImageInfo*>
         (aShmem.get<char>() + aShmem.Size<char>() - sizeof(SharedImageInfo));
 }
 
 gfxSharedImageSurface::~gfxSharedImageSurface()
 {
     MOZ_COUNT_DTOR(gfxSharedImageSurface);
--- a/gfx/thebes/gfxSharedImageSurface.h
+++ b/gfx/thebes/gfxSharedImageSurface.h
@@ -8,16 +8,22 @@
 #define GFX_SHARED_IMAGESURFACE_H
 
 #include "mozilla/ipc/Shmem.h"
 #include "mozilla/ipc/SharedMemory.h"
 
 #include "gfxASurface.h"
 #include "gfxImageSurface.h"
 
+struct SharedImageInfo {
+    PRInt32 width;
+    PRInt32 height;
+    PRInt32 format;
+};
+
 class THEBES_API gfxSharedImageSurface : public gfxImageSurface {
     typedef mozilla::ipc::SharedMemory SharedMemory;
     typedef mozilla::ipc::Shmem Shmem;
 
 public:
     virtual ~gfxSharedImageSurface();
 
     /**
@@ -57,16 +63,18 @@ public:
     {
         return Create<ShmemAllocator, true>(aAllocator, aSize, aFormat, aShmType);
     }
 
     Shmem& GetShmem() { return mShmem; }
 
     static bool IsSharedImage(gfxASurface *aSurface);
 
+    static SharedImageInfo* GetShmInfoPtr(const Shmem& aShmem);
+
 private:
     gfxSharedImageSurface(const gfxIntSize&, gfxImageFormat, const Shmem&);
 
     void WriteShmemInfo();
 
     static size_t GetAlignedSize(const gfxIntSize&, long aStride);
 
     template<class ShmemAllocator, bool Unsafe>