| 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 CC_TILED_LAYER_H_ | 5 #ifndef CC_TILED_LAYER_H_ |
| 6 #define CC_TILED_LAYER_H_ | 6 #define CC_TILED_LAYER_H_ |
| 7 | 7 |
| 8 #include "cc/cc_export.h" | 8 #include "cc/cc_export.h" |
| 9 #include "cc/contents_scaling_layer.h" | 9 #include "cc/contents_scaling_layer.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 LayerUpdater; | 13 class LayerUpdater; |
| 14 class PrioritizedResourceManager; | 14 class PrioritizedResourceManager; |
| 15 class PrioritizedResource; | 15 class PrioritizedResource; |
| 16 class UpdatableTile; | 16 class UpdatableTile; |
| 17 | 17 |
| 18 class CC_EXPORT TiledLayer : public ContentsScalingLayer { | 18 class CC_EXPORT TiledLayer : public ContentsScalingLayer { |
| 19 public: | 19 public: |
| 20 enum TilingOption { AlwaysTile, NeverTile, AutoTile }; | 20 enum TilingOption { AlwaysTile, NeverTile, AutoTile }; |
| 21 | 21 |
| 22 virtual void setIsMask(bool) OVERRIDE; | 22 virtual void SetIsMask(bool) OVERRIDE; |
| 23 | 23 virtual void PushPropertiesTo(LayerImpl*) OVERRIDE; |
| 24 virtual void pushPropertiesTo(LayerImpl*) OVERRIDE; | 24 virtual bool BlocksPendingCommit() const OVERRIDE; |
| 25 | 25 virtual bool DrawsContent() const OVERRIDE; |
| 26 virtual bool blocksPendingCommit() const OVERRIDE; | 26 virtual void SetNeedsDisplayRect(const gfx::RectF&) OVERRIDE; |
| 27 | 27 virtual void SetLayerTreeHost(LayerTreeHost*) OVERRIDE; |
| 28 virtual bool drawsContent() const OVERRIDE; | 28 virtual void SetTexturePriorities(const PriorityCalculator&) OVERRIDE; |
| 29 | 29 virtual Region VisibleContentOpaqueRegion() const OVERRIDE; |
| 30 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE; | 30 virtual void Update(ResourceUpdateQueue*, const OcclusionTracker*, Rendering
Stats*) OVERRIDE; |
| 31 | |
| 32 virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE; | |
| 33 | |
| 34 virtual void setTexturePriorities(const PriorityCalculator&) OVERRIDE; | |
| 35 | |
| 36 virtual Region visibleContentOpaqueRegion() const OVERRIDE; | |
| 37 | |
| 38 virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, Rendering
Stats*) OVERRIDE; | |
| 39 | 31 |
| 40 protected: | 32 protected: |
| 41 TiledLayer(); | 33 TiledLayer(); |
| 42 virtual ~TiledLayer(); | 34 virtual ~TiledLayer(); |
| 43 | 35 |
| 44 void updateTileSizeAndTilingOption(); | 36 void updateTileSizeAndTilingOption(); |
| 45 void updateBounds(); | 37 void updateBounds(); |
| 46 | 38 |
| 47 // Exposed to subclasses for testing. | 39 // Exposed to subclasses for testing. |
| 48 void setTileSize(const gfx::Size&); | 40 void setTileSize(const gfx::Size&); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 64 gfx::Rect idlePaintRect(); | 56 gfx::Rect idlePaintRect(); |
| 65 | 57 |
| 66 bool skipsDraw() const { return m_skipsDraw; } | 58 bool skipsDraw() const { return m_skipsDraw; } |
| 67 | 59 |
| 68 // Virtual for testing | 60 // Virtual for testing |
| 69 virtual PrioritizedResourceManager* resourceManager() const; | 61 virtual PrioritizedResourceManager* resourceManager() const; |
| 70 const LayerTilingData* tilerForTesting() const { return m_tiler.get(); } | 62 const LayerTilingData* tilerForTesting() const { return m_tiler.get(); } |
| 71 const PrioritizedResource* resourceAtForTesting(int, int) const; | 63 const PrioritizedResource* resourceAtForTesting(int, int) const; |
| 72 | 64 |
| 73 private: | 65 private: |
| 74 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERR
IDE; | 66 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* treeImpl) OVERR
IDE; |
| 75 | 67 |
| 76 void createTilerIfNeeded(); | 68 void createTilerIfNeeded(); |
| 77 void setTilingOption(TilingOption); | 69 void setTilingOption(TilingOption); |
| 78 | 70 |
| 79 bool tileOnlyNeedsPartialUpdate(UpdatableTile*); | 71 bool tileOnlyNeedsPartialUpdate(UpdatableTile*); |
| 80 bool tileNeedsBufferedUpdate(UpdatableTile*); | 72 bool tileNeedsBufferedUpdate(UpdatableTile*); |
| 81 | 73 |
| 82 void markOcclusionsAndRequestTextures(int left, int top, int right, int bott
om, const OcclusionTracker*); | 74 void markOcclusionsAndRequestTextures(int left, int top, int right, int bott
om, const OcclusionTracker*); |
| 83 | 75 |
| 84 bool updateTiles(int left, int top, int right, int bottom, ResourceUpdateQue
ue&, const OcclusionTracker*, RenderingStats*, bool& didPaint); | 76 bool updateTiles(int left, int top, int right, int bottom, ResourceUpdateQue
ue*, const OcclusionTracker*, RenderingStats*, bool& didPaint); |
| 85 bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ign
oreOcclusions); | 77 bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ign
oreOcclusions); |
| 86 gfx::Rect markTilesForUpdate(int left, int top, int right, int bottom, bool
ignoreOcclusions); | 78 gfx::Rect markTilesForUpdate(int left, int top, int right, int bottom, bool
ignoreOcclusions); |
| 87 void updateTileTextures(const gfx::Rect& paintRect, int left, int top, int r
ight, int bottom, ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats*
); | 79 void updateTileTextures(const gfx::Rect& paintRect, int left, int top, int r
ight, int bottom, ResourceUpdateQueue*, const OcclusionTracker*, RenderingStats*
); |
| 88 void updateScrollPrediction(); | 80 void updateScrollPrediction(); |
| 89 | 81 |
| 90 UpdatableTile* tileAt(int, int) const; | 82 UpdatableTile* tileAt(int, int) const; |
| 91 UpdatableTile* createTile(int, int); | 83 UpdatableTile* createTile(int, int); |
| 92 | 84 |
| 93 bool isSmallAnimatedLayer() const; | 85 bool isSmallAnimatedLayer() const; |
| 94 | 86 |
| 95 unsigned m_textureFormat; | 87 unsigned m_textureFormat; |
| 96 bool m_skipsDraw; | 88 bool m_skipsDraw; |
| 97 bool m_failedUpdate; | 89 bool m_failedUpdate; |
| 98 | 90 |
| 99 // Used for predictive painting. | 91 // Used for predictive painting. |
| 100 gfx::Vector2d m_predictedScroll; | 92 gfx::Vector2d m_predictedScroll; |
| 101 gfx::Rect m_predictedVisibleRect; | 93 gfx::Rect m_predictedVisibleRect; |
| 102 gfx::Rect m_previousVisibleRect; | 94 gfx::Rect m_previousVisibleRect; |
| 103 gfx::Size m_previousContentBounds; | 95 gfx::Size m_previousContentBounds; |
| 104 | 96 |
| 105 TilingOption m_tilingOption; | 97 TilingOption m_tilingOption; |
| 106 scoped_ptr<LayerTilingData> m_tiler; | 98 scoped_ptr<LayerTilingData> m_tiler; |
| 107 }; | 99 }; |
| 108 | 100 |
| 109 } | 101 } |
| 110 #endif // CC_TILED_LAYER_H_ | 102 #endif // CC_TILED_LAYER_H_ |
| OLD | NEW |