gfx/layers/composite/CanvasLayerComposite.h

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:3e1120a8d17b
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #ifndef GFX_CanvasLayerComposite_H
7 #define GFX_CanvasLayerComposite_H
8
9 #include "Layers.h" // for CanvasLayer, etc
10 #include "mozilla/Attributes.h" // for MOZ_OVERRIDE
11 #include "mozilla/RefPtr.h" // for RefPtr
12 #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
13 #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
14 #include "nsDebug.h" // for NS_RUNTIMEABORT
15 #include "nsRect.h" // for nsIntRect
16 #include "nscore.h" // for nsACString
17 struct nsIntPoint;
18
19 namespace mozilla {
20 namespace layers {
21
22 class CompositableHost;
23 // Canvas layers use ImageHosts (but CanvasClients) because compositing a
24 // canvas is identical to compositing an image.
25 class ImageHost;
26
27 class CanvasLayerComposite : public CanvasLayer,
28 public LayerComposite
29 {
30 public:
31 CanvasLayerComposite(LayerManagerComposite* aManager);
32
33 virtual ~CanvasLayerComposite();
34
35 // CanvasLayer impl
36 virtual void Initialize(const Data& aData) MOZ_OVERRIDE
37 {
38 NS_RUNTIMEABORT("Incompatibe surface type");
39 }
40
41 virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
42
43 virtual bool SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
44
45 virtual void Disconnect() MOZ_OVERRIDE
46 {
47 Destroy();
48 }
49
50 virtual Layer* GetLayer() MOZ_OVERRIDE;
51 virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;
52
53 virtual void CleanupResources() MOZ_OVERRIDE;
54
55 CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
56
57 virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
58
59 void SetBounds(nsIntRect aBounds) { mBounds = aBounds; }
60
61 virtual const char* Name() const MOZ_OVERRIDE { return "CanvasLayerComposite"; }
62
63 protected:
64 virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
65
66 private:
67 RefPtr<CompositableHost> mImageHost;
68 };
69
70 } /* layers */
71 } /* mozilla */
72 #endif /* GFX_CanvasLayerComposite_H */

mercurial