| OLD | NEW |
| 1 // Copyright 2012 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 CCTiledLayerTestCommon_h | 5 #ifndef CCTiledLayerTestCommon_h |
| 6 #define CCTiledLayerTestCommon_h | 6 #define CCTiledLayerTestCommon_h |
| 7 | 7 |
| 8 #include "IntRect.h" | 8 #include "IntRect.h" |
| 9 #include "IntSize.h" | 9 #include "IntSize.h" |
| 10 #include "Region.h" | 10 #include "Region.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 class FakeTiledLayer; | 22 class FakeTiledLayer; |
| 23 | 23 |
| 24 class FakeLayerUpdater : public cc::LayerUpdater { | 24 class FakeLayerUpdater : public cc::LayerUpdater { |
| 25 public: | 25 public: |
| 26 class Resource : public cc::LayerUpdater::Resource { | 26 class Resource : public cc::LayerUpdater::Resource { |
| 27 public: | 27 public: |
| 28 Resource(FakeLayerUpdater*, scoped_ptr<cc::PrioritizedTexture>); | 28 Resource(FakeLayerUpdater*, scoped_ptr<cc::PrioritizedTexture>); |
| 29 virtual ~Resource(); | 29 virtual ~Resource(); |
| 30 | 30 |
| 31 virtual void update(cc::ResourceUpdateQueue&, const cc::IntRect&, const
cc::IntSize&, bool, cc::RenderingStats&) OVERRIDE; | 31 virtual void update(cc::ResourceUpdateQueue&, const gfx::Rect&, const gf
x::Vector2d&, bool, cc::RenderingStats&) OVERRIDE; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 FakeLayerUpdater* m_layer; | 34 FakeLayerUpdater* m_layer; |
| 35 SkBitmap m_bitmap; | 35 SkBitmap m_bitmap; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 FakeLayerUpdater(); | 38 FakeLayerUpdater(); |
| 39 | 39 |
| 40 virtual scoped_ptr<cc::LayerUpdater::Resource> createResource(cc::Prioritize
dTextureManager*) OVERRIDE; | 40 virtual scoped_ptr<cc::LayerUpdater::Resource> createResource(cc::Prioritize
dTextureManager*) OVERRIDE; |
| 41 | 41 |
| 42 virtual void prepareToUpdate(const cc::IntRect& contentRect, const cc::IntSi
ze&, float, float, cc::IntRect& resultingOpaqueRect, cc::RenderingStats&) OVERRI
DE; | 42 virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&,
float, float, gfx::Rect& resultingOpaqueRect, cc::RenderingStats&) OVERRIDE; |
| 43 // Sets the rect to invalidate during the next call to prepareToUpdate(). Af
ter the next | 43 // Sets the rect to invalidate during the next call to prepareToUpdate(). Af
ter the next |
| 44 // call to prepareToUpdate() the rect is reset. | 44 // call to prepareToUpdate() the rect is reset. |
| 45 void setRectToInvalidate(const cc::IntRect&, FakeTiledLayer*); | 45 void setRectToInvalidate(const cc::IntRect&, FakeTiledLayer*); |
| 46 // Last rect passed to prepareToUpdate(). | 46 // Last rect passed to prepareToUpdate(). |
| 47 const cc::IntRect& lastUpdateRect() const { return m_lastUpdateRect; } | 47 const gfx::Rect& lastUpdateRect() const { return m_lastUpdateRect; } |
| 48 | 48 |
| 49 // Number of times prepareToUpdate has been invoked. | 49 // Number of times prepareToUpdate has been invoked. |
| 50 int prepareCount() const { return m_prepareCount; } | 50 int prepareCount() const { return m_prepareCount; } |
| 51 void clearPrepareCount() { m_prepareCount = 0; } | 51 void clearPrepareCount() { m_prepareCount = 0; } |
| 52 | 52 |
| 53 // Number of times update() has been invoked on a texture. | 53 // Number of times update() has been invoked on a texture. |
| 54 int updateCount() const { return m_updateCount; } | 54 int updateCount() const { return m_updateCount; } |
| 55 void clearUpdateCount() { m_updateCount = 0; } | 55 void clearUpdateCount() { m_updateCount = 0; } |
| 56 void update() { m_updateCount++; } | 56 void update() { m_updateCount++; } |
| 57 | 57 |
| 58 void setOpaquePaintRect(const cc::IntRect& opaquePaintRect) { m_opaquePaintR
ect = opaquePaintRect; } | 58 void setOpaquePaintRect(const gfx::Rect& opaquePaintRect) { m_opaquePaintRec
t = opaquePaintRect; } |
| 59 | 59 |
| 60 protected: | 60 protected: |
| 61 virtual ~FakeLayerUpdater(); | 61 virtual ~FakeLayerUpdater(); |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 int m_prepareCount; | 64 int m_prepareCount; |
| 65 int m_updateCount; | 65 int m_updateCount; |
| 66 cc::IntRect m_rectToInvalidate; | 66 cc::IntRect m_rectToInvalidate; |
| 67 cc::IntRect m_lastUpdateRect; | 67 gfx::Rect m_lastUpdateRect; |
| 68 cc::IntRect m_opaquePaintRect; | 68 gfx::Rect m_opaquePaintRect; |
| 69 scoped_refptr<FakeTiledLayer> m_layer; | 69 scoped_refptr<FakeTiledLayer> m_layer; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 class FakeTiledLayerImpl : public cc::TiledLayerImpl { | 72 class FakeTiledLayerImpl : public cc::TiledLayerImpl { |
| 73 public: | 73 public: |
| 74 explicit FakeTiledLayerImpl(int id); | 74 explicit FakeTiledLayerImpl(int id); |
| 75 virtual ~FakeTiledLayerImpl(); | 75 virtual ~FakeTiledLayerImpl(); |
| 76 | 76 |
| 77 using cc::TiledLayerImpl::hasTileAt; | 77 using cc::TiledLayerImpl::hasTileAt; |
| 78 using cc::TiledLayerImpl::hasResourceIdForTileAt; | 78 using cc::TiledLayerImpl::hasResourceIdForTileAt; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void setContentBounds(const cc::IntSize& contentBounds) { m_forcedContentBou
nds = contentBounds; } | 117 void setContentBounds(const cc::IntSize& contentBounds) { m_forcedContentBou
nds = contentBounds; } |
| 118 virtual cc::IntSize contentBounds() const OVERRIDE; | 118 virtual cc::IntSize contentBounds() const OVERRIDE; |
| 119 | 119 |
| 120 protected: | 120 protected: |
| 121 virtual ~FakeTiledLayerWithScaledBounds(); | 121 virtual ~FakeTiledLayerWithScaledBounds(); |
| 122 cc::IntSize m_forcedContentBounds; | 122 cc::IntSize m_forcedContentBounds; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 } | 125 } |
| 126 #endif // CCTiledLayerTestCommon_h | 126 #endif // CCTiledLayerTestCommon_h |
| OLD | NEW |