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_CanvasLayerComposite_H michael@0: #define GFX_CanvasLayerComposite_H michael@0: michael@0: #include "Layers.h" // for CanvasLayer, etc 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 "nsRect.h" // for nsIntRect michael@0: #include "nscore.h" // for nsACString michael@0: struct nsIntPoint; michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: class CompositableHost; michael@0: // Canvas layers use ImageHosts (but CanvasClients) because compositing a michael@0: // canvas is identical to compositing an image. michael@0: class ImageHost; michael@0: michael@0: class CanvasLayerComposite : public CanvasLayer, michael@0: public LayerComposite michael@0: { michael@0: public: michael@0: CanvasLayerComposite(LayerManagerComposite* aManager); michael@0: michael@0: virtual ~CanvasLayerComposite(); michael@0: michael@0: // CanvasLayer impl michael@0: virtual void Initialize(const Data& aData) MOZ_OVERRIDE michael@0: { michael@0: NS_RUNTIMEABORT("Incompatibe surface type"); michael@0: } michael@0: michael@0: virtual LayerRenderState GetRenderState() MOZ_OVERRIDE; michael@0: michael@0: virtual bool SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE; michael@0: michael@0: virtual void Disconnect() MOZ_OVERRIDE michael@0: { michael@0: Destroy(); michael@0: } michael@0: michael@0: virtual Layer* GetLayer() MOZ_OVERRIDE; michael@0: virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; michael@0: michael@0: virtual void CleanupResources() MOZ_OVERRIDE; michael@0: michael@0: CompositableHost* GetCompositableHost() MOZ_OVERRIDE; michael@0: michael@0: virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } michael@0: michael@0: void SetBounds(nsIntRect aBounds) { mBounds = aBounds; } michael@0: michael@0: virtual const char* Name() const MOZ_OVERRIDE { return "CanvasLayerComposite"; } michael@0: michael@0: protected: michael@0: virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: RefPtr mImageHost; michael@0: }; michael@0: michael@0: } /* layers */ michael@0: } /* mozilla */ michael@0: #endif /* GFX_CanvasLayerComposite_H */