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

Unified Diff: cc/layers/picture_image_layer_impl_unittest.cc

Issue 338653002: Revert of cc: Move tiling management out of draw properties calculation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months 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/layers/picture_image_layer_impl.cc ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_image_layer_impl_unittest.cc
diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc
index 34cdf4c24cbd79c03a0d5613e476c18c2f34006d..e8c993fa9f56c2fc47018bcc3bbc531d6f2f0138 100644
--- a/cc/layers/picture_image_layer_impl_unittest.cc
+++ b/cc/layers/picture_image_layer_impl_unittest.cc
@@ -24,20 +24,7 @@
TestablePictureImageLayerImpl(LayerTreeImpl* tree_impl, int id)
: PictureImageLayerImpl(tree_impl, id) {
}
- using PictureLayerImpl::UpdateIdealScales;
- using PictureLayerImpl::MaximumTilingContentsScale;
- using PictureLayerImpl::ManageTilings;
- using PictureLayerImpl::DoPostCommitInitializationIfNeeded;
- void ScaleAndManageTilings(bool animating_transform_to_screen,
- float maximum_animation_contents_scale) {
- DoPostCommitInitializationIfNeeded();
- UpdateIdealScales();
- if (CanHaveTilings()) {
- ManageTilings(animating_transform_to_screen,
- maximum_animation_contents_scale);
- }
- }
PictureLayerTilingSet* tilings() { return tilings_.get(); }
friend class PictureImageLayerImplTest;
@@ -73,29 +60,10 @@
TestablePictureImageLayerImpl* layer =
new TestablePictureImageLayerImpl(tree, id);
layer->SetBounds(gfx::Size(100, 200));
- layer->SetContentBounds(gfx::Size(100, 200));
layer->tilings_.reset(new PictureLayerTilingSet(&tiling_client_,
layer->bounds()));
layer->pile_ = tiling_client_.pile();
return make_scoped_ptr(layer);
- }
-
- void SetupDrawPropertiesAndManageTilings(
- TestablePictureImageLayerImpl* layer,
- float ideal_contents_scale,
- float device_scale_factor,
- float page_scale_factor,
- float maximum_animation_contents_scale,
- bool animating_transform_to_screen) {
- layer->draw_properties().ideal_contents_scale = ideal_contents_scale;
- layer->draw_properties().device_scale_factor = device_scale_factor;
- layer->draw_properties().page_scale_factor = page_scale_factor;
- layer->draw_properties().maximum_animation_contents_scale =
- maximum_animation_contents_scale;
- layer->draw_properties().screen_space_transform_is_animating =
- animating_transform_to_screen;
- layer->ScaleAndManageTilings(animating_transform_to_screen,
- maximum_animation_contents_scale);
}
protected:
@@ -109,11 +77,20 @@
scoped_ptr<TestablePictureImageLayerImpl> layer(CreateLayer(1, PENDING_TREE));
layer->SetDrawsContent(true);
- SetupDrawPropertiesAndManageTilings(layer.get(), 2.f, 3.f, 4.f, 1.f, false);
-
- EXPECT_FLOAT_EQ(1.f, layer->contents_scale_x());
- EXPECT_FLOAT_EQ(1.f, layer->contents_scale_y());
- EXPECT_FLOAT_EQ(1.f, layer->MaximumTilingContentsScale());
+ float contents_scale_x;
+ float contents_scale_y;
+ gfx::Size content_bounds;
+ layer->CalculateContentsScale(2.f,
+ 3.f,
+ 4.f,
+ 1.f,
+ false,
+ &contents_scale_x,
+ &contents_scale_y,
+ &content_bounds);
+ EXPECT_FLOAT_EQ(1.f, contents_scale_x);
+ EXPECT_FLOAT_EQ(1.f, contents_scale_y);
+ EXPECT_EQ(layer->bounds(), content_bounds);
}
TEST_F(PictureImageLayerImplTest, IgnoreIdealContentScale) {
@@ -128,24 +105,31 @@
const float page_scale_factor = 4.f;
const float maximum_animation_contents_scale = 1.f;
const bool animating_transform_to_screen = false;
- SetupDrawPropertiesAndManageTilings(pending_layer.get(),
- suggested_ideal_contents_scale,
- device_scale_factor,
- page_scale_factor,
- maximum_animation_contents_scale,
- animating_transform_to_screen);
+ float contents_scale_x;
+ float contents_scale_y;
+ gfx::Size content_bounds;
+ pending_layer->CalculateContentsScale(suggested_ideal_contents_scale,
+ device_scale_factor,
+ page_scale_factor,
+ maximum_animation_contents_scale,
+ animating_transform_to_screen,
+ &contents_scale_x,
+ &contents_scale_y,
+ &content_bounds);
// Push to active layer.
host_impl_.ActivatePendingTree();
scoped_ptr<TestablePictureImageLayerImpl> active_layer(
CreateLayer(1, ACTIVE_TREE));
pending_layer->PushPropertiesTo(active_layer.get());
- SetupDrawPropertiesAndManageTilings(active_layer.get(),
- suggested_ideal_contents_scale,
- device_scale_factor,
- page_scale_factor,
- maximum_animation_contents_scale,
- animating_transform_to_screen);
+ active_layer->CalculateContentsScale(suggested_ideal_contents_scale,
+ device_scale_factor,
+ page_scale_factor,
+ maximum_animation_contents_scale,
+ animating_transform_to_screen,
+ &contents_scale_x,
+ &contents_scale_y,
+ &content_bounds);
// Create tile and resource.
active_layer->tilings()->tiling_at(0)->CreateAllTilesForTesting();
« no previous file with comments | « cc/layers/picture_image_layer_impl.cc ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698