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

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

Issue 647253002: cc: Stop converting update rect from int to float to int. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: displayrectint: ccperftests Created 6 years, 2 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
« no previous file with comments | « cc/debug/debug_rect_history.cc ('k') | cc/layers/delegated_renderer_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/contents_scaling_layer.h" 5 #include "cc/layers/contents_scaling_layer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "cc/test/fake_layer_tree_host.h" 9 #include "cc/test/fake_layer_tree_host.h"
10 #include "cc/test/geometry_test_utils.h" 10 #include "cc/test/geometry_test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace cc { 13 namespace cc {
14 namespace { 14 namespace {
15 15
16 class MockContentsScalingLayer : public ContentsScalingLayer { 16 class MockContentsScalingLayer : public ContentsScalingLayer {
17 public: 17 public:
18 MockContentsScalingLayer() 18 MockContentsScalingLayer()
19 : ContentsScalingLayer() {} 19 : ContentsScalingLayer() {}
20 20
21 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect) override { 21 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect) override {
22 last_needs_display_rect_ = dirty_rect; 22 last_needs_display_rect_ = dirty_rect;
23 ContentsScalingLayer::SetNeedsDisplayRect(dirty_rect); 23 ContentsScalingLayer::SetNeedsDisplayRect(dirty_rect);
24 } 24 }
25 25
26 const gfx::RectF& LastNeedsDisplayRect() const { 26 const gfx::Rect& LastNeedsDisplayRect() const {
27 return last_needs_display_rect_; 27 return last_needs_display_rect_;
28 } 28 }
29 29
30 private: 30 private:
31 virtual ~MockContentsScalingLayer() {} 31 virtual ~MockContentsScalingLayer() {}
32 32
33 gfx::RectF last_needs_display_rect_; 33 gfx::Rect last_needs_display_rect_;
34 }; 34 };
35 35
36 static void CalcDrawProps(FakeLayerTreeHost* host, float device_scale_factor) { 36 static void CalcDrawProps(FakeLayerTreeHost* host, float device_scale_factor) {
37 RenderSurfaceLayerList render_surface_layer_list; 37 RenderSurfaceLayerList render_surface_layer_list;
38 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 38 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
39 host->root_layer(), gfx::Size(500, 500), &render_surface_layer_list); 39 host->root_layer(), gfx::Size(500, 500), &render_surface_layer_list);
40 inputs.device_scale_factor = device_scale_factor; 40 inputs.device_scale_factor = device_scale_factor;
41 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 41 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
42 } 42 }
43 43
(...skipping 25 matching lines...) Expand all
69 EXPECT_EQ(20, test_layer->content_bounds().width()); 69 EXPECT_EQ(20, test_layer->content_bounds().width());
70 EXPECT_EQ(40, test_layer->content_bounds().height()); 70 EXPECT_EQ(40, test_layer->content_bounds().height());
71 71
72 CalcDrawProps(host.get(), 1.33f); 72 CalcDrawProps(host.get(), 1.33f);
73 EXPECT_EQ(14, test_layer->content_bounds().width()); 73 EXPECT_EQ(14, test_layer->content_bounds().width());
74 EXPECT_EQ(27, test_layer->content_bounds().height()); 74 EXPECT_EQ(27, test_layer->content_bounds().height());
75 } 75 }
76 76
77 } // namespace 77 } // namespace
78 } // namespace cc 78 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/debug_rect_history.cc ('k') | cc/layers/delegated_renderer_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698