OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 #ifndef TiledLayerChromium_h |
6 #define TiledLayerChromium_h | 6 #define TiledLayerChromium_h |
7 | 7 |
8 #include "cc/contents_scaling_layer.h" | 8 #include "cc/contents_scaling_layer.h" |
9 #include "cc/layer_updater.h" | 9 #include "cc/layer_updater.h" |
10 #include "cc/layer_tiling_data.h" | 10 #include "cc/layer_tiling_data.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 class UpdatableTile; | 13 class UpdatableTile; |
14 | 14 |
15 class TiledLayer : public ContentsScalingLayer { | 15 class TiledLayer : public ContentsScalingLayer { |
16 public: | 16 public: |
17 enum TilingOption { AlwaysTile, NeverTile, AutoTile }; | 17 enum TilingOption { AlwaysTile, NeverTile, AutoTile }; |
18 | 18 |
19 virtual void setIsMask(bool) OVERRIDE; | 19 virtual void setIsMask(bool) OVERRIDE; |
20 | 20 |
21 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; | 21 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; |
22 | 22 |
23 virtual bool drawsContent() const OVERRIDE; | 23 virtual bool drawsContent() const OVERRIDE; |
24 | 24 |
25 virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE; | 25 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE; |
26 | 26 |
27 virtual void setUseLCDText(bool) OVERRIDE; | 27 virtual void setUseLCDText(bool) OVERRIDE; |
28 | 28 |
29 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; | 29 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; |
30 | 30 |
31 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; | 31 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; |
32 | 32 |
33 virtual Region visibleContentOpaqueRegion() const OVERRIDE; | 33 virtual Region visibleContentOpaqueRegion() const OVERRIDE; |
34 | 34 |
35 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats&) OVERRIDE; | 35 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats&) OVERRIDE; |
36 | 36 |
37 protected: | 37 protected: |
38 TiledLayer(); | 38 TiledLayer(); |
39 virtual ~TiledLayer(); | 39 virtual ~TiledLayer(); |
40 | 40 |
41 void updateTileSizeAndTilingOption(); | 41 void updateTileSizeAndTilingOption(); |
42 void updateBounds(); | 42 void updateBounds(); |
43 | 43 |
44 // Exposed to subclasses for testing. | 44 // Exposed to subclasses for testing. |
45 void setTileSize(const IntSize&); | 45 void setTileSize(const gfx::Size&); |
46 void setTextureFormat(GLenum textureFormat) { m_textureFormat = textureForma
t; } | 46 void setTextureFormat(GLenum textureFormat) { m_textureFormat = textureForma
t; } |
47 void setBorderTexelOption(LayerTilingData::BorderTexelOption); | 47 void setBorderTexelOption(LayerTilingData::BorderTexelOption); |
48 size_t numPaintedTiles() { return m_tiler->tiles().size(); } | 48 size_t numPaintedTiles() { return m_tiler->tiles().size(); } |
49 | 49 |
50 virtual LayerUpdater* updater() const = 0; | 50 virtual LayerUpdater* updater() const = 0; |
51 virtual void createUpdaterIfNeeded() = 0; | 51 virtual void createUpdaterIfNeeded() = 0; |
52 | 52 |
53 // Set invalidations to be potentially repainted during update(). | 53 // Set invalidations to be potentially repainted during update(). |
54 void invalidateContentRect(const IntRect& contentRect); | 54 void invalidateContentRect(const gfx::Rect& contentRect); |
55 | 55 |
56 // Reset state on tiles that will be used for updating the layer. | 56 // Reset state on tiles that will be used for updating the layer. |
57 void resetUpdateState(); | 57 void resetUpdateState(); |
58 | 58 |
59 // After preparing an update, returns true if more painting is needed. | 59 // After preparing an update, returns true if more painting is needed. |
60 bool needsIdlePaint(); | 60 bool needsIdlePaint(); |
61 IntRect idlePaintRect(); | 61 gfx::Rect idlePaintRect(); |
62 | 62 |
63 bool skipsDraw() const { return m_skipsDraw; } | 63 bool skipsDraw() const { return m_skipsDraw; } |
64 | 64 |
65 // Virtual for testing | 65 // Virtual for testing |
66 virtual PrioritizedTextureManager* textureManager() const; | 66 virtual PrioritizedTextureManager* textureManager() const; |
67 | 67 |
68 private: | 68 private: |
69 virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; | 69 virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE; |
70 | 70 |
71 void createTilerIfNeeded(); | 71 void createTilerIfNeeded(); |
72 void setTilingOption(TilingOption); | 72 void setTilingOption(TilingOption); |
73 | 73 |
74 bool tileOnlyNeedsPartialUpdate(UpdatableTile*); | 74 bool tileOnlyNeedsPartialUpdate(UpdatableTile*); |
75 bool tileNeedsBufferedUpdate(UpdatableTile*); | 75 bool tileNeedsBufferedUpdate(UpdatableTile*); |
76 | 76 |
77 void markOcclusionsAndRequestTextures(int left, int top, int right, int bott
om, const OcclusionTracker*); | 77 void markOcclusionsAndRequestTextures(int left, int top, int right, int bott
om, const OcclusionTracker*); |
78 | 78 |
79 bool updateTiles(int left, int top, int right, int bottom, ResourceUpdateQue
ue&, const OcclusionTracker*, RenderingStats&, bool& didPaint); | 79 bool updateTiles(int left, int top, int right, int bottom, ResourceUpdateQue
ue&, const OcclusionTracker*, RenderingStats&, bool& didPaint); |
80 bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ign
oreOcclusions); | 80 bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ign
oreOcclusions); |
81 IntRect markTilesForUpdate(int left, int top, int right, int bottom, bool ig
noreOcclusions); | 81 gfx::Rect markTilesForUpdate(int left, int top, int right, int bottom, bool
ignoreOcclusions); |
82 void updateTileTextures(const IntRect& paintRect, int left, int top, int rig
ht, int bottom, ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&); | 82 void updateTileTextures(const gfx::Rect& paintRect, int left, int top, int r
ight, int bottom, ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&
); |
83 void updateScrollPrediction(); | 83 void updateScrollPrediction(); |
84 | 84 |
85 UpdatableTile* tileAt(int, int) const; | 85 UpdatableTile* tileAt(int, int) const; |
86 UpdatableTile* createTile(int, int); | 86 UpdatableTile* createTile(int, int); |
87 | 87 |
88 GLenum m_textureFormat; | 88 GLenum m_textureFormat; |
89 bool m_skipsDraw; | 89 bool m_skipsDraw; |
90 bool m_failedUpdate; | 90 bool m_failedUpdate; |
91 | 91 |
92 // Used for predictive painting. | 92 // Used for predictive painting. |
93 IntSize m_predictedScroll; | 93 gfx::Vector2d m_predictedScroll; |
94 IntRect m_predictedVisibleRect; | 94 gfx::Rect m_predictedVisibleRect; |
95 IntRect m_previousVisibleRect; | 95 gfx::Rect m_previousVisibleRect; |
96 IntSize m_previousContentBounds; | 96 gfx::Size m_previousContentBounds; |
97 | 97 |
98 TilingOption m_tilingOption; | 98 TilingOption m_tilingOption; |
99 scoped_ptr<LayerTilingData> m_tiler; | 99 scoped_ptr<LayerTilingData> m_tiler; |
100 }; | 100 }; |
101 | 101 |
102 } | 102 } |
103 #endif | 103 #endif |
OLD | NEW |