1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/layers/composite/ContainerLayerComposite.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,95 @@ 1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef GFX_ContainerLayerComposite_H 1.10 +#define GFX_ContainerLayerComposite_H 1.11 + 1.12 +#include "Layers.h" // for Layer (ptr only), etc 1.13 +#include "mozilla/Attributes.h" // for MOZ_OVERRIDE 1.14 +#include "mozilla/layers/LayerManagerComposite.h" 1.15 + 1.16 +struct nsIntPoint; 1.17 +struct nsIntRect; 1.18 + 1.19 +namespace mozilla { 1.20 +namespace layers { 1.21 + 1.22 +class CompositableHost; 1.23 + 1.24 +class ContainerLayerComposite : public ContainerLayer, 1.25 + public LayerComposite 1.26 +{ 1.27 + template<class ContainerT> 1.28 + friend void ContainerRender(ContainerT* aContainer, 1.29 + LayerManagerComposite* aManager, 1.30 + const nsIntRect& aClipRect); 1.31 +public: 1.32 + ContainerLayerComposite(LayerManagerComposite *aManager); 1.33 + 1.34 + ~ContainerLayerComposite(); 1.35 + 1.36 + // LayerComposite Implementation 1.37 + virtual Layer* GetLayer() MOZ_OVERRIDE { return this; } 1.38 + 1.39 + virtual void Destroy() MOZ_OVERRIDE; 1.40 + 1.41 + LayerComposite* GetFirstChildComposite(); 1.42 + 1.43 + virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; 1.44 + 1.45 + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE 1.46 + { 1.47 + DefaultComputeEffectiveTransforms(aTransformToSurface); 1.48 + } 1.49 + 1.50 + virtual void CleanupResources() MOZ_OVERRIDE; 1.51 + 1.52 + virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } 1.53 + 1.54 + // container layers don't use a compositable 1.55 + CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; } 1.56 + 1.57 + virtual const char* Name() const MOZ_OVERRIDE { return "ContainerLayerComposite"; } 1.58 +}; 1.59 + 1.60 +class RefLayerComposite : public RefLayer, 1.61 + public LayerComposite 1.62 +{ 1.63 + template<class ContainerT> 1.64 + friend void ContainerRender(ContainerT* aContainer, 1.65 + LayerManagerComposite* aManager, 1.66 + const nsIntRect& aClipRect); 1.67 +public: 1.68 + RefLayerComposite(LayerManagerComposite *aManager); 1.69 + ~RefLayerComposite(); 1.70 + 1.71 + /** LayerOGL implementation */ 1.72 + Layer* GetLayer() MOZ_OVERRIDE { return this; } 1.73 + 1.74 + void Destroy() MOZ_OVERRIDE; 1.75 + 1.76 + LayerComposite* GetFirstChildComposite(); 1.77 + 1.78 + virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; 1.79 + 1.80 + virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE 1.81 + { 1.82 + DefaultComputeEffectiveTransforms(aTransformToSurface); 1.83 + } 1.84 + 1.85 + virtual void CleanupResources() MOZ_OVERRIDE; 1.86 + 1.87 + virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } 1.88 + 1.89 + // ref layers don't use a compositable 1.90 + CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; } 1.91 + 1.92 + virtual const char* Name() const MOZ_OVERRIDE { return "RefLayerComposite"; } 1.93 +}; 1.94 + 1.95 +} /* layers */ 1.96 +} /* mozilla */ 1.97 + 1.98 +#endif /* GFX_ContainerLayerComposite_H */