OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TiledLayerChromium_h | 5 // Temporary forwarding header |
6 #define TiledLayerChromium_h | 6 #include "cc/tiled_layer.h" |
7 | |
8 #if USE(ACCELERATED_COMPOSITING) | |
9 | |
10 #include "CCLayerTilingData.h" | |
11 #include "LayerChromium.h" | |
12 #include "LayerTextureUpdater.h" | |
13 | |
14 namespace cc { | |
15 class UpdatableTile; | |
16 | |
17 class TiledLayerChromium : public LayerChromium { | |
18 public: | |
19 enum TilingOption { AlwaysTile, NeverTile, AutoTile }; | |
20 | |
21 virtual void setIsMask(bool) OVERRIDE; | |
22 | |
23 virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; | |
24 | |
25 virtual bool drawsContent() const OVERRIDE; | |
26 virtual bool needsContentsScale() const OVERRIDE; | |
27 | |
28 virtual IntSize contentBounds() const OVERRIDE; | |
29 | |
30 virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE; | |
31 | |
32 virtual void setUseLCDText(bool) OVERRIDE; | |
33 | |
34 virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE; | |
35 | |
36 virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE; | |
37 | |
38 virtual Region visibleContentOpaqueRegion() const OVERRIDE; | |
39 | |
40 virtual void update(CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRend
eringStats&) OVERRIDE; | |
41 | |
42 protected: | |
43 TiledLayerChromium(); | |
44 virtual ~TiledLayerChromium(); | |
45 | |
46 void updateTileSizeAndTilingOption(); | |
47 void updateBounds(); | |
48 | |
49 // Exposed to subclasses for testing. | |
50 void setTileSize(const IntSize&); | |
51 void setTextureFormat(GC3Denum textureFormat) { m_textureFormat = textureFor
mat; } | |
52 void setBorderTexelOption(CCLayerTilingData::BorderTexelOption); | |
53 void setSampledTexelFormat(LayerTextureUpdater::SampledTexelFormat sampledTe
xelFormat) { m_sampledTexelFormat = sampledTexelFormat; } | |
54 size_t numPaintedTiles() { return m_tiler->tiles().size(); } | |
55 | |
56 virtual LayerTextureUpdater* textureUpdater() const = 0; | |
57 virtual void createTextureUpdaterIfNeeded() = 0; | |
58 | |
59 // Set invalidations to be potentially repainted during update(). | |
60 void invalidateContentRect(const IntRect& contentRect); | |
61 | |
62 // Reset state on tiles that will be used for updating the layer. | |
63 void resetUpdateState(); | |
64 | |
65 // After preparing an update, returns true if more painting is needed. | |
66 bool needsIdlePaint(); | |
67 IntRect idlePaintRect(); | |
68 | |
69 bool skipsDraw() const { return m_skipsDraw; } | |
70 | |
71 // Virtual for testing | |
72 virtual CCPrioritizedTextureManager* textureManager() const; | |
73 | |
74 private: | |
75 virtual scoped_ptr<CCLayerImpl> createCCLayerImpl() OVERRIDE; | |
76 | |
77 void createTilerIfNeeded(); | |
78 void setTilingOption(TilingOption); | |
79 | |
80 bool tileOnlyNeedsPartialUpdate(UpdatableTile*); | |
81 bool tileNeedsBufferedUpdate(UpdatableTile*); | |
82 | |
83 void markOcclusionsAndRequestTextures(int left, int top, int right, int bott
om, const CCOcclusionTracker*); | |
84 | |
85 bool updateTiles(int left, int top, int right, int bottom, CCTextureUpdateQu
eue&, const CCOcclusionTracker*, CCRenderingStats&, bool& didPaint); | |
86 bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ign
oreOcclusions); | |
87 IntRect markTilesForUpdate(int left, int top, int right, int bottom, bool ig
noreOcclusions); | |
88 void updateTileTextures(const IntRect& paintRect, int left, int top, int rig
ht, int bottom, CCTextureUpdateQueue&, const CCOcclusionTracker*, CCRenderingSta
ts&); | |
89 | |
90 UpdatableTile* tileAt(int, int) const; | |
91 UpdatableTile* createTile(int, int); | |
92 | |
93 GC3Denum m_textureFormat; | |
94 bool m_skipsDraw; | |
95 bool m_failedUpdate; | |
96 LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat; | |
97 | |
98 TilingOption m_tilingOption; | |
99 OwnPtr<CCLayerTilingData> m_tiler; | |
100 }; | |
101 | |
102 } | |
103 #endif // USE(ACCELERATED_COMPOSITING) | |
104 | |
105 #endif | |
OLD | NEW |