зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1019727 - Remove TextureImageCGL::GetSurfaceForUpdate(). r=bjacob
This commit is contained in:
Родитель
f13d351a57
Коммит
7d470e718a
|
@ -31,9 +31,6 @@ public:
|
|||
~TextureImageCGL();
|
||||
|
||||
protected:
|
||||
already_AddRefed<gfxASurface>
|
||||
GetSurfaceForUpdate(const gfxIntSize& aSize, ImageFormat aFmt);
|
||||
|
||||
bool FinishedSurfaceUpdate();
|
||||
|
||||
void FinishedSurfaceUpload();
|
||||
|
@ -41,7 +38,6 @@ protected:
|
|||
private:
|
||||
|
||||
GLuint mPixelBuffer;
|
||||
int32_t mPixelBufferSize;
|
||||
bool mBoundPixelBuffer;
|
||||
};
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ TextureImageCGL::TextureImageCGL(GLuint aTexture,
|
|||
: BasicTextureImage(aTexture, aSize, aWrapMode, aContentType,
|
||||
aContext, aFlags, aImageFormat)
|
||||
, mPixelBuffer(0)
|
||||
, mPixelBufferSize(0)
|
||||
, mBoundPixelBuffer(false)
|
||||
{}
|
||||
|
||||
|
@ -38,56 +37,6 @@ TextureImageCGL::~TextureImageCGL()
|
|||
}
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче