diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-22 03:28:05 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-22 03:28:05 +0000 |
commit | f8936a7662f5ccc53df6789ef7fce57ac2d52670 (patch) | |
tree | 28c57b9f2ee07921acff26e28a10576b31758117 /cc/test/tiled_layer_test_common.h | |
parent | e57d3e9e9f705ad2c9004156ac60f6e9b205e577 (diff) | |
download | chromium_src-f8936a7662f5ccc53df6789ef7fce57ac2d52670.zip chromium_src-f8936a7662f5ccc53df6789ef7fce57ac2d52670.tar.gz chromium_src-f8936a7662f5ccc53df6789ef7fce57ac2d52670.tar.bz2 |
cc chromification: tiled_layer_test_common.h/cc
BUG=144577
Review URL: https://codereview.chromium.org/12458014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189748 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/tiled_layer_test_common.h')
-rw-r--r-- | cc/test/tiled_layer_test_common.h | 205 |
1 files changed, 115 insertions, 90 deletions
diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h index 3b949c2..3012fd5 100644 --- a/cc/test/tiled_layer_test_common.h +++ b/cc/test/tiled_layer_test_common.h @@ -21,112 +21,137 @@ namespace cc { class FakeTiledLayer; -class FakeLayerUpdater : public cc::LayerUpdater { -public: - class Resource : public cc::LayerUpdater::Resource { - public: - Resource(FakeLayerUpdater*, scoped_ptr<cc::PrioritizedResource>); - virtual ~Resource(); - - virtual void Update(cc::ResourceUpdateQueue* queue, gfx::Rect source_rect, gfx::Vector2d dest_offset, bool partial_update, cc::RenderingStats* stats) OVERRIDE; - - private: - FakeLayerUpdater* m_layer; - SkBitmap m_bitmap; - }; - - FakeLayerUpdater(); - - virtual scoped_ptr<cc::LayerUpdater::Resource> CreateResource(cc::PrioritizedResourceManager* resource) OVERRIDE; - - virtual void PrepareToUpdate(gfx::Rect content_rect, gfx::Size tile_size, float contents_width_scale, float contents_height_scale, gfx::Rect* resulting_opaque_rect, RenderingStats* stats) OVERRIDE; - // Sets the rect to invalidate during the next call to prepareToUpdate(). After the next - // call to prepareToUpdate() the rect is reset. - void setRectToInvalidate(const gfx::Rect&, FakeTiledLayer*); - // Last rect passed to prepareToUpdate(). - const gfx::Rect& lastUpdateRect() const { return m_lastUpdateRect; } - - // Number of times prepareToUpdate has been invoked. - int prepareCount() const { return m_prepareCount; } - void clearPrepareCount() { m_prepareCount = 0; } - - // Number of times update() has been invoked on a texture. - int updateCount() const { return m_updateCount; } - void clearUpdateCount() { m_updateCount = 0; } - void update() { m_updateCount++; } - - void setOpaquePaintRect(const gfx::Rect& opaquePaintRect) { m_opaquePaintRect = opaquePaintRect; } - -protected: - virtual ~FakeLayerUpdater(); - -private: - int m_prepareCount; - int m_updateCount; - gfx::Rect m_rectToInvalidate; - gfx::Rect m_lastUpdateRect; - gfx::Rect m_opaquePaintRect; - scoped_refptr<FakeTiledLayer> m_layer; +class FakeLayerUpdater : public LayerUpdater { + public: + class Resource : public LayerUpdater::Resource { + public: + Resource(FakeLayerUpdater* updater, + scoped_ptr<PrioritizedResource> resource); + virtual ~Resource(); + + virtual void Update(ResourceUpdateQueue* queue, + gfx::Rect source_rect, + gfx::Vector2d dest_offset, + bool partial_update, + RenderingStats* stats) OVERRIDE; + + private: + FakeLayerUpdater* layer_; + SkBitmap bitmap_; + + DISALLOW_COPY_AND_ASSIGN(Resource); + }; + + FakeLayerUpdater(); + + virtual scoped_ptr<LayerUpdater::Resource> CreateResource( + PrioritizedResourceManager* resource) OVERRIDE; + + virtual void PrepareToUpdate(gfx::Rect content_rect, + gfx::Size tile_size, + float contents_width_scale, + float contents_height_scale, + gfx::Rect* resulting_opaque_rect, + RenderingStats* stats) OVERRIDE; + // Sets the rect to invalidate during the next call to PrepareToUpdate(). + // After the next call to PrepareToUpdate() the rect is reset. + void SetRectToInvalidate(gfx::Rect rect, FakeTiledLayer* layer); + // Last rect passed to PrepareToUpdate(). + gfx::Rect last_update_rect() const { return last_update_rect_; } + + // Number of times PrepareToUpdate has been invoked. + int prepare_count() const { return prepare_count_; } + void ClearPrepareCount() { prepare_count_ = 0; } + + // Number of times Update() has been invoked on a texture. + int update_count() const { return update_count_; } + void ClearUpdateCount() { update_count_ = 0; } + void Update() { update_count_++; } + + void SetOpaquePaintRect(gfx::Rect opaque_paint_rect) { + opaque_paint_rect_ = opaque_paint_rect; + } + + protected: + virtual ~FakeLayerUpdater(); + + private: + int prepare_count_; + int update_count_; + gfx::Rect rect_to_invalidate_; + gfx::Rect last_update_rect_; + gfx::Rect opaque_paint_rect_; + scoped_refptr<FakeTiledLayer> layer_; + + DISALLOW_COPY_AND_ASSIGN(FakeLayerUpdater); }; -class FakeTiledLayerImpl : public cc::TiledLayerImpl { -public: - FakeTiledLayerImpl(LayerTreeImpl* treeImpl, int id); - virtual ~FakeTiledLayerImpl(); +class FakeTiledLayerImpl : public TiledLayerImpl { + public: + FakeTiledLayerImpl(LayerTreeImpl* tree_impl, int id); + virtual ~FakeTiledLayerImpl(); - using cc::TiledLayerImpl::HasTileAt; - using cc::TiledLayerImpl::HasResourceIdForTileAt; + using TiledLayerImpl::HasTileAt; + using TiledLayerImpl::HasResourceIdForTileAt; }; -class FakeTiledLayer : public cc::TiledLayer { -public: - explicit FakeTiledLayer(cc::PrioritizedResourceManager*); +class FakeTiledLayer : public TiledLayer { + public: + explicit FakeTiledLayer(PrioritizedResourceManager* resource_manager); - static gfx::Size tileSize() { return gfx::Size(100, 100); } + static gfx::Size tile_size() { return gfx::Size(100, 100); } - using cc::TiledLayer::InvalidateContentRect; - using cc::TiledLayer::NeedsIdlePaint; - using cc::TiledLayer::SkipsDraw; - using cc::TiledLayer::NumPaintedTiles; - using cc::TiledLayer::IdlePaintRect; + using TiledLayer::InvalidateContentRect; + using TiledLayer::NeedsIdlePaint; + using TiledLayer::SkipsDraw; + using TiledLayer::NumPaintedTiles; + using TiledLayer::IdlePaintRect; - virtual void SetNeedsDisplayRect(const gfx::RectF&) OVERRIDE; - const gfx::RectF& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; } + virtual void SetNeedsDisplayRect(const gfx::RectF& rect) OVERRIDE; + const gfx::RectF& last_needs_display_rect() const { + return last_needs_display_rect_; + } - virtual void SetTexturePriorities(const cc::PriorityCalculator&) OVERRIDE; + virtual void SetTexturePriorities( + const PriorityCalculator& priority_calculator) OVERRIDE; - virtual cc::PrioritizedResourceManager* ResourceManager() const OVERRIDE; - FakeLayerUpdater* fakeLayerUpdater() { return m_fakeUpdater.get(); } - gfx::RectF updateRect() { return update_rect_; } + virtual PrioritizedResourceManager* ResourceManager() const OVERRIDE; + FakeLayerUpdater* fake_layer_updater() { return fake_updater_.get(); } + gfx::RectF update_rect() { return update_rect_; } - // Simulate calcDrawProperties. - void updateContentsScale(float idealContentsScale); + // Simulate calcDrawProperties. + void UpdateContentsScale(float ideal_contents_scale); -protected: - virtual cc::LayerUpdater* Updater() const OVERRIDE; - virtual void CreateUpdaterIfNeeded() OVERRIDE { } - virtual ~FakeTiledLayer(); + protected: + virtual LayerUpdater* Updater() const OVERRIDE; + virtual void CreateUpdaterIfNeeded() OVERRIDE {} + virtual ~FakeTiledLayer(); -private: - scoped_refptr<FakeLayerUpdater> m_fakeUpdater; - cc::PrioritizedResourceManager* m_resourceManager; - gfx::RectF m_lastNeedsDisplayRect; + private: + scoped_refptr<FakeLayerUpdater> fake_updater_; + PrioritizedResourceManager* resource_manager_; + gfx::RectF last_needs_display_rect_; + + DISALLOW_COPY_AND_ASSIGN(FakeTiledLayer); }; class FakeTiledLayerWithScaledBounds : public FakeTiledLayer { -public: - explicit FakeTiledLayerWithScaledBounds(cc::PrioritizedResourceManager*); - - void setContentBounds(const gfx::Size& contentBounds); - virtual void CalculateContentsScale(float idealContentsScale, - bool animatingTransformToScreen, - float* contentsScaleX, - float* contentsScaleY, - gfx::Size* contentBounds) OVERRIDE; - -protected: - virtual ~FakeTiledLayerWithScaledBounds(); - gfx::Size m_forcedContentBounds; + public: + explicit FakeTiledLayerWithScaledBounds( + PrioritizedResourceManager* resource_manager); + + void SetContentBounds(gfx::Size content_bounds); + virtual void CalculateContentsScale(float ideal_contents_scale, + bool animating_transform_to_screen, + float* contents_scale_x, + float* contents_scale_y, + gfx::Size* content_bounds) OVERRIDE; + + protected: + virtual ~FakeTiledLayerWithScaledBounds(); + gfx::Size forced_content_bounds_; + + DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds); }; } // namespace cc |