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

Side by Side Diff: cc/test/layer_tree_host_common_test.cc

Issue 1057283003: Remove parts of //cc we aren't using (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 8 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/test/layer_tree_host_common_test.h ('k') | cc/test/layer_tree_json_parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/test/layer_tree_host_common_test.h"
6
7 #include "cc/layers/layer.h"
8 #include "cc/layers/layer_impl.h"
9 #include "cc/test/fake_layer_tree_host.h"
10 #include "cc/trees/layer_tree_host_common.h"
11
12 namespace cc {
13
14 LayerTreeHostCommonTestBase::LayerTreeHostCommonTestBase()
15 : client_(FakeLayerTreeHostClient::DIRECT_3D),
16 render_surface_layer_list_count_(0) {
17 }
18
19 LayerTreeHostCommonTestBase::~LayerTreeHostCommonTestBase() {
20 }
21
22 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting(
23 Layer* layer,
24 const gfx::Transform& transform,
25 const gfx::Point3F& transform_origin,
26 const gfx::PointF& position,
27 const gfx::Size& bounds,
28 bool flatten_transform,
29 bool is_3d_sorted) {
30 SetLayerPropertiesForTestingInternal(layer, transform, transform_origin,
31 position, bounds, flatten_transform,
32 is_3d_sorted);
33 }
34
35 void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting(
36 LayerImpl* layer,
37 const gfx::Transform& transform,
38 const gfx::Point3F& transform_origin,
39 const gfx::PointF& position,
40 const gfx::Size& bounds,
41 bool flatten_transform,
42 bool is_3d_sorted,
43 bool create_render_surface) {
44 SetLayerPropertiesForTestingInternal(layer, transform, transform_origin,
45 position, bounds, flatten_transform,
46 is_3d_sorted);
47 if (create_render_surface) {
48 layer->SetHasRenderSurface(true);
49 }
50
51 layer->SetContentBounds(bounds);
52 }
53
54 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties(
55 Layer* root_layer,
56 float device_scale_factor,
57 float page_scale_factor,
58 Layer* page_scale_application_layer,
59 bool can_use_lcd_text,
60 bool layers_always_allowed_lcd_text) {
61 EXPECT_TRUE(page_scale_application_layer || (page_scale_factor == 1.f));
62 gfx::Transform identity_matrix;
63 gfx::Size device_viewport_size =
64 gfx::Size(root_layer->bounds().width() * device_scale_factor,
65 root_layer->bounds().height() * device_scale_factor);
66
67 render_surface_layer_list_.reset(new RenderSurfaceLayerList);
68
69 // We are probably not testing what is intended if the root_layer bounds are
70 // empty.
71 DCHECK(!root_layer->bounds().IsEmpty());
72 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
73 root_layer, device_viewport_size, render_surface_layer_list_.get());
74 inputs.device_scale_factor = device_scale_factor;
75 inputs.page_scale_factor = page_scale_factor;
76 inputs.page_scale_application_layer = page_scale_application_layer;
77 inputs.can_use_lcd_text = can_use_lcd_text;
78 inputs.layers_always_allowed_lcd_text = layers_always_allowed_lcd_text;
79 inputs.can_adjust_raster_scales = true;
80 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
81 }
82
83 void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties(
84 LayerImpl* root_layer,
85 float device_scale_factor,
86 float page_scale_factor,
87 LayerImpl* page_scale_application_layer,
88 bool can_use_lcd_text,
89 bool layers_always_allowed_lcd_text) {
90 gfx::Transform identity_matrix;
91 gfx::Size device_viewport_size =
92 gfx::Size(root_layer->bounds().width() * device_scale_factor,
93 root_layer->bounds().height() * device_scale_factor);
94
95 render_surface_layer_list_impl_.reset(new LayerImplList);
96
97 // We are probably not testing what is intended if the root_layer bounds are
98 // empty.
99 DCHECK(!root_layer->bounds().IsEmpty());
100 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
101 root_layer, device_viewport_size, render_surface_layer_list_impl_.get());
102 inputs.device_scale_factor = device_scale_factor;
103 inputs.page_scale_factor = page_scale_factor;
104 inputs.page_scale_application_layer = page_scale_application_layer;
105 inputs.can_use_lcd_text = can_use_lcd_text;
106 inputs.layers_always_allowed_lcd_text = layers_always_allowed_lcd_text;
107 inputs.can_adjust_raster_scales = true;
108
109 ++render_surface_layer_list_count_;
110 inputs.current_render_surface_layer_list_id =
111 render_surface_layer_list_count_;
112
113 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
114 }
115
116 scoped_ptr<FakeLayerTreeHost>
117 LayerTreeHostCommonTestBase::CreateFakeLayerTreeHost() {
118 return FakeLayerTreeHost::Create(&client_);
119 }
120
121 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_host_common_test.h ('k') | cc/test/layer_tree_json_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698