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

Side by Side Diff: cc/layers/tiled_layer_unittest.cc

Issue 465853004: Moving RenderSurface creation outside of CalcDrawProps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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/layers/tiled_layer.h" 5 #include "cc/layers/tiled_layer.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 gfx::Rect content_bounds(0, 0, 200, 250); 871 gfx::Rect content_bounds(0, 0, 200, 250);
872 872
873 layer->SetBounds(layer_bounds.size()); 873 layer->SetBounds(layer_bounds.size());
874 layer->SetContentBounds(content_bounds.size()); 874 layer->SetContentBounds(content_bounds.size());
875 layer->draw_properties().visible_content_rect = content_bounds; 875 layer->draw_properties().visible_content_rect = content_bounds;
876 876
877 // On first update, the update_rect includes all tiles, even beyond the 877 // On first update, the update_rect includes all tiles, even beyond the
878 // boundaries of the layer. 878 // boundaries of the layer.
879 // However, it should still be in layer space, not content space. 879 // However, it should still be in layer space, not content space.
880 layer->InvalidateContentRect(content_bounds); 880 layer->InvalidateContentRect(content_bounds);
881 RenderSurfaceLayerList list;
882 CalcDrawProps(&list);
danakj 2014/09/03 19:30:33 Why do you need this? Doesn't this clobber the vi
awoloszyn 2014/09/09 15:31:36 I removed this (and the others) and correctly crea
881 883
882 layer->SetTexturePriorities(priority_calculator_); 884 layer->SetTexturePriorities(priority_calculator_);
883 resource_manager_->PrioritizeTextures(); 885 resource_manager_->PrioritizeTextures();
884 layer->SavePaintProperties(); 886 layer->SavePaintProperties();
885 layer->Update(queue_.get(), NULL); 887 layer->Update(queue_.get(), NULL);
886 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 300, 300 * 0.8), layer->update_rect()); 888 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 300, 300 * 0.8), layer->update_rect());
887 UpdateTextures(); 889 UpdateTextures();
888 890
889 // After the tiles are updated once, another invalidate only needs to update 891 // After the tiles are updated once, another invalidate only needs to update
890 // the bounds of the layer. 892 // the bounds of the layer.
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 TrackingLayerPainter* tracking_layer_painter_; 1746 TrackingLayerPainter* tracking_layer_painter_;
1745 scoped_refptr<BitmapContentLayerUpdater> layer_updater_; 1747 scoped_refptr<BitmapContentLayerUpdater> layer_updater_;
1746 FakeRenderingStatsInstrumentation stats_instrumentation_; 1748 FakeRenderingStatsInstrumentation stats_instrumentation_;
1747 }; 1749 };
1748 1750
1749 TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) { 1751 TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) {
1750 scoped_refptr<UpdateTrackingTiledLayer> layer = 1752 scoped_refptr<UpdateTrackingTiledLayer> layer =
1751 make_scoped_refptr(new UpdateTrackingTiledLayer(resource_manager_.get())); 1753 make_scoped_refptr(new UpdateTrackingTiledLayer(resource_manager_.get()));
1752 1754
1753 layer_tree_host_->root_layer()->AddChild(layer); 1755 layer_tree_host_->root_layer()->AddChild(layer);
1756 RenderSurfaceLayerList list;
1757 CalcDrawProps(&list);
danakj 2014/09/03 19:30:33 Shouldn't this happen after we set the layer bound
awoloszyn 2014/09/09 15:31:36 Done.
1754 1758
1755 gfx::Rect layer_rect(0, 0, 30, 31); 1759 gfx::Rect layer_rect(0, 0, 30, 31);
1756 layer->SetPosition(layer_rect.origin()); 1760 layer->SetPosition(layer_rect.origin());
1757 layer->SetBounds(layer_rect.size()); 1761 layer->SetBounds(layer_rect.size());
1758 layer->UpdateContentsScale(1.5f); 1762 layer->UpdateContentsScale(1.5f);
1759 1763
1760 gfx::Rect content_rect(0, 0, 45, 47); 1764 gfx::Rect content_rect(0, 0, 45, 47);
1761 EXPECT_EQ(content_rect.size(), layer->content_bounds()); 1765 EXPECT_EQ(content_rect.size(), layer->content_bounds());
1762 layer->draw_properties().visible_content_rect = content_rect; 1766 layer->draw_properties().visible_content_rect = content_rect;
1763 layer->draw_properties().drawable_content_rect = content_rect; 1767 layer->draw_properties().drawable_content_rect = content_rect;
(...skipping 25 matching lines...) Expand all
1789 layer_tree_host_->root_layer()->AddChild(layer); 1793 layer_tree_host_->root_layer()->AddChild(layer);
1790 1794
1791 gfx::Rect layer_rect(0, 0, 30, 31); 1795 gfx::Rect layer_rect(0, 0, 30, 31);
1792 layer->SetPosition(layer_rect.origin()); 1796 layer->SetPosition(layer_rect.origin());
1793 layer->SetBounds(layer_rect.size()); 1797 layer->SetBounds(layer_rect.size());
1794 layer->UpdateContentsScale(1.3f); 1798 layer->UpdateContentsScale(1.3f);
1795 1799
1796 gfx::Rect content_rect(layer->content_bounds()); 1800 gfx::Rect content_rect(layer->content_bounds());
1797 layer->draw_properties().visible_content_rect = content_rect; 1801 layer->draw_properties().visible_content_rect = content_rect;
1798 layer->draw_properties().drawable_content_rect = content_rect; 1802 layer->draw_properties().drawable_content_rect = content_rect;
1803 RenderSurfaceLayerList list;
1804 CalcDrawProps(&list);
danakj 2014/09/03 19:30:33 Similar question re clobbering the draw_props set
awoloszyn 2014/09/09 15:31:36 Done.
1799 1805
1800 layer->SetTexturePriorities(priority_calculator_); 1806 layer->SetTexturePriorities(priority_calculator_);
1801 resource_manager_->PrioritizeTextures(); 1807 resource_manager_->PrioritizeTextures();
1802 layer->SavePaintProperties(); 1808 layer->SavePaintProperties();
1803 1809
1804 // Update the whole tile. 1810 // Update the whole tile.
1805 layer->Update(queue_.get(), NULL); 1811 layer->Update(queue_.get(), NULL);
1806 layer->tracking_layer_painter()->ResetPaintedRect(); 1812 layer->tracking_layer_painter()->ResetPaintedRect();
1807 1813
1808 EXPECT_RECT_EQ(gfx::Rect(), layer->tracking_layer_painter()->PaintedRect()); 1814 EXPECT_RECT_EQ(gfx::Rect(), layer->tracking_layer_painter()->PaintedRect());
1809 UpdateTextures(); 1815 UpdateTextures();
1810 1816
1811 // Invalidate the entire layer in layer space. When painting, the rect given 1817 // Invalidate the entire layer in layer space. When painting, the rect given
1812 // to webkit should match the layer's bounds. 1818 // to webkit should match the layer's bounds.
1813 layer->SetNeedsDisplayRect(layer_rect); 1819 layer->SetNeedsDisplayRect(layer_rect);
1814 layer->Update(queue_.get(), NULL); 1820 layer->Update(queue_.get(), NULL);
1815 1821
1816 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); 1822 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect());
1817 } 1823 }
1818 1824
1819 } // namespace 1825 } // namespace
1820 } // namespace cc 1826 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698