Bug 1415020 - Deallocate device data of TextureImageTextureSourceOGL during destroying CompositorOGL r=nical
This commit is contained in:
@@ -103,6 +103,33 @@ static gl::TextureImage::Flags FlagsToGLFlags(TextureFlags aFlags) {
|
||||
return static_cast<gl::TextureImage::Flags>(result);
|
||||
}
|
||||
|
||||
TextureImageTextureSourceOGL::TextureImageTextureSourceOGL(
|
||||
CompositorOGL* aCompositor, TextureFlags aFlags)
|
||||
: mGL(aCompositor->gl()),
|
||||
mCompositor(aCompositor),
|
||||
mFlags(aFlags),
|
||||
mIterating(false)
|
||||
{
|
||||
if (mCompositor) {
|
||||
mCompositor->RegisterTextureSource(this);
|
||||
}
|
||||
}
|
||||
|
||||
TextureImageTextureSourceOGL::~TextureImageTextureSourceOGL()
|
||||
{
|
||||
DeallocateDeviceData();
|
||||
}
|
||||
|
||||
void TextureImageTextureSourceOGL::DeallocateDeviceData()
|
||||
{
|
||||
mTexImage = nullptr;
|
||||
mGL = nullptr;
|
||||
if (mCompositor) {
|
||||
mCompositor->UnregisterTextureSource(this);
|
||||
}
|
||||
SetUpdateSerial(0);
|
||||
}
|
||||
|
||||
bool TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
|
||||
nsIntRegion* aDestRegion,
|
||||
gfx::IntPoint* aSrcOffset) {
|
||||
@@ -180,6 +207,17 @@ void TextureImageTextureSourceOGL::SetTextureSourceProvider(
|
||||
DeallocateDeviceData();
|
||||
}
|
||||
mGL = newGL;
|
||||
|
||||
CompositorOGL* compositor = aProvider ? aProvider->AsCompositorOGL() : nullptr;
|
||||
if (mCompositor != compositor) {
|
||||
if (mCompositor) {
|
||||
mCompositor->UnregisterTextureSource(this);
|
||||
}
|
||||
if (compositor) {
|
||||
compositor->RegisterTextureSource(this);
|
||||
}
|
||||
mCompositor = compositor;
|
||||
}
|
||||
}
|
||||
|
||||
gfx::IntSize TextureImageTextureSourceOGL::GetSize() const {
|
||||
|
||||
Reference in New Issue
Block a user