Bug 1019727 - Remove TextureImageCGL::GetSurfaceForUpdate(). r=bjacob
authorJonathan Watt <jwatt@jwatt.org>
Wed, 04 Jun 2014 08:08:39 +0100
changeset 205693 8f0e194a29430c0081ce44c046794248899ba876
parent 205692 24743a3a0f9158f48bd21c7cfc4c0958048e8747
child 205694 b61f2deb78fa7497ead85e8e582d245ccf619a13
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs1019727
milestone32.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 1019727 - Remove TextureImageCGL::GetSurfaceForUpdate(). r=bjacob
gfx/gl/TextureImageCGL.h
gfx/gl/TextureImageCGL.mm
--- a/gfx/gl/TextureImageCGL.h
+++ b/gfx/gl/TextureImageCGL.h
@@ -26,27 +26,23 @@ public:
                     ContentType aContentType,
                     GLContext* aContext,
                     TextureImage::Flags aFlags = TextureImage::NoFlags,
                     TextureImage::ImageFormat aImageFormat = gfxImageFormat::Unknown);
 
     ~TextureImageCGL();
 
 protected:
-    already_AddRefed<gfxASurface>
-    GetSurfaceForUpdate(const gfxIntSize& aSize, ImageFormat aFmt);
-
     bool FinishedSurfaceUpdate();
 
     void FinishedSurfaceUpload();
 
 private:
 
     GLuint mPixelBuffer;
-    int32_t mPixelBufferSize;
     bool mBoundPixelBuffer;
 };
 
 already_AddRefed<TextureImage>
 CreateTextureImageCGL(GLContext *gl,
                       const gfx::IntSize& aSize,
                       TextureImage::ContentType aContentType,
                       GLenum aWrapMode,
--- a/gfx/gl/TextureImageCGL.mm
+++ b/gfx/gl/TextureImageCGL.mm
@@ -21,78 +21,27 @@ TextureImageCGL::TextureImageCGL(GLuint 
                 GLenum aWrapMode,
                 ContentType aContentType,
                 GLContext* aContext,
                 TextureImage::Flags aFlags,
                 TextureImage::ImageFormat aImageFormat)
     : BasicTextureImage(aTexture, aSize, aWrapMode, aContentType,
                         aContext, aFlags, aImageFormat)
     , mPixelBuffer(0)
-    , mPixelBufferSize(0)
     , mBoundPixelBuffer(false)
 {}
 
 TextureImageCGL::~TextureImageCGL()
 {
     if (mPixelBuffer) {
         mGLContext->MakeCurrent();
         mGLContext->fDeleteBuffers(1, &mPixelBuffer);
     }
 }
 
-already_AddRefed<gfxASurface>
-TextureImageCGL::GetSurfaceForUpdate(const gfxIntSize& aSize, ImageFormat aFmt)
-{
-    IntSize size(aSize.width + 1, aSize.height + 1);
-    mGLContext->MakeCurrent();
-    if (!mGLContext->
-        IsExtensionSupported(GLContext::ARB_pixel_buffer_object))
-    {
-        return gfxPlatform::GetPlatform()->
-            CreateOffscreenSurface(size,
-                                    gfxASurface::ContentFromFormat(aFmt));
-    }
-
-    if (!mPixelBuffer) {
-        mGLContext->fGenBuffers(1, &mPixelBuffer);
-    }
-    mGLContext->fBindBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER, mPixelBuffer);
-    int32_t length = size.width * 4 * size.height;
-
-    if (length > mPixelBufferSize) {
-        mGLContext->fBufferData(LOCAL_GL_PIXEL_UNPACK_BUFFER, length,
-                                NULL, LOCAL_GL_STREAM_DRAW);
-        mPixelBufferSize = length;
-    }
-    unsigned char* data =
-        (unsigned char*)mGLContext->
-            fMapBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER,
-                        LOCAL_GL_WRITE_ONLY);
-
-    mGLContext->fBindBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER, 0);
-
-    if (!data) {
-        nsAutoCString failure;
-        failure += "Pixel buffer binding failed: ";
-        failure.AppendPrintf("%dx%d\n", size.width, size.height);
-        gfx::LogFailure(failure);
-
-        mGLContext->fBindBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER, 0);
-        return gfxPlatform::GetPlatform()->
-            CreateOffscreenSurface(size,
-                                    gfxASurface::ContentFromFormat(aFmt));
-    }
-
-    nsRefPtr<gfxQuartzSurface> surf =
-        new gfxQuartzSurface(data, ThebesIntSize(size), size.width * 4, aFmt);
-
-    mBoundPixelBuffer = true;
-    return surf.forget();
-}
-
 bool
 TextureImageCGL::FinishedSurfaceUpdate()
 {
     if (mBoundPixelBuffer) {
         mGLContext->MakeCurrent();
         mGLContext->fBindBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER, mPixelBuffer);
         mGLContext->fUnmapBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER);
         return true;