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_ThebesLayerComposite_H michael@0: #define GFX_ThebesLayerComposite_H michael@0: michael@0: #include "Layers.h" // for Layer (ptr only), etc michael@0: #include "gfxRect.h" // for gfxRect michael@0: #include "mozilla/Attributes.h" // for MOZ_OVERRIDE michael@0: #include "mozilla/RefPtr.h" // for RefPtr michael@0: #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc michael@0: #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc michael@0: #include "nsDebug.h" // for NS_RUNTIMEABORT michael@0: #include "nsRegion.h" // for nsIntRegion michael@0: #include "nscore.h" // for nsACString michael@0: michael@0: struct nsIntPoint; michael@0: struct nsIntRect; michael@0: michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: /** michael@0: * Thebes layers use ContentHosts for their compsositable host. michael@0: * By using different ContentHosts, ThebesLayerComposite support tiled and michael@0: * non-tiled Thebes layers and single or double buffering. michael@0: */ michael@0: michael@0: class CompositableHost; michael@0: class ContentHost; michael@0: class TiledLayerComposer; michael@0: michael@0: class ThebesLayerComposite : public ThebesLayer, michael@0: public LayerComposite michael@0: { michael@0: public: michael@0: ThebesLayerComposite(LayerManagerComposite *aManager); michael@0: virtual ~ThebesLayerComposite(); michael@0: michael@0: virtual void Disconnect() MOZ_OVERRIDE; michael@0: michael@0: virtual LayerRenderState GetRenderState() MOZ_OVERRIDE; michael@0: michael@0: CompositableHost* GetCompositableHost() MOZ_OVERRIDE; michael@0: michael@0: virtual void Destroy() MOZ_OVERRIDE; michael@0: michael@0: virtual Layer* GetLayer() MOZ_OVERRIDE; michael@0: michael@0: virtual TiledLayerComposer* GetTiledLayerComposer() MOZ_OVERRIDE; michael@0: michael@0: virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; michael@0: michael@0: virtual void CleanupResources() MOZ_OVERRIDE; michael@0: michael@0: virtual bool SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE; michael@0: michael@0: virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } michael@0: michael@0: void EnsureTiled() { mRequiresTiledProperties = true; } michael@0: michael@0: virtual void InvalidateRegion(const nsIntRegion& aRegion) michael@0: { michael@0: NS_RUNTIMEABORT("ThebesLayerComposites can't fill invalidated regions"); michael@0: } michael@0: michael@0: void SetValidRegion(const nsIntRegion& aRegion) michael@0: { michael@0: MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ValidRegion", this)); michael@0: mValidRegion = aRegion; michael@0: Mutated(); michael@0: } michael@0: michael@0: MOZ_LAYER_DECL_NAME("ThebesLayerComposite", TYPE_THEBES) michael@0: michael@0: protected: michael@0: michael@0: virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: CSSToScreenScale GetEffectiveResolution(); michael@0: michael@0: RefPtr mBuffer; michael@0: bool mRequiresTiledProperties; michael@0: }; michael@0: michael@0: } /* layers */ michael@0: } /* mozilla */ michael@0: #endif /* GFX_ThebesLayerComposite_H */