Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Unified Diff: cc/test/tiled_layer_test_common.cc

Issue 11503005: cc: Refactor content scale/bounds into draw properties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/tiled_layer_test_common.h ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/tiled_layer_test_common.cc
diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc
index 80106383c051ff6ea28e5997f04f7bdf083630d8..f891d36d8bf5d1caf4088a4448dd95ad06681793 100644
--- a/cc/test/tiled_layer_test_common.cc
+++ b/cc/test/tiled_layer_test_common.cc
@@ -134,29 +134,40 @@ cc::PrioritizedResourceManager* FakeTiledLayer::resourceManager() const
return m_resourceManager;
}
-cc::LayerUpdater* FakeTiledLayer::updater() const
+void FakeTiledLayer::updateContentsScale(float idealContentsScale)
{
- return m_fakeUpdater.get();
+ calculateContentsScale(
+ idealContentsScale,
+ &drawProperties().contents_scale_x,
+ &drawProperties().contents_scale_y,
+ &drawProperties().content_bounds);
}
-gfx::Size FakeTiledLayerWithScaledBounds::contentBounds() const
+cc::LayerUpdater* FakeTiledLayer::updater() const
{
- return m_forcedContentBounds;
+ return m_fakeUpdater.get();
}
-float FakeTiledLayerWithScaledBounds::contentsScaleX() const
+void FakeTiledLayerWithScaledBounds::setContentBounds(const gfx::Size& contentBounds)
{
- return static_cast<float>(m_forcedContentBounds.width()) / bounds().width();
+ m_forcedContentBounds = contentBounds;
+ drawProperties().content_bounds = m_forcedContentBounds;
}
-float FakeTiledLayerWithScaledBounds::contentsScaleY() const
+void FakeTiledLayerWithScaledBounds::calculateContentsScale(
+ float idealContentsScale,
+ float* contentsScaleX,
+ float* contentsScaleY,
+ gfx::Size* contentBounds)
{
- return static_cast<float>(m_forcedContentBounds.height()) / bounds().height();
+ *contentsScaleX = static_cast<float>(m_forcedContentBounds.width()) / bounds().width();
+ *contentsScaleY = static_cast<float>(m_forcedContentBounds.height()) / bounds().height();
+ *contentBounds = m_forcedContentBounds;
}
-void FakeTiledLayerWithScaledBounds::setContentsScale(float)
+void FakeTiledLayerWithScaledBounds::didUpdateBounds()
{
- NOTREACHED();
+ drawProperties().content_bounds = m_forcedContentBounds;
}
} // namespace
« no previous file with comments | « cc/test/tiled_layer_test_common.h ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698