From fc93216036e3bc4c980358fd8c6686714faa1e20 Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Tue, 30 Mar 2010 20:58:37 +0200 Subject: [PATCH] Bug 556029: Add the ability to detect which layers backend is used. r=roc --- gfx/layers/Layers.h | 12 ++++++++++++ gfx/layers/basic/BasicLayers.h | 1 + gfx/layers/opengl/LayerManagerOGL.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index f0494369be4..a3759ceeebd 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -109,6 +109,11 @@ class THEBES_API LayerManager { THEBES_INLINE_DECL_REFCOUNTING(LayerManager) public: + enum LayersBackend { + LAYERS_BASIC = 0, + LAYERS_OPENGL + }; + virtual ~LayerManager() {} /** @@ -162,6 +167,13 @@ public: * Can be called anytime */ virtual already_AddRefed CreateImageContainer() = 0; + + /** + * 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. + */ + virtual LayersBackend GetBackendType() = 0; }; /** diff --git a/gfx/layers/basic/BasicLayers.h b/gfx/layers/basic/BasicLayers.h index 668b71a6104..332587e97e6 100644 --- a/gfx/layers/basic/BasicLayers.h +++ b/gfx/layers/basic/BasicLayers.h @@ -87,6 +87,7 @@ public: virtual already_AddRefed CreateContainerLayer(); virtual already_AddRefed CreateImageLayer(); virtual already_AddRefed CreateImageContainer(); + virtual LayersBackend GetBackendType() { return LAYERS_BASIC; } #ifdef DEBUG PRBool InConstruction() { return mPhase == PHASE_CONSTRUCTION; } diff --git a/gfx/layers/opengl/LayerManagerOGL.h b/gfx/layers/opengl/LayerManagerOGL.h index 31f8290d55d..a2db6b4b078 100644 --- a/gfx/layers/opengl/LayerManagerOGL.h +++ b/gfx/layers/opengl/LayerManagerOGL.h @@ -203,6 +203,8 @@ public: virtual already_AddRefed CreateImageContainer(); + virtual LayersBackend GetBackendType() { return LAYERS_OPENGL; } + /** * Helper methods. */