зеркало из https://github.com/mozilla/gecko-dev.git
Bug 877115 - [Moz2Dify] Part 6. Moz2Dify SharedSurface_EGLImage::GetPixels. r=nical
This commit is contained in:
Родитель
96f82c49cb
Коммит
2d0ad0d42d
|
@ -170,14 +170,18 @@ SharedSurface_EGLImage::Fence()
|
|||
}
|
||||
|
||||
if (!mPixels) {
|
||||
gfxImageFormat format =
|
||||
HasAlpha() ? gfxImageFormatARGB32
|
||||
: gfxImageFormatRGB24;
|
||||
mPixels = new gfxImageSurface(ThebesIntSize(Size()), format);
|
||||
SurfaceFormat format =
|
||||
HasAlpha() ? FORMAT_B8G8R8A8
|
||||
: FORMAT_B8G8R8X8;
|
||||
mPixels = Factory::CreateDataSourceSurface(Size(), format);
|
||||
}
|
||||
|
||||
mPixels->Flush();
|
||||
mGL->ReadScreenIntoImageSurface(mPixels);
|
||||
nsRefPtr<gfxImageSurface> wrappedData =
|
||||
new gfxImageSurface(mPixels->GetData(),
|
||||
ThebesIntSize(mPixels->GetSize()),
|
||||
mPixels->Stride(),
|
||||
SurfaceFormatToImageFormat(mPixels->GetFormat()));
|
||||
mGL->ReadScreenIntoImageSurface(wrappedData);
|
||||
mPixels->MarkDirty();
|
||||
return;
|
||||
}
|
||||
|
@ -270,7 +274,7 @@ SharedSurface_EGLImage::AcquireConsumerTexture(GLContext* consGL)
|
|||
return 0;
|
||||
}
|
||||
|
||||
gfxImageSurface*
|
||||
DataSourceSurface*
|
||||
SharedSurface_EGLImage::GetPixels() const
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
|
|
@ -40,7 +40,7 @@ protected:
|
|||
GLLibraryEGL* const mEGL;
|
||||
const GLFormats mFormats;
|
||||
GLuint mProdTex;
|
||||
nsRefPtr<gfxImageSurface> mPixels;
|
||||
RefPtr<gfx::DataSourceSurface> mPixels;
|
||||
GLuint mProdTexForPipe; // Moves to mProdTex when mPipeActive becomes true.
|
||||
EGLImage mImage;
|
||||
GLContext* mCurConsGL;
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
GLuint AcquireConsumerTexture(GLContext* consGL);
|
||||
|
||||
// Will be void if AcquireConsumerTexture returns non-zero.
|
||||
gfxImageSurface* GetPixels() const;
|
||||
gfx::DataSourceSurface* GetPixels() const;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -483,7 +483,6 @@ StreamTextureSourceOGL::RetrieveTextureFromStream()
|
|||
|
||||
mSize = IntSize(sharedSurf->Size().width, sharedSurf->Size().height);
|
||||
|
||||
gfxImageSurface* deprecatedToUpload = nullptr;
|
||||
gfx::DataSourceSurface* toUpload = nullptr;
|
||||
switch (sharedSurf->Type()) {
|
||||
case SharedSurfaceType::GLTextureShare: {
|
||||
|
@ -503,8 +502,8 @@ StreamTextureSourceOGL::RetrieveTextureFromStream()
|
|||
mTextureHandle = eglImageSurf->AcquireConsumerTexture(gl());
|
||||
mTextureTarget = eglImageSurf->TextureTarget();
|
||||
if (!mTextureHandle) {
|
||||
deprecatedToUpload = eglImageSurf->GetPixels();
|
||||
MOZ_ASSERT(deprecatedToUpload);
|
||||
toUpload = eglImageSurf->GetPixels();
|
||||
MOZ_ASSERT(toUpload);
|
||||
} else {
|
||||
mFormat = sharedSurf->HasAlpha() ? FORMAT_R8G8B8A8
|
||||
: FORMAT_R8G8B8X8;
|
||||
|
@ -531,20 +530,6 @@ StreamTextureSourceOGL::RetrieveTextureFromStream()
|
|||
MOZ_CRASH("Invalid SharedSurface type.");
|
||||
}
|
||||
|
||||
if (deprecatedToUpload) {
|
||||
// FIXME Remove this whole block when deprecatedToUpload gets deleted
|
||||
// mBounds seems to end up as (0,0,0,0) a lot, so don't use it?
|
||||
nsIntSize size(deprecatedToUpload->GetSize());
|
||||
nsIntRect rect(nsIntPoint(0,0), size);
|
||||
nsIntRegion bounds(rect);
|
||||
mFormat = UploadSurfaceToTexture(gl(),
|
||||
deprecatedToUpload,
|
||||
bounds,
|
||||
mUploadTexture,
|
||||
true);
|
||||
mTextureHandle = mUploadTexture;
|
||||
mTextureTarget = LOCAL_GL_TEXTURE_2D;
|
||||
}
|
||||
if (toUpload) {
|
||||
// mBounds seems to end up as (0,0,0,0) a lot, so don't use it?
|
||||
nsIntSize size(ThebesIntSize(toUpload->GetSize()));
|
||||
|
@ -964,7 +949,6 @@ SurfaceStreamHostOGL::Lock()
|
|||
|
||||
mSize = IntSize(sharedSurf->Size().width, sharedSurf->Size().height);
|
||||
|
||||
gfxImageSurface* deprecatedToUpload = nullptr;
|
||||
DataSourceSurface* toUpload = nullptr;
|
||||
switch (sharedSurf->Type()) {
|
||||
case SharedSurfaceType::GLTextureShare: {
|
||||
|
@ -984,8 +968,8 @@ SurfaceStreamHostOGL::Lock()
|
|||
mTextureHandle = eglImageSurf->AcquireConsumerTexture(mGL);
|
||||
mTextureTarget = eglImageSurf->TextureTarget();
|
||||
if (!mTextureHandle) {
|
||||
deprecatedToUpload = eglImageSurf->GetPixels();
|
||||
MOZ_ASSERT(deprecatedToUpload);
|
||||
toUpload = eglImageSurf->GetPixels();
|
||||
MOZ_ASSERT(toUpload);
|
||||
} else {
|
||||
mFormat = sharedSurf->HasAlpha() ? FORMAT_R8G8B8A8
|
||||
: FORMAT_R8G8B8X8;
|
||||
|
@ -1012,20 +996,6 @@ SurfaceStreamHostOGL::Lock()
|
|||
MOZ_CRASH("Invalid SharedSurface type.");
|
||||
}
|
||||
|
||||
if (deprecatedToUpload) {
|
||||
// FIXME Remove this whole block when deprecatedToUpload gets deleted
|
||||
// mBounds seems to end up as (0,0,0,0) a lot, so don't use it?
|
||||
nsIntSize size(deprecatedToUpload->GetSize());
|
||||
nsIntRect rect(nsIntPoint(0,0), size);
|
||||
nsIntRegion bounds(rect);
|
||||
mFormat = UploadSurfaceToTexture(mGL,
|
||||
deprecatedToUpload,
|
||||
bounds,
|
||||
mUploadTexture,
|
||||
true);
|
||||
mTextureHandle = mUploadTexture;
|
||||
mTextureTarget = LOCAL_GL_TEXTURE_2D;
|
||||
}
|
||||
if (toUpload) {
|
||||
// mBounds seems to end up as (0,0,0,0) a lot, so don't use it?
|
||||
nsIntSize size(ThebesIntSize(toUpload->GetSize()));
|
||||
|
|
Загрузка…
Ссылка в новой задаче