Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef MOZILLA_GFX_IMAGECLIENT_H
|
|
|
|
#define MOZILLA_GFX_IMAGECLIENT_H
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
#include <stdint.h> // for uint32_t, uint64_t
|
|
|
|
#include <sys/types.h> // for int32_t
|
|
|
|
#include "mozilla/Attributes.h" // for MOZ_OVERRIDE
|
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr, TemporaryRef
|
|
|
|
#include "mozilla/gfx/Types.h" // for SurfaceFormat
|
|
|
|
#include "mozilla/layers/CompositableClient.h" // for CompositableClient
|
|
|
|
#include "mozilla/layers/CompositorTypes.h" // for CompositableType, etc
|
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
|
|
|
|
#include "mozilla/layers/TextureClient.h" // for DeprecatedTextureClient, etc
|
|
|
|
#include "mozilla/mozalloc.h" // for operator delete
|
|
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
|
|
|
#include "nsRect.h" // for nsIntRect
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class CompositableForwarder;
|
|
|
|
class Image;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
class ImageContainer;
|
2013-08-11 16:17:23 -07:00
|
|
|
class ShadowableLayer;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Image clients are used by basic image layers on the content thread, they
|
|
|
|
* always match with an ImageHost on the compositor thread. See
|
|
|
|
* CompositableClient.h for information on connecting clients to hosts.
|
|
|
|
*/
|
|
|
|
class ImageClient : public CompositableClient
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Creates, configures, and returns a new image client. If necessary, a
|
|
|
|
* message will be sent to the compositor to create a corresponding image
|
|
|
|
* host.
|
|
|
|
*/
|
2013-04-16 14:36:06 -07:00
|
|
|
static TemporaryRef<ImageClient> CreateImageClient(CompositableType aImageHostType,
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
CompositableForwarder* aFwd,
|
|
|
|
TextureFlags aFlags);
|
|
|
|
|
|
|
|
virtual ~ImageClient() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update this ImageClient from aContainer in aLayer
|
|
|
|
* returns false if this is the wrong kind of ImageClient for aContainer.
|
|
|
|
* Note that returning true does not necessarily imply success
|
|
|
|
*/
|
|
|
|
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The picture rect is the area of the texture which makes up the image. That
|
|
|
|
* is, the area that should be composited. In texture space.
|
|
|
|
*/
|
|
|
|
virtual void UpdatePictureRect(nsIntRect aPictureRect);
|
|
|
|
|
2014-01-30 14:58:51 -08:00
|
|
|
virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) = 0;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
2013-09-12 07:50:28 -07:00
|
|
|
/**
|
|
|
|
* Synchronously remove all the textures used by the image client.
|
|
|
|
*/
|
2013-10-17 08:09:15 -07:00
|
|
|
virtual void FlushAllImages(bool aExceptFront) {}
|
2013-09-12 07:50:28 -07:00
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
protected:
|
2014-03-07 13:34:04 -08:00
|
|
|
ImageClient(CompositableForwarder* aFwd, TextureFlags aFlags,
|
|
|
|
CompositableType aType);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
|
|
|
|
CompositableType mType;
|
|
|
|
int32_t mLastPaintedImageSerial;
|
|
|
|
nsIntRect mPictureRect;
|
|
|
|
};
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
/**
|
|
|
|
* An image client which uses a single texture client.
|
|
|
|
*/
|
|
|
|
class ImageClientSingle : public ImageClient
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ImageClientSingle(CompositableForwarder* aFwd,
|
|
|
|
TextureFlags aFlags,
|
|
|
|
CompositableType aType);
|
|
|
|
|
|
|
|
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags);
|
|
|
|
|
2013-08-08 05:53:12 -07:00
|
|
|
virtual void OnDetach() MOZ_OVERRIDE;
|
2013-07-30 02:59:51 -07:00
|
|
|
|
2013-10-09 16:18:29 -07:00
|
|
|
virtual bool AddTextureClient(TextureClient* aTexture) MOZ_OVERRIDE;
|
2013-07-30 02:59:51 -07:00
|
|
|
|
|
|
|
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE;
|
2013-08-28 06:21:05 -07:00
|
|
|
|
2014-01-30 14:58:51 -08:00
|
|
|
virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) MOZ_OVERRIDE;
|
2013-09-12 07:50:28 -07:00
|
|
|
|
2013-10-17 08:09:15 -07:00
|
|
|
virtual void FlushAllImages(bool aExceptFront) MOZ_OVERRIDE;
|
2013-09-12 07:50:28 -07:00
|
|
|
|
2014-02-13 06:46:59 -08:00
|
|
|
protected:
|
|
|
|
virtual bool UpdateImageInternal(ImageContainer* aContainer, uint32_t aContentFlags, bool* aIsSwapped);
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
protected:
|
|
|
|
RefPtr<TextureClient> mFrontBuffer;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2013-08-08 05:53:12 -07:00
|
|
|
* An image client which uses two texture clients.
|
2013-07-30 02:59:51 -07:00
|
|
|
*/
|
|
|
|
class ImageClientBuffered : public ImageClientSingle
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ImageClientBuffered(CompositableForwarder* aFwd,
|
|
|
|
TextureFlags aFlags,
|
|
|
|
CompositableType aType);
|
|
|
|
|
|
|
|
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags);
|
|
|
|
|
2013-08-08 05:53:12 -07:00
|
|
|
virtual void OnDetach() MOZ_OVERRIDE;
|
2013-07-30 02:59:51 -07:00
|
|
|
|
2013-10-17 08:09:15 -07:00
|
|
|
virtual void FlushAllImages(bool aExceptFront) MOZ_OVERRIDE;
|
2013-09-12 07:50:28 -07:00
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
protected:
|
|
|
|
RefPtr<TextureClient> mBackBuffer;
|
|
|
|
};
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
/**
|
|
|
|
* Image class to be used for async image uploads using the image bridge
|
|
|
|
* protocol.
|
2013-07-08 14:30:44 -07:00
|
|
|
* We store the ImageBridge id in the DeprecatedTextureClientIdentifier.
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
*/
|
|
|
|
class ImageClientBridge : public ImageClient
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ImageClientBridge(CompositableForwarder* aFwd,
|
|
|
|
TextureFlags aFlags);
|
|
|
|
|
|
|
|
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags);
|
|
|
|
virtual bool Connect() { return false; }
|
|
|
|
virtual void Updated() {}
|
|
|
|
void SetLayer(ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
mLayer = aLayer;
|
|
|
|
}
|
|
|
|
|
2013-04-12 00:28:55 -07:00
|
|
|
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
return TextureInfo(mType);
|
|
|
|
}
|
|
|
|
|
2013-08-20 18:27:05 -07:00
|
|
|
virtual void SetIPDLActor(CompositableChild* aChild) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(!aChild, "ImageClientBridge should not have IPDL actor");
|
|
|
|
}
|
|
|
|
|
2014-01-30 14:58:51 -08:00
|
|
|
virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) MOZ_OVERRIDE
|
2013-08-28 06:21:05 -07:00
|
|
|
{
|
|
|
|
NS_WARNING("Should not create an image through an ImageClientBridge");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
protected:
|
|
|
|
uint64_t mAsyncContainerID;
|
|
|
|
ShadowableLayer* mLayer;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|