OLD | NEW |
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.h" | 5 #include "cc/layer.h" |
6 | 6 |
7 #include "cc/keyframed_animation_curve.h" | 7 #include "cc/keyframed_animation_curve.h" |
8 #include "cc/layer_impl.h" | 8 #include "cc/layer_impl.h" |
9 #include "cc/layer_painter.h" | 9 #include "cc/layer_painter.h" |
10 #include "cc/layer_tree_host.h" | 10 #include "cc/layer_tree_host.h" |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 { | 505 { |
506 scoped_refptr<Layer> testLayer = Layer::create(); | 506 scoped_refptr<Layer> testLayer = Layer::create(); |
507 testLayer->setLayerTreeHost(m_layerTreeHost.get()); | 507 testLayer->setLayerTreeHost(m_layerTreeHost.get()); |
508 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setIsDrawable(true)); | 508 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setIsDrawable(true)); |
509 | 509 |
510 scoped_refptr<Layer> dummyLayer = Layer::create(); // just a dummy layer for
this test case. | 510 scoped_refptr<Layer> dummyLayer = Layer::create(); // just a dummy layer for
this test case. |
511 | 511 |
512 // sanity check of initial test condition | 512 // sanity check of initial test condition |
513 EXPECT_FALSE(testLayer->needsDisplay()); | 513 EXPECT_FALSE(testLayer->needsDisplay()); |
514 | 514 |
515 // Test properties that should not call needsDisplay and needsCommit when ch
anged. | |
516 EXPECT_SET_NEEDS_COMMIT(0, testLayer->setVisibleContentRect(gfx::Rect(0, 0,
40, 50))); | |
517 EXPECT_SET_NEEDS_COMMIT(0, testLayer->setUseLCDText(true)); | |
518 EXPECT_SET_NEEDS_COMMIT(0, testLayer->setDrawOpacity(0.5)); | |
519 EXPECT_SET_NEEDS_COMMIT(0, testLayer->setRenderTarget(0)); | |
520 EXPECT_SET_NEEDS_COMMIT(0, testLayer->setDrawTransform(gfx::Transform())); | |
521 EXPECT_SET_NEEDS_COMMIT(0, testLayer->setScreenSpaceTransform(gfx::Transform
())); | |
522 EXPECT_SET_NEEDS_COMMIT(0, testLayer->setDrawableContentRect(gfx::Rect(4, 5,
6, 7))); | |
523 EXPECT_FALSE(testLayer->needsDisplay()); | |
524 | |
525 // Next, test properties that should call setNeedsCommit (but not setNeedsDi
splay) | 515 // Next, test properties that should call setNeedsCommit (but not setNeedsDi
splay) |
526 // All properties need to be set to new values in order for setNeedsCommit t
o be called. | 516 // All properties need to be set to new values in order for setNeedsCommit t
o be called. |
527 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setAnchorPoint(gfx::PointF(1.23f, 4.56
f))); | 517 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setAnchorPoint(gfx::PointF(1.23f, 4.56
f))); |
528 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setAnchorPointZ(0.7f)); | 518 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setAnchorPointZ(0.7f)); |
529 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setBackgroundColor(SK_ColorLTGRAY)); | 519 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setBackgroundColor(SK_ColorLTGRAY)); |
530 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setMasksToBounds(true)); | 520 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setMasksToBounds(true)); |
531 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setOpacity(0.5)); | 521 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setOpacity(0.5)); |
532 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setContentsOpaque(true)); | 522 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setContentsOpaque(true)); |
533 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setPosition(gfx::PointF(4, 9))); | 523 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setPosition(gfx::PointF(4, 9))); |
534 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setSublayerTransform(MathUtil::createG
fxTransform(0, 0, 0, 0, 0, 0))); | 524 EXPECT_SET_NEEDS_COMMIT(1, testLayer->setSublayerTransform(MathUtil::createG
fxTransform(0, 0, 0, 0, 0, 0))); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 scoped_refptr<MockLayer> layer(new MockLayer); | 812 scoped_refptr<MockLayer> layer(new MockLayer); |
823 EXPECT_FALSE(layer->needsDisplay()); | 813 EXPECT_FALSE(layer->needsDisplay()); |
824 layer->setBounds(gfx::Size(0, 10)); | 814 layer->setBounds(gfx::Size(0, 10)); |
825 EXPECT_FALSE(layer->needsDisplay()); | 815 EXPECT_FALSE(layer->needsDisplay()); |
826 layer->setBounds(gfx::Size(10, 10)); | 816 layer->setBounds(gfx::Size(10, 10)); |
827 EXPECT_TRUE(layer->needsDisplay()); | 817 EXPECT_TRUE(layer->needsDisplay()); |
828 } | 818 } |
829 | 819 |
830 } // namespace | 820 } // namespace |
831 } // namespace cc | 821 } // namespace cc |
OLD | NEW |