зеркало из https://github.com/mozilla/gecko-dev.git
Bug 988771 - Remove DeprecatedCanvasClient. r=nical
--HG-- extra : rebase_source : 3dbca3237e08a6ab18e2d5805cacf18659a40d69
This commit is contained in:
Родитель
cc85b3dbf4
Коммит
28e1095225
|
@ -41,10 +41,6 @@ CanvasClient::CreateCanvasClient(CanvasClientType aType,
|
|||
aFlags |= TEXTURE_DEALLOCATE_CLIENT;
|
||||
return new CanvasClientSurfaceStream(aForwarder, aFlags);
|
||||
}
|
||||
if (gfxPlatform::GetPlatform()->UseDeprecatedTextures()) {
|
||||
aFlags |= TEXTURE_DEALLOCATE_CLIENT;
|
||||
return new DeprecatedCanvasClient2D(aForwarder, aFlags);
|
||||
}
|
||||
return new CanvasClient2D(aForwarder, aFlags);
|
||||
}
|
||||
|
||||
|
@ -199,133 +195,5 @@ CanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
|||
aLayer->Painted();
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedCanvasClient2D::Updated()
|
||||
{
|
||||
mForwarder->UpdateTexture(this, 1, mDeprecatedTextureClient->LockSurfaceDescriptor());
|
||||
}
|
||||
|
||||
|
||||
DeprecatedCanvasClient2D::DeprecatedCanvasClient2D(CompositableForwarder* aFwd,
|
||||
TextureFlags aFlags)
|
||||
: CanvasClient(aFwd, aFlags)
|
||||
{
|
||||
mTextureInfo.mCompositableType = BUFFER_IMAGE_SINGLE;
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedCanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
||||
{
|
||||
bool isOpaque = (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
|
||||
gfxContentType contentType = isOpaque
|
||||
? gfxContentType::COLOR
|
||||
: gfxContentType::COLOR_ALPHA;
|
||||
|
||||
if (!mDeprecatedTextureClient) {
|
||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT, contentType);
|
||||
if (!mDeprecatedTextureClient) {
|
||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_FALLBACK, contentType);
|
||||
if (!mDeprecatedTextureClient) {
|
||||
NS_WARNING("Could not create texture client");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mDeprecatedTextureClient->EnsureAllocated(aSize, contentType)) {
|
||||
// We might already be on the fallback texture client if we couldn't create a
|
||||
// better one above. In which case this call to create is wasted. But I don't
|
||||
// think this will happen often enough to be worth complicating the code with
|
||||
// further checks.
|
||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_FALLBACK, contentType);
|
||||
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
|
||||
if (!mDeprecatedTextureClient->EnsureAllocated(aSize, contentType)) {
|
||||
NS_WARNING("Could not allocate texture client");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gfxASurface* surface = mDeprecatedTextureClient->LockSurface();
|
||||
aLayer->DeprecatedUpdateSurface(surface);
|
||||
mDeprecatedTextureClient->Unlock();
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedCanvasClientSurfaceStream::Updated()
|
||||
{
|
||||
mForwarder->UpdateTextureNoSwap(this, 1, mDeprecatedTextureClient->LockSurfaceDescriptor());
|
||||
}
|
||||
|
||||
|
||||
DeprecatedCanvasClientSurfaceStream::DeprecatedCanvasClientSurfaceStream(CompositableForwarder* aFwd,
|
||||
TextureFlags aFlags)
|
||||
: CanvasClient(aFwd, aFlags)
|
||||
{
|
||||
mTextureInfo.mCompositableType = BUFFER_IMAGE_SINGLE;
|
||||
}
|
||||
|
||||
void
|
||||
DeprecatedCanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
||||
{
|
||||
if (!mDeprecatedTextureClient) {
|
||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_STREAM_GL,
|
||||
aLayer->GetSurfaceMode() == SurfaceMode::SURFACE_OPAQUE
|
||||
? gfxContentType::COLOR
|
||||
: gfxContentType::COLOR_ALPHA);
|
||||
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
|
||||
}
|
||||
|
||||
NS_ASSERTION(aLayer->mGLContext, "CanvasClientSurfaceStream should only be used with GL canvases");
|
||||
|
||||
// the content type won't be used
|
||||
mDeprecatedTextureClient->EnsureAllocated(aSize, gfxContentType::COLOR);
|
||||
|
||||
GLScreenBuffer* screen = aLayer->mGLContext->Screen();
|
||||
SurfaceStream* stream = nullptr;
|
||||
|
||||
if (aLayer->mStream) {
|
||||
stream = aLayer->mStream;
|
||||
stream->CopySurfaceToProducer(aLayer->mTextureSurface, aLayer->mFactory);
|
||||
stream->SwapProducer(aLayer->mFactory, gfx::IntSize(aSize.width, aSize.height));
|
||||
} else {
|
||||
stream = screen->Stream();
|
||||
}
|
||||
|
||||
bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
if (isCrossProcess) {
|
||||
// swap staging -> consumer so we can send it to the compositor
|
||||
SharedSurface* surf = stream->SwapConsumer();
|
||||
if (!surf) {
|
||||
printf_stderr("surf is null post-SwapConsumer!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (surf->Type() != SharedSurfaceType::Gralloc) {
|
||||
printf_stderr("Unexpected non-Gralloc SharedSurface in IPC path!");
|
||||
return;
|
||||
}
|
||||
|
||||
SharedSurface_Gralloc* grallocSurf = SharedSurface_Gralloc::Cast(surf);
|
||||
//XXX todo
|
||||
//mDeprecatedTextureClient->SetDescriptor(grallocSurf->GetDescriptor());
|
||||
#else
|
||||
printf_stderr("isCrossProcess, but not MOZ_WIDGET_GONK! Someone needs to write some code!");
|
||||
MOZ_ASSERT(false);
|
||||
#endif
|
||||
} else {
|
||||
SurfaceStreamHandle handle = stream->GetShareHandle();
|
||||
mDeprecatedTextureClient->SetDescriptor(SurfaceStreamDescriptor(handle, false));
|
||||
|
||||
// Bug 894405
|
||||
//
|
||||
// Ref this so the SurfaceStream doesn't disappear unexpectedly. The
|
||||
// Compositor will need to unref it when finished.
|
||||
aLayer->mGLContext->AddRef();
|
||||
}
|
||||
|
||||
aLayer->Painted();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,56 +132,6 @@ private:
|
|||
RefPtr<TextureClient> mBuffer;
|
||||
};
|
||||
|
||||
class DeprecatedCanvasClient2D : public CanvasClient
|
||||
{
|
||||
public:
|
||||
DeprecatedCanvasClient2D(CompositableForwarder* aLayerForwarder,
|
||||
TextureFlags aFlags);
|
||||
|
||||
TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
{
|
||||
return mTextureInfo;
|
||||
}
|
||||
|
||||
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer);
|
||||
virtual void Updated() MOZ_OVERRIDE;
|
||||
|
||||
virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
|
||||
{
|
||||
mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
|
||||
};
|
||||
|
||||
// Used for GL canvases where we don't need to do any readback, i.e., with a
|
||||
// GL backend.
|
||||
class DeprecatedCanvasClientSurfaceStream : public CanvasClient
|
||||
{
|
||||
public:
|
||||
DeprecatedCanvasClientSurfaceStream(CompositableForwarder* aFwd,
|
||||
TextureFlags aFlags);
|
||||
|
||||
TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
||||
{
|
||||
return mTextureInfo;
|
||||
}
|
||||
|
||||
virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer);
|
||||
virtual void Updated() MOZ_OVERRIDE;
|
||||
|
||||
virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
|
||||
const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE
|
||||
{
|
||||
mDeprecatedTextureClient->SetDescriptorFromReply(aDescriptor);
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче