mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 975384 - Add pointer check to GrallocTextureHostOGL r=nical
This commit is contained in:
parent
efa60f1017
commit
1d7fd44c1a
@ -115,6 +115,9 @@ void GrallocTextureSourceOGL::BindTexture(GLenum aTextureUnit)
|
||||
* texture using fEGLImageTargetTexture2D.
|
||||
*/
|
||||
MOZ_ASSERT(gl());
|
||||
if (!IsValid()) {
|
||||
return;
|
||||
}
|
||||
gl()->MakeCurrent();
|
||||
|
||||
GLuint tex = GetGLTexture();
|
||||
@ -155,6 +158,9 @@ GLenum
|
||||
GrallocTextureSourceOGL::GetTextureTarget() const
|
||||
{
|
||||
MOZ_ASSERT(mGraphicBuffer.get());
|
||||
if (!mGraphicBuffer.get()) {
|
||||
return LOCAL_GL_TEXTURE_EXTERNAL;
|
||||
}
|
||||
return TextureTargetForAndroidPixelFormat(mGraphicBuffer->getPixelFormat());
|
||||
}
|
||||
|
||||
@ -172,7 +178,7 @@ GrallocTextureSourceOGL::GetFormat() const {
|
||||
void
|
||||
GrallocTextureSourceOGL::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
|
||||
{
|
||||
if (!aBackendData) {
|
||||
if (!aBackendData || !mGraphicBuffer.get()) {
|
||||
mCompositableBackendData = nullptr;
|
||||
DeallocateDeviceData();
|
||||
return;
|
||||
@ -239,17 +245,23 @@ GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
|
||||
const NewSurfaceDescriptorGralloc& aDescriptor)
|
||||
: TextureHost(aFlags)
|
||||
{
|
||||
android::GraphicBuffer* graphicBuffer = nullptr;
|
||||
gfx::SurfaceFormat format = gfx::SurfaceFormat::UNKNOWN;
|
||||
|
||||
mSize = aDescriptor.size();
|
||||
mGrallocActor =
|
||||
static_cast<GrallocBufferActor*>(aDescriptor.bufferParent());
|
||||
|
||||
mGrallocActor->AddTextureHost(this);
|
||||
if (mGrallocActor) {
|
||||
mGrallocActor->AddTextureHost(this);
|
||||
graphicBuffer = mGrallocActor->GetGraphicBuffer();
|
||||
}
|
||||
|
||||
android::GraphicBuffer* graphicBuffer = mGrallocActor->GetGraphicBuffer();
|
||||
|
||||
mSize = aDescriptor.size();
|
||||
gfx::SurfaceFormat format =
|
||||
SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(),
|
||||
aFlags & TEXTURE_RB_SWAPPED);
|
||||
if (graphicBuffer) {
|
||||
format =
|
||||
SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(),
|
||||
aFlags & TEXTURE_RB_SWAPPED);
|
||||
}
|
||||
mTextureSource = new GrallocTextureSourceOGL(nullptr,
|
||||
graphicBuffer,
|
||||
format);
|
||||
@ -348,6 +360,9 @@ GrallocTextureHostOGL::GetAsSurface() {
|
||||
TemporaryRef<gfx::DataSourceSurface>
|
||||
GrallocTextureSourceOGL::GetAsSurface() {
|
||||
MOZ_ASSERT(gl());
|
||||
if (!IsValid()) {
|
||||
return nullptr;
|
||||
}
|
||||
gl()->MakeCurrent();
|
||||
|
||||
GLuint tex = GetGLTexture();
|
||||
|
Loading…
Reference in New Issue
Block a user