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