1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/layers/composite/ThebesLayerComposite.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,92 @@ 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_ThebesLayerComposite_H 1.10 +#define GFX_ThebesLayerComposite_H 1.11 + 1.12 +#include "Layers.h" // for Layer (ptr only), etc 1.13 +#include "gfxRect.h" // for gfxRect 1.14 +#include "mozilla/Attributes.h" // for MOZ_OVERRIDE 1.15 +#include "mozilla/RefPtr.h" // for RefPtr 1.16 +#include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc 1.17 +#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc 1.18 +#include "nsDebug.h" // for NS_RUNTIMEABORT 1.19 +#include "nsRegion.h" // for nsIntRegion 1.20 +#include "nscore.h" // for nsACString 1.21 + 1.22 +struct nsIntPoint; 1.23 +struct nsIntRect; 1.24 + 1.25 + 1.26 +namespace mozilla { 1.27 +namespace layers { 1.28 + 1.29 +/** 1.30 + * Thebes layers use ContentHosts for their compsositable host. 1.31 + * By using different ContentHosts, ThebesLayerComposite support tiled and 1.32 + * non-tiled Thebes layers and single or double buffering. 1.33 + */ 1.34 + 1.35 +class CompositableHost; 1.36 +class ContentHost; 1.37 +class TiledLayerComposer; 1.38 + 1.39 +class ThebesLayerComposite : public ThebesLayer, 1.40 + public LayerComposite 1.41 +{ 1.42 +public: 1.43 + ThebesLayerComposite(LayerManagerComposite *aManager); 1.44 + virtual ~ThebesLayerComposite(); 1.45 + 1.46 + virtual void Disconnect() MOZ_OVERRIDE; 1.47 + 1.48 + virtual LayerRenderState GetRenderState() MOZ_OVERRIDE; 1.49 + 1.50 + CompositableHost* GetCompositableHost() MOZ_OVERRIDE; 1.51 + 1.52 + virtual void Destroy() MOZ_OVERRIDE; 1.53 + 1.54 + virtual Layer* GetLayer() MOZ_OVERRIDE; 1.55 + 1.56 + virtual TiledLayerComposer* GetTiledLayerComposer() MOZ_OVERRIDE; 1.57 + 1.58 + virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; 1.59 + 1.60 + virtual void CleanupResources() MOZ_OVERRIDE; 1.61 + 1.62 + virtual bool SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE; 1.63 + 1.64 + virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } 1.65 + 1.66 + void EnsureTiled() { mRequiresTiledProperties = true; } 1.67 + 1.68 + virtual void InvalidateRegion(const nsIntRegion& aRegion) 1.69 + { 1.70 + NS_RUNTIMEABORT("ThebesLayerComposites can't fill invalidated regions"); 1.71 + } 1.72 + 1.73 + void SetValidRegion(const nsIntRegion& aRegion) 1.74 + { 1.75 + MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ValidRegion", this)); 1.76 + mValidRegion = aRegion; 1.77 + Mutated(); 1.78 + } 1.79 + 1.80 + MOZ_LAYER_DECL_NAME("ThebesLayerComposite", TYPE_THEBES) 1.81 + 1.82 +protected: 1.83 + 1.84 + virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE; 1.85 + 1.86 +private: 1.87 + CSSToScreenScale GetEffectiveResolution(); 1.88 + 1.89 + RefPtr<ContentHost> mBuffer; 1.90 + bool mRequiresTiledProperties; 1.91 +}; 1.92 + 1.93 +} /* layers */ 1.94 +} /* mozilla */ 1.95 +#endif /* GFX_ThebesLayerComposite_H */