bool TexturedLayerMLGPU::OnPrepareToRender(FrameBuilder* aBuilder) { if (!mHost) { return false; } LayerManagerMLGPU* lm = GetLayerManager()->AsLayerManagerMLGPU(); ImageHost::RenderInfo info; if (!mHost->PrepareToRender(lm->GetTextureSourceProvider(), &info)) { return false; } RefPtr<TextureSource> source = mHost->AcquireTextureSource(info); if (!source) { return false; } if (source->AsBigImageIterator()) { mBigImageTexture = source; mTexture = nullptr; } else { mTexture = source; } mPictureRect = IntRect(0, 0, info.img->mPictureRect.Width(), info.img->mPictureRect.Height()); mHost->FinishRendering(info); return true; }
RefPtr<TextureSource> TexturedLayerMLGPU::BindAndGetTexture() { if (!mHost) { return nullptr; } LayerManagerMLGPU* lm = GetLayerManager()->AsLayerManagerMLGPU(); // Note: we don't call FinishRendering since mask layers do not need // composite notifications or bias updates. (This function should // not be called for non-mask-layers). ImageHost::RenderInfo info; if (!mHost->PrepareToRender(lm->GetTextureSourceProvider(), &info)) { return nullptr; } RefPtr<TextureSource> source = mHost->AcquireTextureSource(info); if (!source) { return nullptr; } mTexture = source; return source; }
void LayerMLGPU::SetLayerManager(HostLayerManager* aManager) { LayerManagerMLGPU* manager = aManager->AsLayerManagerMLGPU(); MOZ_RELEASE_ASSERT(manager); HostLayer::SetLayerManager(aManager); GetLayer()->SetManager(manager, this); if (CompositableHost* host = GetCompositableHost()) { host->SetTextureSourceProvider(manager->GetTextureSourceProvider()); } OnLayerManagerChange(manager); }