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

Side by Side Diff: cc/layer_tree_host_common_unittest.cc

Issue 12541006: Use LCD text if the transform IsAlmostIdentityAndIntegerTranslation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Transform::IsAlmostXXX methods Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layer_tree_host_common.h" 5 #include "cc/layer_tree_host_common.h"
6 6
7 #include "cc/content_layer.h" 7 #include "cc/content_layer.h"
8 #include "cc/content_layer_client.h" 8 #include "cc/content_layer_client.h"
9 #include "cc/heads_up_display_layer_impl.h" 9 #include "cc/heads_up_display_layer_impl.h"
10 #include "cc/layer.h" 10 #include "cc/layer.h"
(...skipping 5129 matching lines...) Expand 10 before | Expand all | Expand 10 after
5140 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText()); 5140 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText());
5141 EXPECT_EQ(m_canUseLCDText, m_child->canUseLCDText()); 5141 EXPECT_EQ(m_canUseLCDText, m_child->canUseLCDText());
5142 EXPECT_EQ(m_canUseLCDText, m_grandChild->canUseLCDText()); 5142 EXPECT_EQ(m_canUseLCDText, m_grandChild->canUseLCDText());
5143 } 5143 }
5144 5144
5145 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, 5145 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,
5146 LCDTextTest, 5146 LCDTextTest,
5147 testing::Combine(testing::Bool(), 5147 testing::Combine(testing::Bool(),
5148 testing::Bool())); 5148 testing::Bool()));
5149 5149
5150 TEST(LayerTreeHostCommonTest, verifyRoundAlmostIntegerComponentsInTransforms)
5151 {
5152 const float kPageScale = 0.9f;
5153 const float kDeviceScale = 1.234567f;
5154
5155 FakeImplProxy proxy;
5156 FakeLayerTreeHostImpl hostImpl(&proxy);
5157
5158 gfx::Transform implTransform;
5159 implTransform.Scale(kPageScale, kPageScale);
5160
5161 gfx::Transform identityMatrix;
5162 scoped_ptr<LayerImpl> layerScopedPtr = LayerImpl::create(hostImpl.activeTree (), 1);
5163 LayerImpl* layer = layerScopedPtr.get();
5164 layer->setContentsScale(kPageScale * kDeviceScale, kPageScale * kDeviceScale );
5165 setLayerPropertiesForTesting(layer, identityMatrix, identityMatrix, gfx::Poi nt(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
5166
5167 scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl.activeTree(), 2);
5168 root->setContentsScale(kPageScale * kDeviceScale, kPageScale * kDeviceScale) ;
5169 root->setImplTransform(implTransform);
5170 root->addChild(layerScopedPtr.Pass());
5171
5172 executeCalculateDrawProperties(root.get(), kDeviceScale, kPageScale, true);
5173 EXPECT_TRUE(layer->drawTransform().IsAlmostIdentity());
5174 EXPECT_TRUE(layer->canUseLCDText());
5175 EXPECT_TRUE(root->drawTransform().IsAlmostIdentity());
5176 EXPECT_TRUE(root->canUseLCDText());
5177 }
5178
5150 } // namespace 5179 } // namespace
5151 } // namespace cc 5180 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698