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

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: updateContentsScale => calculateContentsScale 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..8ddfbe5369b182280e6b7829481a1b45bcf6cba4 100644
--- a/cc/layer_tree_host_common_unittest.cc
+++ b/cc/layer_tree_host_common_unittest.cc
@@ -2408,12 +2408,6 @@ 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->setMasksToBounds(true);
renderSurface1->setForceRenderSurface(true);
@@ -3978,9 +3972,23 @@ 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
danakj 2012/12/14 22:58:41 You probably don't need this, as the contentScalin
enne (OOO) 2012/12/14 23:06:01 Done.
+ {
+ Layer::didUpdateBounds();
+ }
+
+ virtual void calculateContentsScale(
+ float idealContentsScale,
+ float* contentsScaleX,
+ float* contentsScaleY,
+ gfx::Size* contentBounds) OVERRIDE
+ {
+ Layer::calculateContentsScale(
+ idealContentsScale,
+ contentsScaleX,
+ contentsScaleY,
+ contentBounds);
+ }
protected:
explicit NoScaleContentLayer(ContentLayerClient* client) : ContentLayer(client) { }
@@ -4534,11 +4542,6 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
int dummyMaxTextureSize = 512;
const double deviceScaleFactor = 1.5;
- parent->setContentsScale(deviceScaleFactor);
- child->setContentsScale(deviceScaleFactor);
- duplicateChildNonOwner->setContentsScale(deviceScaleFactor);
- replica->setContentsScale(deviceScaleFactor);
-
LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(), deviceScaleFactor, 1, dummyMaxTextureSize, false, renderSurfaceLayerList);
// We should have two render surfaces. The root's render surface and child's
@@ -4617,11 +4620,6 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPIAccurateScal
int dummyMaxTextureSize = 512;
const float deviceScaleFactor = 1.7f;
- parent->setContentsScale(deviceScaleFactor);
- child->setContentsScale(deviceScaleFactor);
- duplicateChildNonOwner->setContentsScale(deviceScaleFactor);
- replica->setContentsScale(deviceScaleFactor);
-
LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(), deviceScaleFactor, 1, dummyMaxTextureSize, false, renderSurfaceLayerList);
// We should have two render surfaces. The root's render surface and child's

Powered by Google App Engine
This is Rietveld 408576698