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

Unified Diff: cc/layer_tree_host_common_unittest.cc

Issue 11503005: cc: Refactor content scale/bounds into draw properties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: cc/layer_tree_host_common_unittest.cc
diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc
index a3dffad48e96047e8ea47b0ed9a51a58ce7d4c99..3a1d872d225ed86dc909ab8103a0b92c386e9fd2 100644
--- a/cc/layer_tree_host_common_unittest.cc
+++ b/cc/layer_tree_host_common_unittest.cc
@@ -2408,12 +2408,12 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsInHighDPI)
setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
const double deviceScaleFactor = 2;
- root->setContentsScale(deviceScaleFactor);
- renderSurface1->setContentsScale(deviceScaleFactor);
- renderSurface2->setContentsScale(deviceScaleFactor);
- child1->setContentsScale(deviceScaleFactor);
- child2->setContentsScale(deviceScaleFactor);
- child3->setContentsScale(deviceScaleFactor);
+ root->setIdealContentsScale(deviceScaleFactor);
+ renderSurface1->setIdealContentsScale(deviceScaleFactor);
+ renderSurface2->setIdealContentsScale(deviceScaleFactor);
+ child1->setIdealContentsScale(deviceScaleFactor);
+ child2->setIdealContentsScale(deviceScaleFactor);
+ child3->setIdealContentsScale(deviceScaleFactor);
root->setMasksToBounds(true);
renderSurface1->setForceRenderSurface(true);
@@ -3978,9 +3978,15 @@ class NoScaleContentLayer : public ContentLayer
public:
static scoped_refptr<NoScaleContentLayer> create(ContentLayerClient* client) { return make_scoped_refptr(new NoScaleContentLayer(client)); }
- virtual gfx::Size contentBounds() const OVERRIDE { return bounds(); }
- virtual float contentsScaleX() const OVERRIDE { return 1.0; }
- virtual float contentsScaleY() const OVERRIDE { return 1.0; }
+ virtual void didUpdateBounds() OVERRIDE
+ {
+ Layer::didUpdateBounds();
+ }
+
+ virtual void setIdealContentsScale(float idealContentsScale) OVERRIDE
+ {
+ Layer::setIdealContentsScale(idealContentsScale);
+ }
protected:
explicit NoScaleContentLayer(ContentLayerClient* client) : ContentLayer(client) { }
@@ -4534,10 +4540,10 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
int dummyMaxTextureSize = 512;
const double deviceScaleFactor = 1.5;
- parent->setContentsScale(deviceScaleFactor);
- child->setContentsScale(deviceScaleFactor);
- duplicateChildNonOwner->setContentsScale(deviceScaleFactor);
- replica->setContentsScale(deviceScaleFactor);
+ parent->setIdealContentsScale(deviceScaleFactor);
+ child->setIdealContentsScale(deviceScaleFactor);
+ duplicateChildNonOwner->setIdealContentsScale(deviceScaleFactor);
+ replica->setIdealContentsScale(deviceScaleFactor);
LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(), deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList);
@@ -4617,10 +4623,10 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPIAccurateScal
int dummyMaxTextureSize = 512;
const float deviceScaleFactor = 1.7f;
- parent->setContentsScale(deviceScaleFactor);
- child->setContentsScale(deviceScaleFactor);
- duplicateChildNonOwner->setContentsScale(deviceScaleFactor);
- replica->setContentsScale(deviceScaleFactor);
+ parent->setIdealContentsScale(deviceScaleFactor);
+ child->setIdealContentsScale(deviceScaleFactor);
+ duplicateChildNonOwner->setIdealContentsScale(deviceScaleFactor);
+ replica->setIdealContentsScale(deviceScaleFactor);
LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(), deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList);

Powered by Google App Engine
This is Rietveld 408576698