| 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/tiled_layer.h" | 5 #include "cc/tiled_layer.h" |
| 6 | 6 |
| 7 #include "cc/bitmap_content_layer_updater.h" | 7 #include "cc/bitmap_content_layer_updater.h" |
| 8 #include "cc/layer_painter.h" | 8 #include "cc/layer_painter.h" |
| 9 #include "cc/overdraw_metrics.h" | 9 #include "cc/overdraw_metrics.h" |
| 10 #include "cc/rendering_stats.h" | 10 #include "cc/rendering_stats.h" |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 layer->setTexturePriorities(m_priorityCalculator); | 781 layer->setTexturePriorities(m_priorityCalculator); |
| 782 m_resourceManager->prioritizeTextures(); | 782 m_resourceManager->prioritizeTextures(); |
| 783 layer->update(*m_queue.get(), 0, m_stats); | 783 layer->update(*m_queue.get(), 0, m_stats); |
| 784 updateTextures(); | 784 updateTextures(); |
| 785 layerPushPropertiesTo(layer.get(), layerImpl.get()); | 785 layerPushPropertiesTo(layer.get(), layerImpl.get()); |
| 786 EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 0)); | 786 EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 0)); |
| 787 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 1)); | 787 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 1)); |
| 788 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(1, 0)); | 788 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(1, 0)); |
| 789 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(1, 1)); | 789 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(1, 1)); |
| 790 | 790 |
| 791 // Change the contents scale and verify that the content rectangle requiring
painting | 791 layer->setNeedsDisplayRect(gfx::Rect()); |
| 792 // is not scaled. | 792 EXPECT_FLOAT_RECT_EQ(gfx::RectF(), layer->lastNeedsDisplayRect()); |
| 793 |
| 794 // Change the contents scale. |
| 793 layer->updateContentsScale(2); | 795 layer->updateContentsScale(2); |
| 794 layer->drawProperties().visible_content_rect = gfx::Rect(0, 0, 200, 200); | 796 layer->drawProperties().visible_content_rect = gfx::Rect(0, 0, 200, 200); |
| 795 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 100, 100), layer->lastNeedsDisplayRect
()); | |
| 796 | 797 |
| 797 // The impl side should get 2x2 tiles now. | 798 // The impl side should get 2x2 tiles now. |
| 798 layer->setTexturePriorities(m_priorityCalculator); | 799 layer->setTexturePriorities(m_priorityCalculator); |
| 799 m_resourceManager->prioritizeTextures(); | 800 m_resourceManager->prioritizeTextures(); |
| 800 layer->update(*m_queue.get(), 0, m_stats); | 801 layer->update(*m_queue.get(), 0, m_stats); |
| 801 updateTextures(); | 802 updateTextures(); |
| 802 layerPushPropertiesTo(layer.get(), layerImpl.get()); | 803 layerPushPropertiesTo(layer.get(), layerImpl.get()); |
| 803 EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 0)); | 804 EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 0)); |
| 804 EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 1)); | 805 EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 1)); |
| 805 EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(1, 0)); | 806 EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(1, 0)); |
| 806 EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(1, 1)); | 807 EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(1, 1)); |
| 807 | 808 |
| 809 // Verify that changing the contents scale caused invalidation, and |
| 810 // that the layer-space rectangle requiring painting is not scaled. |
| 811 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 100, 100), layer->lastNeedsDisplayRect
()); |
| 812 |
| 808 // Invalidate the entire layer again, but do not paint. All tiles should be
gone now from the | 813 // Invalidate the entire layer again, but do not paint. All tiles should be
gone now from the |
| 809 // impl side. | 814 // impl side. |
| 810 layer->setNeedsDisplay(); | 815 layer->setNeedsDisplay(); |
| 811 layer->setTexturePriorities(m_priorityCalculator); | 816 layer->setTexturePriorities(m_priorityCalculator); |
| 812 m_resourceManager->prioritizeTextures(); | 817 m_resourceManager->prioritizeTextures(); |
| 813 | 818 |
| 814 layerPushPropertiesTo(layer.get(), layerImpl.get()); | 819 layerPushPropertiesTo(layer.get(), layerImpl.get()); |
| 815 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 0)); | 820 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 0)); |
| 816 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 1)); | 821 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 1)); |
| 817 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(1, 0)); | 822 EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(1, 0)); |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1663 | 1668 |
| 1664 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. | 1669 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. |
| 1665 layer->setNeedsDisplayRect(layerRect); | 1670 layer->setNeedsDisplayRect(layerRect); |
| 1666 layer->update(*m_queue.get(), 0, m_stats); | 1671 layer->update(*m_queue.get(), 0, m_stats); |
| 1667 | 1672 |
| 1668 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); | 1673 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); |
| 1669 } | 1674 } |
| 1670 | 1675 |
| 1671 } // namespace | 1676 } // namespace |
| 1672 } // namespace cc | 1677 } // namespace cc |
| OLD | NEW |