Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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);
}