This is a cairo/Thebes-only, main-thread-only implementation of layers. More...
#include <BasicLayers.h>
Inheritance diagram for mozilla::layers::BasicLayerManager:
Collaboration diagram for mozilla::layers::BasicLayerManager:Public Types | |
| enum | BufferMode { BUFFER_NONE, BUFFER_BUFFERED } |
Set the default target context that will be used when BeginTransaction is called. More... | |
Public Member Functions | |
| BasicLayerManager () | |
| Construct a BasicLayerManager which will have no default target context. | |
| BasicLayerManager (nsIWidget *aWidget) | |
| Construct a BasicLayerManager which will have no default target context. | |
| virtual | ~BasicLayerManager () |
| void | SetDefaultTarget (gfxContext *aContext, BufferMode aDoubleBuffering) |
| gfxContext * | GetDefaultTarget () |
| void | SetResolution (float aXResolution, float aYResolution) |
| Set a target resolution for managed layers that are scalable. | |
| float | XResolution () const |
| float | YResolution () const |
| nsIWidget * | GetRetainerWidget () |
| void | ClearRetainerWidget () |
| virtual void | BeginTransaction () |
| Start a new transaction. | |
| virtual void | BeginTransactionWithTarget (gfxContext *aTarget) |
| Start a new transaction. | |
| virtual bool | EndEmptyTransaction () |
| Attempts to end an "empty transaction". | |
| virtual void | EndTransaction (DrawThebesLayerCallback aCallback, void *aCallbackData) |
| Finish the construction phase of the transaction, perform the drawing phase, and end the transaction. | |
| virtual void | SetRoot (Layer *aLayer) |
| CONSTRUCTION PHASE ONLY Set the root layer. | |
| virtual already_AddRefed < ThebesLayer > | CreateThebesLayer () |
| CONSTRUCTION PHASE ONLY Create a ThebesLayer for this manager's layer tree. | |
| virtual already_AddRefed < ContainerLayer > | CreateContainerLayer () |
| CONSTRUCTION PHASE ONLY Create a ContainerLayer for this manager's layer tree. | |
| virtual already_AddRefed < ImageLayer > | CreateImageLayer () |
| CONSTRUCTION PHASE ONLY Create an ImageLayer for this manager's layer tree. | |
| virtual already_AddRefed < CanvasLayer > | CreateCanvasLayer () |
| CONSTRUCTION PHASE ONLY Create a CanvasLayer for this manager's layer tree. | |
| virtual already_AddRefed < ImageContainer > | CreateImageContainer () |
| Can be called anytime. | |
| virtual already_AddRefed < ColorLayer > | CreateColorLayer () |
| CONSTRUCTION PHASE ONLY Create a ColorLayer for this manager's layer tree. | |
| virtual already_AddRefed < ShadowThebesLayer > | CreateShadowThebesLayer () |
| virtual already_AddRefed < ShadowContainerLayer > | CreateShadowContainerLayer () |
| virtual already_AddRefed < ShadowImageLayer > | CreateShadowImageLayer () |
| virtual already_AddRefed < ShadowColorLayer > | CreateShadowColorLayer () |
| virtual already_AddRefed < ShadowCanvasLayer > | CreateShadowCanvasLayer () |
| virtual LayersBackend | GetBackendType () |
| Type of layer manager his is. | |
| virtual void | GetBackendName (nsAString &name) |
| Return the name of the layer manager's backend. | |
| gfxContext * | GetTarget () |
| PRBool | IsRetained () |
| void | ClearCachedResources () |
| void | SetTransactionIncomplete () |
Protected Member Functions | |
| void | PaintLayer (Layer *aLayer, DrawThebesLayerCallback aCallback, void *aCallbackData) |
| void | ClearLayer (Layer *aLayer) |
| already_AddRefed< gfxContext > | PushGroupWithCachedSurface (gfxContext *aTarget, gfxASurface::gfxContentType aContent, gfxPoint *aSavedOffset) |
| void | PopGroupWithCachedSurface (gfxContext *aTarget, const gfxPoint &aSavedOffset) |
| bool | EndTransactionInternal (DrawThebesLayerCallback aCallback, void *aCallbackData) |
Protected Attributes | |
| float | mXResolution |
| float | mYResolution |
| nsIWidget * | mWidget |
| nsRefPtr< gfxContext > | mDefaultTarget |
| nsRefPtr< gfxContext > | mTarget |
| gfxCachedTempSurface | mCachedSurface |
| BufferMode | mDoubleBuffering |
| PRPackedBool | mUsingDefaultTarget |
| bool | mTransactionIncomplete |
This is a cairo/Thebes-only, main-thread-only implementation of layers.
In each transaction, the client sets up the layer tree and then during the drawing phase, each ThebesLayer is painted directly into the target context (with appropriate clipping and Push/PopGroups performed between layers).
Set the default target context that will be used when BeginTransaction is called.
This can only be called outside a transaction.
aDoubleBuffering can request double-buffering for drawing to the default target. When BUFFERED, the layer manager avoids blitting temporary results to aContext and then overpainting them with final results, by using a temporary buffer when necessary. In BUFFERED mode we always completely overwrite the contents of aContext's destination surface (within the clip region) using OPERATOR_SOURCE.
| mozilla::layers::BasicLayerManager::BasicLayerManager | ( | ) |
Construct a BasicLayerManager which will have no default target context.
SetDefaultTarget or BeginTransactionWithTarget must be called for any rendering to happen. ThebesLayers will not be retained.
| mozilla::layers::BasicLayerManager::BasicLayerManager | ( | nsIWidget * | aWidget | ) |
Construct a BasicLayerManager which will have no default target context.
SetDefaultTarget or BeginTransactionWithTarget must be called for any rendering to happen. ThebesLayers will be retained; that is, we will try to retain the visible contents of ThebesLayers as cairo surfaces. We create ThebesLayer buffers by creating similar surfaces to the default target context, or to aWidget's GetThebesSurface if there is no default target context, or to the passed-in context if there is no widget and no default target context.
This does not keep a strong reference to the widget, so the caller must ensure that the widget outlives the layer manager or call ClearWidget before the widget dies.
| virtual mozilla::layers::BasicLayerManager::~BasicLayerManager | ( | ) | [virtual] |
| virtual void mozilla::layers::BasicLayerManager::BeginTransaction | ( | ) | [virtual] |
Start a new transaction.
Nested transactions are not allowed so there must be no transaction currently in progress. This transaction will update the state of the window from which this LayerManager was obtained.
Implements mozilla::layers::LayerManager.
| virtual void mozilla::layers::BasicLayerManager::BeginTransactionWithTarget | ( | gfxContext * | aTarget | ) | [virtual] |
Start a new transaction.
Nested transactions are not allowed so there must be no transaction currently in progress. This transaction will render the contents of the layer tree to the given target context. The rendering will be complete when EndTransaction returns.
Implements mozilla::layers::LayerManager.
| void mozilla::layers::BasicLayerManager::ClearCachedResources | ( | ) |
| void mozilla::layers::BasicLayerManager::ClearLayer | ( | Layer * | aLayer | ) | [protected] |
| void mozilla::layers::BasicLayerManager::ClearRetainerWidget | ( | ) | [inline] |
| virtual already_AddRefed<CanvasLayer> mozilla::layers::BasicLayerManager::CreateCanvasLayer | ( | ) | [virtual] |
CONSTRUCTION PHASE ONLY Create a CanvasLayer for this manager's layer tree.
Implements mozilla::layers::LayerManager.
| virtual already_AddRefed<ColorLayer> mozilla::layers::BasicLayerManager::CreateColorLayer | ( | ) | [virtual] |
CONSTRUCTION PHASE ONLY Create a ColorLayer for this manager's layer tree.
Implements mozilla::layers::LayerManager.
| virtual already_AddRefed<ContainerLayer> mozilla::layers::BasicLayerManager::CreateContainerLayer | ( | ) | [virtual] |
CONSTRUCTION PHASE ONLY Create a ContainerLayer for this manager's layer tree.
Implements mozilla::layers::LayerManager.
| virtual already_AddRefed<ImageContainer> mozilla::layers::BasicLayerManager::CreateImageContainer | ( | ) | [virtual] |
Can be called anytime.
Implements mozilla::layers::LayerManager.
| virtual already_AddRefed<ImageLayer> mozilla::layers::BasicLayerManager::CreateImageLayer | ( | ) | [virtual] |
CONSTRUCTION PHASE ONLY Create an ImageLayer for this manager's layer tree.
Implements mozilla::layers::LayerManager.
| virtual already_AddRefed<ShadowCanvasLayer> mozilla::layers::BasicLayerManager::CreateShadowCanvasLayer | ( | ) | [inline, virtual] |
| virtual already_AddRefed<ShadowColorLayer> mozilla::layers::BasicLayerManager::CreateShadowColorLayer | ( | ) | [inline, virtual] |
| virtual already_AddRefed<ShadowContainerLayer> mozilla::layers::BasicLayerManager::CreateShadowContainerLayer | ( | ) | [inline, virtual] |
| virtual already_AddRefed<ShadowImageLayer> mozilla::layers::BasicLayerManager::CreateShadowImageLayer | ( | ) | [inline, virtual] |
| virtual already_AddRefed<ShadowThebesLayer> mozilla::layers::BasicLayerManager::CreateShadowThebesLayer | ( | ) | [inline, virtual] |
| virtual already_AddRefed<ThebesLayer> mozilla::layers::BasicLayerManager::CreateThebesLayer | ( | ) | [virtual] |
CONSTRUCTION PHASE ONLY Create a ThebesLayer for this manager's layer tree.
Implements mozilla::layers::LayerManager.
| virtual bool mozilla::layers::BasicLayerManager::EndEmptyTransaction | ( | ) | [virtual] |
Attempts to end an "empty transaction".
There must have been no changes to the layer tree since the BeginTransaction(). It's possible for this to fail; ThebesLayers may need to be updated due to VRAM data being lost, for example. In such cases this method returns false, and the caller must proceed with a normal layer tree update and EndTransaction.
Reimplemented from mozilla::layers::LayerManager.
| virtual void mozilla::layers::BasicLayerManager::EndTransaction | ( | DrawThebesLayerCallback | aCallback, | |
| void * | aCallbackData | |||
| ) | [virtual] |
Finish the construction phase of the transaction, perform the drawing phase, and end the transaction.
During the drawing phase, all ThebesLayers in the tree are drawn in tree order, exactly once each, except for those layers where it is known that the visible region is empty.
Implements mozilla::layers::LayerManager.
| bool mozilla::layers::BasicLayerManager::EndTransactionInternal | ( | DrawThebesLayerCallback | aCallback, | |
| void * | aCallbackData | |||
| ) | [protected] |
| virtual void mozilla::layers::BasicLayerManager::GetBackendName | ( | nsAString & | aName | ) | [inline, virtual] |
Return the name of the layer manager's backend.
Implements mozilla::layers::LayerManager.
| virtual LayersBackend mozilla::layers::BasicLayerManager::GetBackendType | ( | ) | [inline, virtual] |
Type of layer manager his is.
This is to be used sparsely in order to avoid a lot of Layers backend specific code. It should be used only when Layers backend specific functionality is necessary.
Implements mozilla::layers::LayerManager.
| gfxContext* mozilla::layers::BasicLayerManager::GetDefaultTarget | ( | ) | [inline] |
| nsIWidget* mozilla::layers::BasicLayerManager::GetRetainerWidget | ( | ) | [inline] |
| gfxContext* mozilla::layers::BasicLayerManager::GetTarget | ( | ) | [inline] |
| PRBool mozilla::layers::BasicLayerManager::IsRetained | ( | ) | [inline] |
| void mozilla::layers::BasicLayerManager::PaintLayer | ( | Layer * | aLayer, | |
| DrawThebesLayerCallback | aCallback, | |||
| void * | aCallbackData | |||
| ) | [protected] |
| void mozilla::layers::BasicLayerManager::PopGroupWithCachedSurface | ( | gfxContext * | aTarget, | |
| const gfxPoint & | aSavedOffset | |||
| ) | [protected] |
| already_AddRefed<gfxContext> mozilla::layers::BasicLayerManager::PushGroupWithCachedSurface | ( | gfxContext * | aTarget, | |
| gfxASurface::gfxContentType | aContent, | |||
| gfxPoint * | aSavedOffset | |||
| ) | [protected] |
| void mozilla::layers::BasicLayerManager::SetDefaultTarget | ( | gfxContext * | aContext, | |
| BufferMode | aDoubleBuffering | |||
| ) |
| void mozilla::layers::BasicLayerManager::SetResolution | ( | float | aXResolution, | |
| float | aYResolution | |||
| ) | [inline] |
Set a target resolution for managed layers that are scalable.
It might make sense to call this outside of a transaction, but currently it's only allowed during the construction phase of transactions.
| virtual void mozilla::layers::BasicLayerManager::SetRoot | ( | Layer * | aLayer | ) | [virtual] |
CONSTRUCTION PHASE ONLY Set the root layer.
Implements mozilla::layers::LayerManager.
| void mozilla::layers::BasicLayerManager::SetTransactionIncomplete | ( | ) | [inline] |
| float mozilla::layers::BasicLayerManager::XResolution | ( | ) | const [inline] |
| float mozilla::layers::BasicLayerManager::YResolution | ( | ) | const [inline] |
nsIWidget* mozilla::layers::BasicLayerManager::mWidget [protected] |
float mozilla::layers::BasicLayerManager::mXResolution [protected] |
float mozilla::layers::BasicLayerManager::mYResolution [protected] |
1.7.1