mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1031553 - Create GrallocTextureSourceOGL only when GrallocTextureHostOGL has a gralloc buffer r=nical
This commit is contained in:
parent
5e7f19500d
commit
4818799f64
@ -205,6 +205,9 @@ CompositableClient::CreateTextureClientForDrawing(SurfaceFormat aFormat,
|
||||
bool
|
||||
CompositableClient::AddTextureClient(TextureClient* aClient)
|
||||
{
|
||||
if(!aClient || !aClient->IsAllocated()) {
|
||||
return false;
|
||||
}
|
||||
return aClient->InitIPDLActor(mForwarder);
|
||||
}
|
||||
|
||||
|
@ -305,13 +305,13 @@ GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
|
||||
format =
|
||||
SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(),
|
||||
aFlags & TextureFlags::RB_SWAPPED);
|
||||
mTextureSource = new GrallocTextureSourceOGL(nullptr,
|
||||
this,
|
||||
graphicBuffer,
|
||||
format);
|
||||
} else {
|
||||
NS_WARNING("gralloc buffer is nullptr");
|
||||
printf_stderr("gralloc buffer is nullptr");
|
||||
}
|
||||
mTextureSource = new GrallocTextureSourceOGL(nullptr,
|
||||
this,
|
||||
graphicBuffer,
|
||||
format);
|
||||
}
|
||||
|
||||
GrallocTextureHostOGL::~GrallocTextureHostOGL()
|
||||
@ -322,7 +322,9 @@ GrallocTextureHostOGL::~GrallocTextureHostOGL()
|
||||
void
|
||||
GrallocTextureHostOGL::SetCompositor(Compositor* aCompositor)
|
||||
{
|
||||
mTextureSource->SetCompositor(static_cast<CompositorOGL*>(aCompositor));
|
||||
if (mTextureSource) {
|
||||
mTextureSource->SetCompositor(static_cast<CompositorOGL*>(aCompositor));
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
@ -344,12 +346,18 @@ GrallocTextureHostOGL::Unlock()
|
||||
bool
|
||||
GrallocTextureHostOGL::IsValid() const
|
||||
{
|
||||
if (!mTextureSource) {
|
||||
return false;
|
||||
}
|
||||
return mTextureSource->IsValid();
|
||||
}
|
||||
|
||||
gfx::SurfaceFormat
|
||||
GrallocTextureHostOGL::GetFormat() const
|
||||
{
|
||||
if (!mTextureSource) {
|
||||
return gfx::SurfaceFormat::UNKNOWN;
|
||||
}
|
||||
return mTextureSource->GetFormat();
|
||||
}
|
||||
|
||||
@ -358,6 +366,7 @@ GrallocTextureHostOGL::DeallocateSharedData()
|
||||
{
|
||||
if (mTextureSource) {
|
||||
mTextureSource->ForgetBuffer();
|
||||
mTextureSource = nullptr;
|
||||
}
|
||||
if (mGrallocHandle.buffer().type() != SurfaceDescriptor::Tnull_t) {
|
||||
MaybeMagicGrallocBufferHandle handle = mGrallocHandle.buffer();
|
||||
@ -378,13 +387,16 @@ GrallocTextureHostOGL::ForgetSharedData()
|
||||
{
|
||||
if (mTextureSource) {
|
||||
mTextureSource->ForgetBuffer();
|
||||
mTextureSource = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GrallocTextureHostOGL::DeallocateDeviceData()
|
||||
{
|
||||
mTextureSource->DeallocateDeviceData();
|
||||
if (mTextureSource) {
|
||||
mTextureSource->DeallocateDeviceData();
|
||||
}
|
||||
}
|
||||
|
||||
LayerRenderState
|
||||
|
Loading…
Reference in New Issue
Block a user