gfx/layers/client/ClientTiledThebesLayer.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:bc5e72bbf902
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #ifndef GFX_CLIENTTILEDTHEBESLAYER_H
6 #define GFX_CLIENTTILEDTHEBESLAYER_H
7
8 #include "ClientLayerManager.h" // for ClientLayer, etc
9 #include "Layers.h" // for ThebesLayer, etc
10 #include "mozilla/RefPtr.h" // for RefPtr
11 #include "mozilla/layers/TiledContentClient.h"
12 #include "nsDebug.h" // for NS_RUNTIMEABORT
13 #include "nsRegion.h" // for nsIntRegion
14
15 class gfxContext;
16
17 namespace mozilla {
18 namespace layers {
19
20 class ShadowableLayer;
21 class SpecificLayerAttributes;
22
23 /**
24 * An implementation of ThebesLayer that ONLY supports remote
25 * composition that is backed by tiles. This thebes layer implementation
26 * is better suited to mobile hardware to work around slow implementation
27 * of glTexImage2D (for OGL compositors), and restrait memory bandwidth.
28 *
29 * Tiled Thebes layers use a different protocol compared with other
30 * layers. A copy of the tiled buffer is made and sent to the compositing
31 * thread via the layers protocol. Tiles are uploaded by the buffers
32 * asynchonously without using IPC, that means they are not safe for cross-
33 * process use (bug 747811). Each tile has a TextureHost/Client pair but
34 * they communicate directly rather than using the Texture protocol.
35 *
36 * There is no ContentClient for tiled layers. There is a ContentHost, however.
37 */
38 class ClientTiledThebesLayer : public ThebesLayer,
39 public ClientLayer
40 {
41 typedef ThebesLayer Base;
42
43 public:
44 ClientTiledThebesLayer(ClientLayerManager* const aManager);
45 ~ClientTiledThebesLayer();
46
47 // Override name to distinguish it from ClientThebesLayer in layer dumps
48 virtual const char* Name() const { return "TiledThebesLayer"; }
49
50 // Thebes Layer
51 virtual Layer* AsLayer() { return this; }
52 virtual void InvalidateRegion(const nsIntRegion& aRegion) {
53 mInvalidRegion.Or(mInvalidRegion, aRegion);
54 mValidRegion.Sub(mValidRegion, aRegion);
55 mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, aRegion);
56 }
57
58 // Shadow methods
59 virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs);
60 virtual ShadowableLayer* AsShadowableLayer() { return this; }
61
62 virtual void Disconnect()
63 {
64 ClientLayer::Disconnect();
65 }
66
67 virtual void RenderLayer();
68
69 virtual void ClearCachedResources() MOZ_OVERRIDE;
70
71 private:
72 ClientLayerManager* ClientManager()
73 {
74 return static_cast<ClientLayerManager*>(mManager);
75 }
76
77 /**
78 * For the initial PaintThebes of a transaction, calculates all the data
79 * needed for that paint and any repeated transactions.
80 */
81 void BeginPaint();
82
83 /**
84 * When a paint ends, updates any data necessary to persist until the next
85 * paint. If aFinish is true, this will cause the paint to be marked as
86 * finished.
87 */
88 void EndPaint(bool aFinish);
89
90 RefPtr<TiledContentClient> mContentClient;
91 nsIntRegion mLowPrecisionValidRegion;
92 BasicTiledLayerPaintData mPaintData;
93 };
94
95 } // layers
96 } // mozilla
97
98 #endif

mercurial