mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1001683 - Convert a bunch of ReadPixelsIntoImageSurface callers to ReadPixelsIntoDataSurface callers (Moz2D migration). r=mattwoodrow
This commit is contained in:
parent
e619ecaddc
commit
2a54bb27d4
@ -507,7 +507,7 @@ ReadPixelsIntoImageSurface(GLContext* gl, gfxImageSurface* dest) {
|
||||
}
|
||||
|
||||
void
|
||||
ReadPixelsIntoDataSourceSurface(GLContext* gl, DataSourceSurface* dest) {
|
||||
ReadPixelsIntoDataSurface(GLContext* gl, DataSourceSurface* dest) {
|
||||
gl->MakeCurrent();
|
||||
MOZ_ASSERT(dest->GetSize().width != 0);
|
||||
MOZ_ASSERT(dest->GetSize().height != 0);
|
||||
@ -838,7 +838,7 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
|
||||
mGL->fDisableVertexAttribArray(0);
|
||||
|
||||
/* Read-back draw results */
|
||||
ReadPixelsIntoDataSourceSurface(mGL, isurf);
|
||||
ReadPixelsIntoDataSurface(mGL, isurf);
|
||||
CLEANUP_IF_GLERROR_OCCURRED("when reading pixels into surface");
|
||||
} while (false);
|
||||
|
||||
|
@ -24,6 +24,8 @@ class DataSourceSurface;
|
||||
|
||||
namespace gl {
|
||||
|
||||
void ReadPixelsIntoDataSurface(GLContext* aGL,
|
||||
gfx::DataSourceSurface* aSurface);
|
||||
void ReadPixelsIntoImageSurface(GLContext* aGL, gfxImageSurface* aSurface);
|
||||
void ReadScreenIntoImageSurface(GLContext* aGL, gfxImageSurface* aSurface);
|
||||
|
||||
|
@ -482,45 +482,30 @@ void
|
||||
GLScreenBuffer::Readback(SharedSurface_GL* src, DataSourceSurface* dest)
|
||||
{
|
||||
MOZ_ASSERT(src && dest);
|
||||
DataSourceSurface::MappedSurface ms;
|
||||
dest->Map(DataSourceSurface::MapType::READ, &ms);
|
||||
nsRefPtr<gfxImageSurface> wrappedDest =
|
||||
new gfxImageSurface(ms.mData,
|
||||
ThebesIntSize(dest->GetSize()),
|
||||
ms.mStride,
|
||||
SurfaceFormatToImageFormat(dest->GetFormat()));
|
||||
DeprecatedReadback(src, wrappedDest);
|
||||
dest->Unmap();
|
||||
}
|
||||
MOZ_ASSERT(dest->GetSize() == src->Size());
|
||||
MOZ_ASSERT(dest->GetFormat() == (src->HasAlpha() ? SurfaceFormat::B8G8R8A8
|
||||
: SurfaceFormat::B8G8R8X8));
|
||||
|
||||
void
|
||||
GLScreenBuffer::DeprecatedReadback(SharedSurface_GL* src, gfxImageSurface* dest)
|
||||
{
|
||||
MOZ_ASSERT(src && dest);
|
||||
MOZ_ASSERT(ToIntSize(dest->GetSize()) == src->Size());
|
||||
MOZ_ASSERT(dest->Format() == (src->HasAlpha() ? gfxImageFormat::ARGB32
|
||||
: gfxImageFormat::RGB24));
|
||||
mGL->MakeCurrent();
|
||||
|
||||
mGL->MakeCurrent();
|
||||
bool needsSwap = src != SharedSurf();
|
||||
if (needsSwap) {
|
||||
SharedSurf()->UnlockProd();
|
||||
src->LockProd();
|
||||
}
|
||||
|
||||
bool needsSwap = src != SharedSurf();
|
||||
if (needsSwap) {
|
||||
SharedSurf()->UnlockProd();
|
||||
src->LockProd();
|
||||
}
|
||||
ReadBuffer* buffer = CreateRead(src);
|
||||
MOZ_ASSERT(buffer);
|
||||
|
||||
ReadBuffer* buffer = CreateRead(src);
|
||||
MOZ_ASSERT(buffer);
|
||||
ScopedBindFramebuffer autoFB(mGL, buffer->FB());
|
||||
ReadPixelsIntoDataSurface(mGL, dest);
|
||||
|
||||
ScopedBindFramebuffer autoFB(mGL, buffer->FB());
|
||||
ReadPixelsIntoImageSurface(mGL, dest);
|
||||
delete buffer;
|
||||
|
||||
delete buffer;
|
||||
|
||||
if (needsSwap) {
|
||||
src->UnlockProd();
|
||||
SharedSurf()->LockProd();
|
||||
}
|
||||
if (needsSwap) {
|
||||
src->UnlockProd();
|
||||
SharedSurf()->LockProd();
|
||||
}
|
||||
}
|
||||
|
||||
DrawBuffer*
|
||||
|
@ -280,7 +280,6 @@ public:
|
||||
bool Resize(const gfx::IntSize& size);
|
||||
|
||||
void Readback(SharedSurface_GL* src, gfx::DataSourceSurface* dest);
|
||||
void DeprecatedReadback(SharedSurface_GL* src, gfxImageSurface* dest);
|
||||
|
||||
protected:
|
||||
void Attach(SharedSurface* surface, const gfx::IntSize& size);
|
||||
|
@ -322,18 +322,8 @@ void
|
||||
SharedSurface_Basic::Fence()
|
||||
{
|
||||
mGL->MakeCurrent();
|
||||
|
||||
ScopedBindFramebuffer autoFB(mGL, mFB);
|
||||
|
||||
DataSourceSurface::MappedSurface map;
|
||||
mData->Map(DataSourceSurface::MapType::WRITE, &map);
|
||||
nsRefPtr<gfxImageSurface> wrappedData =
|
||||
new gfxImageSurface(map.mData,
|
||||
ThebesIntSize(mData->GetSize()),
|
||||
map.mStride,
|
||||
SurfaceFormatToImageFormat(mData->GetFormat()));
|
||||
ReadPixelsIntoImageSurface(mGL, wrappedData);
|
||||
mData->Unmap();
|
||||
ReadPixelsIntoDataSurface(mGL, mData);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1328,16 +1328,7 @@ CompositorOGL::CopyToTarget(DrawTarget *aTarget, const gfx::Matrix& aTransform)
|
||||
RefPtr<DataSourceSurface> source =
|
||||
Factory::CreateDataSourceSurface(rect.Size(), gfx::SurfaceFormat::B8G8R8A8);
|
||||
|
||||
DataSourceSurface::MappedSurface map;
|
||||
source->Map(DataSourceSurface::MapType::WRITE, &map);
|
||||
// XXX we should do this properly one day without using the gfxImageSurface
|
||||
nsRefPtr<gfxImageSurface> surf =
|
||||
new gfxImageSurface(map.mData,
|
||||
gfxIntSize(width, height),
|
||||
map.mStride,
|
||||
gfxImageFormat::ARGB32);
|
||||
ReadPixelsIntoImageSurface(mGLContext, surf);
|
||||
source->Unmap();
|
||||
ReadPixelsIntoDataSurface(mGLContext, source);
|
||||
|
||||
// Map from GL space to Cairo space and reverse the world transform.
|
||||
Matrix glToCairoTransform = aTransform;
|
||||
|
Loading…
Reference in New Issue
Block a user