michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef GFX_ContainerLayerComposite_H michael@0: #define GFX_ContainerLayerComposite_H michael@0: michael@0: #include "Layers.h" // for Layer (ptr only), etc michael@0: #include "mozilla/Attributes.h" // for MOZ_OVERRIDE michael@0: #include "mozilla/layers/LayerManagerComposite.h" michael@0: michael@0: struct nsIntPoint; michael@0: struct nsIntRect; michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: class CompositableHost; michael@0: michael@0: class ContainerLayerComposite : public ContainerLayer, michael@0: public LayerComposite michael@0: { michael@0: template michael@0: friend void ContainerRender(ContainerT* aContainer, michael@0: LayerManagerComposite* aManager, michael@0: const nsIntRect& aClipRect); michael@0: public: michael@0: ContainerLayerComposite(LayerManagerComposite *aManager); michael@0: michael@0: ~ContainerLayerComposite(); michael@0: michael@0: // LayerComposite Implementation michael@0: virtual Layer* GetLayer() MOZ_OVERRIDE { return this; } michael@0: michael@0: virtual void Destroy() MOZ_OVERRIDE; michael@0: michael@0: LayerComposite* GetFirstChildComposite(); michael@0: michael@0: virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; michael@0: michael@0: virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE michael@0: { michael@0: DefaultComputeEffectiveTransforms(aTransformToSurface); michael@0: } michael@0: michael@0: virtual void CleanupResources() MOZ_OVERRIDE; michael@0: michael@0: virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } michael@0: michael@0: // container layers don't use a compositable michael@0: CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; } michael@0: michael@0: virtual const char* Name() const MOZ_OVERRIDE { return "ContainerLayerComposite"; } michael@0: }; michael@0: michael@0: class RefLayerComposite : public RefLayer, michael@0: public LayerComposite michael@0: { michael@0: template michael@0: friend void ContainerRender(ContainerT* aContainer, michael@0: LayerManagerComposite* aManager, michael@0: const nsIntRect& aClipRect); michael@0: public: michael@0: RefLayerComposite(LayerManagerComposite *aManager); michael@0: ~RefLayerComposite(); michael@0: michael@0: /** LayerOGL implementation */ michael@0: Layer* GetLayer() MOZ_OVERRIDE { return this; } michael@0: michael@0: void Destroy() MOZ_OVERRIDE; michael@0: michael@0: LayerComposite* GetFirstChildComposite(); michael@0: michael@0: virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; michael@0: michael@0: virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE michael@0: { michael@0: DefaultComputeEffectiveTransforms(aTransformToSurface); michael@0: } michael@0: michael@0: virtual void CleanupResources() MOZ_OVERRIDE; michael@0: michael@0: virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } michael@0: michael@0: // ref layers don't use a compositable michael@0: CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; } michael@0: michael@0: virtual const char* Name() const MOZ_OVERRIDE { return "RefLayerComposite"; } michael@0: }; michael@0: michael@0: } /* layers */ michael@0: } /* mozilla */ michael@0: michael@0: #endif /* GFX_ContainerLayerComposite_H */