| 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 "CCGraphicsContext.h" | 8 #include "CCGraphicsContext.h" |
| 9 #include "CCPrioritizedTexture.h" | 9 #include "CCPrioritizedTexture.h" |
| 10 #include "CCResourceProvider.h" | 10 #include "CCResourceProvider.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 Texture(FakeLayerTextureUpdater*, scoped_ptr<cc::CCPrioritizedTexture>); | 29 Texture(FakeLayerTextureUpdater*, scoped_ptr<cc::CCPrioritizedTexture>); |
| 30 virtual ~Texture(); | 30 virtual ~Texture(); |
| 31 | 31 |
| 32 virtual void update(cc::CCTextureUpdateQueue&, const cc::IntRect&, const
cc::IntSize&, bool, cc::CCRenderingStats&) OVERRIDE; | 32 virtual void update(cc::CCTextureUpdateQueue&, const cc::IntRect&, const
cc::IntSize&, bool, cc::CCRenderingStats&) OVERRIDE; |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 FakeLayerTextureUpdater* m_layer; | 35 FakeLayerTextureUpdater* m_layer; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 FakeLayerTextureUpdater(); | 38 FakeLayerTextureUpdater(); |
| 39 virtual ~FakeLayerTextureUpdater(); | |
| 40 | 39 |
| 41 virtual PassOwnPtr<cc::LayerTextureUpdater::Texture> createTexture(cc::CCPri
oritizedTextureManager*) OVERRIDE; | 40 virtual scoped_ptr<cc::LayerTextureUpdater::Texture> createTexture(cc::CCPri
oritizedTextureManager*) OVERRIDE; |
| 42 virtual SampledTexelFormat sampledTexelFormat(GC3Denum) OVERRIDE; | 41 virtual SampledTexelFormat sampledTexelFormat(GC3Denum) OVERRIDE; |
| 43 | 42 |
| 44 virtual void prepareToUpdate(const cc::IntRect& contentRect, const cc::IntSi
ze&, float, float, cc::IntRect& resultingOpaqueRect, cc::CCRenderingStats&) OVER
RIDE; | 43 virtual void prepareToUpdate(const cc::IntRect& contentRect, const cc::IntSi
ze&, float, float, cc::IntRect& resultingOpaqueRect, cc::CCRenderingStats&) OVER
RIDE; |
| 45 // Sets the rect to invalidate during the next call to prepareToUpdate(). Af
ter the next | 44 // Sets the rect to invalidate during the next call to prepareToUpdate(). Af
ter the next |
| 46 // call to prepareToUpdate() the rect is reset. | 45 // call to prepareToUpdate() the rect is reset. |
| 47 void setRectToInvalidate(const cc::IntRect&, FakeTiledLayerChromium*); | 46 void setRectToInvalidate(const cc::IntRect&, FakeTiledLayerChromium*); |
| 48 // Last rect passed to prepareToUpdate(). | 47 // Last rect passed to prepareToUpdate(). |
| 49 const cc::IntRect& lastUpdateRect() const { return m_lastUpdateRect; } | 48 const cc::IntRect& lastUpdateRect() const { return m_lastUpdateRect; } |
| 50 | 49 |
| 51 // Number of times prepareToUpdate has been invoked. | 50 // Number of times prepareToUpdate has been invoked. |
| 52 int prepareCount() const { return m_prepareCount; } | 51 int prepareCount() const { return m_prepareCount; } |
| 53 void clearPrepareCount() { m_prepareCount = 0; } | 52 void clearPrepareCount() { m_prepareCount = 0; } |
| 54 | 53 |
| 55 // Number of times update() has been invoked on a texture. | 54 // Number of times update() has been invoked on a texture. |
| 56 int updateCount() const { return m_updateCount; } | 55 int updateCount() const { return m_updateCount; } |
| 57 void clearUpdateCount() { m_updateCount = 0; } | 56 void clearUpdateCount() { m_updateCount = 0; } |
| 58 void update() { m_updateCount++; } | 57 void update() { m_updateCount++; } |
| 59 | 58 |
| 60 void setOpaquePaintRect(const cc::IntRect& opaquePaintRect) { m_opaquePaintR
ect = opaquePaintRect; } | 59 void setOpaquePaintRect(const cc::IntRect& opaquePaintRect) { m_opaquePaintR
ect = opaquePaintRect; } |
| 61 | 60 |
| 61 protected: |
| 62 virtual ~FakeLayerTextureUpdater(); |
| 63 |
| 62 private: | 64 private: |
| 63 int m_prepareCount; | 65 int m_prepareCount; |
| 64 int m_updateCount; | 66 int m_updateCount; |
| 65 cc::IntRect m_rectToInvalidate; | 67 cc::IntRect m_rectToInvalidate; |
| 66 cc::IntRect m_lastUpdateRect; | 68 cc::IntRect m_lastUpdateRect; |
| 67 cc::IntRect m_opaquePaintRect; | 69 cc::IntRect m_opaquePaintRect; |
| 68 scoped_refptr<FakeTiledLayerChromium> m_layer; | 70 scoped_refptr<FakeTiledLayerChromium> m_layer; |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 class FakeCCTiledLayerImpl : public cc::CCTiledLayerImpl { | 73 class FakeCCTiledLayerImpl : public cc::CCTiledLayerImpl { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 97 virtual cc::CCPrioritizedTextureManager* textureManager() const OVERRIDE; | 99 virtual cc::CCPrioritizedTextureManager* textureManager() const OVERRIDE; |
| 98 FakeLayerTextureUpdater* fakeLayerTextureUpdater() { return m_fakeTextureUpd
ater.get(); } | 100 FakeLayerTextureUpdater* fakeLayerTextureUpdater() { return m_fakeTextureUpd
ater.get(); } |
| 99 cc::FloatRect updateRect() { return m_updateRect; } | 101 cc::FloatRect updateRect() { return m_updateRect; } |
| 100 | 102 |
| 101 protected: | 103 protected: |
| 102 virtual cc::LayerTextureUpdater* textureUpdater() const OVERRIDE; | 104 virtual cc::LayerTextureUpdater* textureUpdater() const OVERRIDE; |
| 103 virtual void createTextureUpdaterIfNeeded() OVERRIDE { } | 105 virtual void createTextureUpdaterIfNeeded() OVERRIDE { } |
| 104 virtual ~FakeTiledLayerChromium(); | 106 virtual ~FakeTiledLayerChromium(); |
| 105 | 107 |
| 106 private: | 108 private: |
| 107 RefPtr<FakeLayerTextureUpdater> m_fakeTextureUpdater; | 109 scoped_refptr<FakeLayerTextureUpdater> m_fakeTextureUpdater; |
| 108 cc::CCPrioritizedTextureManager* m_textureManager; | 110 cc::CCPrioritizedTextureManager* m_textureManager; |
| 109 cc::FloatRect m_lastNeedsDisplayRect; | 111 cc::FloatRect m_lastNeedsDisplayRect; |
| 110 }; | 112 }; |
| 111 | 113 |
| 112 class FakeTiledLayerWithScaledBounds : public FakeTiledLayerChromium { | 114 class FakeTiledLayerWithScaledBounds : public FakeTiledLayerChromium { |
| 113 public: | 115 public: |
| 114 explicit FakeTiledLayerWithScaledBounds(cc::CCPrioritizedTextureManager*); | 116 explicit FakeTiledLayerWithScaledBounds(cc::CCPrioritizedTextureManager*); |
| 115 | 117 |
| 116 void setContentBounds(const cc::IntSize& contentBounds) { m_forcedContentBou
nds = contentBounds; } | 118 void setContentBounds(const cc::IntSize& contentBounds) { m_forcedContentBou
nds = contentBounds; } |
| 117 virtual cc::IntSize contentBounds() const OVERRIDE; | 119 virtual cc::IntSize contentBounds() const OVERRIDE; |
| 118 | 120 |
| 119 protected: | 121 protected: |
| 120 virtual ~FakeTiledLayerWithScaledBounds(); | 122 virtual ~FakeTiledLayerWithScaledBounds(); |
| 121 cc::IntSize m_forcedContentBounds; | 123 cc::IntSize m_forcedContentBounds; |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 | 126 |
| 125 class FakeTextureUploader : public cc::TextureUploader { | 127 class FakeTextureUploader : public cc::TextureUploader { |
| 126 public: | 128 public: |
| 127 virtual size_t numBlockingUploads() OVERRIDE; | 129 virtual size_t numBlockingUploads() OVERRIDE; |
| 128 virtual void markPendingUploadsAsNonBlocking() OVERRIDE; | 130 virtual void markPendingUploadsAsNonBlocking() OVERRIDE; |
| 129 virtual double estimatedTexturesPerSecond() OVERRIDE; | 131 virtual double estimatedTexturesPerSecond() OVERRIDE; |
| 130 virtual void uploadTexture(cc::CCResourceProvider*, Parameters) OVERRIDE; | 132 virtual void uploadTexture(cc::CCResourceProvider*, Parameters) OVERRIDE; |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 } | 135 } |
| 134 #endif // CCTiledLayerTestCommon_h | 136 #endif // CCTiledLayerTestCommon_h |
| OLD | NEW |