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

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: Fix shadowing 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 15776469e6911b7405d9179195c8d3e60451b0b2..df7b717bd5febba011a5dec949b2958591b9b799 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->updateContentsScale(deviceScaleFactor);
+ renderSurface1->updateContentsScale(deviceScaleFactor);
+ renderSurface2->updateContentsScale(deviceScaleFactor);
+ child1->updateContentsScale(deviceScaleFactor);
+ child2->updateContentsScale(deviceScaleFactor);
+ child3->updateContentsScale(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 updateContentsScale(float idealContentsScale) OVERRIDE
+ {
+ Layer::updateContentsScale(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->updateContentsScale(deviceScaleFactor);
+ child->updateContentsScale(deviceScaleFactor);
+ duplicateChildNonOwner->updateContentsScale(deviceScaleFactor);
+ replica->updateContentsScale(deviceScaleFactor);
LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(), deviceScaleFactor, 1, dummyMaxTextureSize, false, 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->updateContentsScale(deviceScaleFactor);
+ child->updateContentsScale(deviceScaleFactor);
+ duplicateChildNonOwner->updateContentsScale(deviceScaleFactor);
+ replica->updateContentsScale(deviceScaleFactor);
LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(), deviceScaleFactor, 1, dummyMaxTextureSize, false, renderSurfaceLayerList);

Powered by Google App Engine
This is Rietveld 408576698