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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 733233003: Revert of cc: Toggle LCD text at raster time instead of record time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/trees/layer_tree_host_common_perftest.cc ('k') | cc/trees/layer_tree_host_pixeltest_masks.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 1a2c0a0fc4f679a089610c2ab5328c2046b7ce28..b40f66db486ddf63d9191fe933b0d195e9deb456 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -59,6 +59,7 @@
SkCanvas* canvas,
const gfx::Rect& clip,
ContentLayerClient::GraphicsContextStatus gc_status) override {}
+ void DidChangeLayerCanUseLCDText() override {}
bool FillsBoundsCompletely() const override { return false; }
};
@@ -5643,14 +5644,13 @@
ASSERT_EQ(2u, root->render_surface()->layer_list().size());
}
-using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>;
+typedef std::tr1::tuple<bool, bool> LCDTextTestParam;
class LCDTextTest
: public LayerTreeHostCommonTestBase,
public testing::TestWithParam<LCDTextTestParam> {
protected:
virtual void SetUp() {
can_use_lcd_text_ = std::tr1::get<0>(GetParam());
- layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam());
root_ = Layer::Create();
child_ = Layer::Create();
@@ -5681,14 +5681,13 @@
true,
false);
- child_->SetForceRenderSurface(std::tr1::get<2>(GetParam()));
+ child_->SetForceRenderSurface(std::tr1::get<1>(GetParam()));
host_ = CreateFakeLayerTreeHost();
host_->SetRootLayer(root_);
}
bool can_use_lcd_text_;
- bool layers_always_allowed_lcd_text_;
scoped_ptr<FakeLayerTreeHost> host_;
scoped_refptr<Layer> root_;
scoped_refptr<Layer> child_;
@@ -5696,115 +5695,108 @@
};
TEST_P(LCDTextTest, CanUseLCDText) {
- bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_;
- bool expect_not_lcd_text = layers_always_allowed_lcd_text_;
-
// Case 1: Identity transform.
gfx::Transform identity_matrix;
- ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_,
- layers_always_allowed_lcd_text_);
- EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
- EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
- EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
+ ExecuteCalculateDrawProperties(
+ root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_);
+ EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text());
+ EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text());
+ EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text());
// Case 2: Integral translation.
gfx::Transform integral_translation;
integral_translation.Translate(1.0, 2.0);
child_->SetTransform(integral_translation);
- ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_,
- layers_always_allowed_lcd_text_);
- EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
- EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
- EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
+ ExecuteCalculateDrawProperties(
+ root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_);
+ EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text());
+ EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text());
+ EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text());
// Case 3: Non-integral translation.
gfx::Transform non_integral_translation;
non_integral_translation.Translate(1.5, 2.5);
child_->SetTransform(non_integral_translation);
- ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_,
- layers_always_allowed_lcd_text_);
- EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
- EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
- EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
+ ExecuteCalculateDrawProperties(
+ root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_);
+ EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text());
+ EXPECT_FALSE(child_->can_use_lcd_text());
+ EXPECT_FALSE(grand_child_->can_use_lcd_text());
// Case 4: Rotation.
gfx::Transform rotation;
rotation.Rotate(10.0);
child_->SetTransform(rotation);
- ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_,
- layers_always_allowed_lcd_text_);
- EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
- EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
- EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
+ ExecuteCalculateDrawProperties(
+ root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_);
+ EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text());
+ EXPECT_FALSE(child_->can_use_lcd_text());
+ EXPECT_FALSE(grand_child_->can_use_lcd_text());
// Case 5: Scale.
gfx::Transform scale;
scale.Scale(2.0, 2.0);
child_->SetTransform(scale);
- ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_,
- layers_always_allowed_lcd_text_);
- EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
- EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
- EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
+ ExecuteCalculateDrawProperties(
+ root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_);
+ EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text());
+ EXPECT_FALSE(child_->can_use_lcd_text());
+ EXPECT_FALSE(grand_child_->can_use_lcd_text());
// Case 6: Skew.
gfx::Transform skew;
skew.SkewX(10.0);
child_->SetTransform(skew);
- ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_,
- layers_always_allowed_lcd_text_);
- EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
- EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
- EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
+ ExecuteCalculateDrawProperties(
+ root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_);
+ EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text());
+ EXPECT_FALSE(child_->can_use_lcd_text());
+ EXPECT_FALSE(grand_child_->can_use_lcd_text());
// Case 7: Translucent.
child_->SetTransform(identity_matrix);
child_->SetOpacity(0.5f);
- ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_,
- layers_always_allowed_lcd_text_);
- EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
- EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
- EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
+ ExecuteCalculateDrawProperties(
+ root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_);
+ EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text());
+ EXPECT_FALSE(child_->can_use_lcd_text());
+ EXPECT_FALSE(grand_child_->can_use_lcd_text());
// Case 8: Sanity check: restore transform and opacity.
child_->SetTransform(identity_matrix);
child_->SetOpacity(1.f);
- ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_,
- layers_always_allowed_lcd_text_);
- EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
- EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
- EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
+ ExecuteCalculateDrawProperties(
+ root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_);
+ EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text());
+ EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text());
+ EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text());
}
TEST_P(LCDTextTest, CanUseLCDTextWithAnimation) {
- bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_;
-
// Sanity check: Make sure can_use_lcd_text_ is set on each node.
- ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_,
- layers_always_allowed_lcd_text_);
- EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
- EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
- EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
+ ExecuteCalculateDrawProperties(
+ root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_);
+ EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text());
+ EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text());
+ EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text());
// Add opacity animation.
child_->SetOpacity(0.9f);
AddOpacityTransitionToController(
child_->layer_animation_controller(), 10.0, 0.9f, 0.1f, false);
- ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_,
- layers_always_allowed_lcd_text_);
+ ExecuteCalculateDrawProperties(
+ root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_);
// Text AA should not be adjusted while animation is active.
// Make sure LCD text AA setting remains unchanged.
- EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
- EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
- EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
+ EXPECT_EQ(can_use_lcd_text_, root_->can_use_lcd_text());
+ EXPECT_EQ(can_use_lcd_text_, child_->can_use_lcd_text());
+ EXPECT_EQ(can_use_lcd_text_, grand_child_->can_use_lcd_text());
}
INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,
LCDTextTest,
- testing::Combine(testing::Bool(),
- testing::Bool(),
- testing::Bool()));
+ testing::Combine(testing::Bool(), testing::Bool()));
TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) {
FakeImplProxy proxy;
« no previous file with comments | « cc/trees/layer_tree_host_common_perftest.cc ('k') | cc/trees/layer_tree_host_pixeltest_masks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698