OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/video_layer_impl.h" | 5 #include "cc/layers/video_layer_impl.h" |
6 | 6 |
7 #include "cc/layers/video_frame_provider_client_impl.h" | 7 #include "cc/layers/video_frame_provider_client_impl.h" |
8 #include "cc/output/context_provider.h" | 8 #include "cc/output/context_provider.h" |
9 #include "cc/output/output_surface.h" | 9 #include "cc/output/output_surface.h" |
10 #include "cc/quads/draw_quad.h" | 10 #include "cc/quads/draw_quad.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 video_layer_impl->SetBounds(layer_size); | 112 video_layer_impl->SetBounds(layer_size); |
113 video_layer_impl->SetContentBounds(layer_size); | 113 video_layer_impl->SetContentBounds(layer_size); |
114 video_layer_impl->SetDrawsContent(true); | 114 video_layer_impl->SetDrawsContent(true); |
115 | 115 |
116 impl.CalcDrawProps(viewport_size); | 116 impl.CalcDrawProps(viewport_size); |
117 gfx::Rect occluded; | 117 gfx::Rect occluded; |
118 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); | 118 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); |
119 | 119 |
120 EXPECT_EQ(1u, impl.quad_list().size()); | 120 EXPECT_EQ(1u, impl.quad_list().size()); |
121 | 121 |
122 gfx::Point3F p1(0, impl.quad_list()[0]->rect.height(), 0); | 122 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0); |
123 gfx::Point3F p2(impl.quad_list()[0]->rect.width(), 0, 0); | 123 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0); |
124 impl.quad_list()[0]->quadTransform().TransformPoint(&p1); | 124 impl.quad_list().front()->quadTransform().TransformPoint(&p1); |
125 impl.quad_list()[0]->quadTransform().TransformPoint(&p2); | 125 impl.quad_list().front()->quadTransform().TransformPoint(&p2); |
126 EXPECT_EQ(gfx::Point3F(0, 50, 0), p1); | 126 EXPECT_EQ(gfx::Point3F(0, 50, 0), p1); |
127 EXPECT_EQ(gfx::Point3F(100, 0, 0), p2); | 127 EXPECT_EQ(gfx::Point3F(100, 0, 0), p2); |
128 } | 128 } |
129 | 129 |
130 TEST(VideoLayerImplTest, Rotated90) { | 130 TEST(VideoLayerImplTest, Rotated90) { |
131 gfx::Size layer_size(100, 50); | 131 gfx::Size layer_size(100, 50); |
132 gfx::Size viewport_size(1000, 500); | 132 gfx::Size viewport_size(1000, 500); |
133 | 133 |
134 LayerTestCommon::LayerImplTest impl; | 134 LayerTestCommon::LayerImplTest impl; |
135 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy()); | 135 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy()); |
(...skipping 12 matching lines...) Expand all Loading... |
148 video_layer_impl->SetBounds(layer_size); | 148 video_layer_impl->SetBounds(layer_size); |
149 video_layer_impl->SetContentBounds(layer_size); | 149 video_layer_impl->SetContentBounds(layer_size); |
150 video_layer_impl->SetDrawsContent(true); | 150 video_layer_impl->SetDrawsContent(true); |
151 | 151 |
152 impl.CalcDrawProps(viewport_size); | 152 impl.CalcDrawProps(viewport_size); |
153 gfx::Rect occluded; | 153 gfx::Rect occluded; |
154 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); | 154 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); |
155 | 155 |
156 EXPECT_EQ(1u, impl.quad_list().size()); | 156 EXPECT_EQ(1u, impl.quad_list().size()); |
157 | 157 |
158 gfx::Point3F p1(0, impl.quad_list()[0]->rect.height(), 0); | 158 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0); |
159 gfx::Point3F p2(impl.quad_list()[0]->rect.width(), 0, 0); | 159 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0); |
160 impl.quad_list()[0]->quadTransform().TransformPoint(&p1); | 160 impl.quad_list().front()->quadTransform().TransformPoint(&p1); |
161 impl.quad_list()[0]->quadTransform().TransformPoint(&p2); | 161 impl.quad_list().front()->quadTransform().TransformPoint(&p2); |
162 EXPECT_EQ(gfx::Point3F(0, 0, 0), p1); | 162 EXPECT_EQ(gfx::Point3F(0, 0, 0), p1); |
163 EXPECT_EQ(gfx::Point3F(100, 50, 0), p2); | 163 EXPECT_EQ(gfx::Point3F(100, 50, 0), p2); |
164 } | 164 } |
165 | 165 |
166 TEST(VideoLayerImplTest, Rotated180) { | 166 TEST(VideoLayerImplTest, Rotated180) { |
167 gfx::Size layer_size(100, 50); | 167 gfx::Size layer_size(100, 50); |
168 gfx::Size viewport_size(1000, 500); | 168 gfx::Size viewport_size(1000, 500); |
169 | 169 |
170 LayerTestCommon::LayerImplTest impl; | 170 LayerTestCommon::LayerImplTest impl; |
171 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy()); | 171 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy()); |
(...skipping 12 matching lines...) Expand all Loading... |
184 video_layer_impl->SetBounds(layer_size); | 184 video_layer_impl->SetBounds(layer_size); |
185 video_layer_impl->SetContentBounds(layer_size); | 185 video_layer_impl->SetContentBounds(layer_size); |
186 video_layer_impl->SetDrawsContent(true); | 186 video_layer_impl->SetDrawsContent(true); |
187 | 187 |
188 impl.CalcDrawProps(viewport_size); | 188 impl.CalcDrawProps(viewport_size); |
189 gfx::Rect occluded; | 189 gfx::Rect occluded; |
190 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); | 190 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); |
191 | 191 |
192 EXPECT_EQ(1u, impl.quad_list().size()); | 192 EXPECT_EQ(1u, impl.quad_list().size()); |
193 | 193 |
194 gfx::Point3F p1(0, impl.quad_list()[0]->rect.height(), 0); | 194 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0); |
195 gfx::Point3F p2(impl.quad_list()[0]->rect.width(), 0, 0); | 195 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0); |
196 impl.quad_list()[0]->quadTransform().TransformPoint(&p1); | 196 impl.quad_list().front()->quadTransform().TransformPoint(&p1); |
197 impl.quad_list()[0]->quadTransform().TransformPoint(&p2); | 197 impl.quad_list().front()->quadTransform().TransformPoint(&p2); |
198 EXPECT_EQ(gfx::Point3F(100, 0, 0), p1); | 198 EXPECT_EQ(gfx::Point3F(100, 0, 0), p1); |
199 EXPECT_EQ(gfx::Point3F(0, 50, 0), p2); | 199 EXPECT_EQ(gfx::Point3F(0, 50, 0), p2); |
200 } | 200 } |
201 | 201 |
202 TEST(VideoLayerImplTest, Rotated270) { | 202 TEST(VideoLayerImplTest, Rotated270) { |
203 gfx::Size layer_size(100, 50); | 203 gfx::Size layer_size(100, 50); |
204 gfx::Size viewport_size(1000, 500); | 204 gfx::Size viewport_size(1000, 500); |
205 | 205 |
206 LayerTestCommon::LayerImplTest impl; | 206 LayerTestCommon::LayerImplTest impl; |
207 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy()); | 207 DebugScopedSetImplThreadAndMainThreadBlocked thread(impl.proxy()); |
(...skipping 12 matching lines...) Expand all Loading... |
220 video_layer_impl->SetBounds(layer_size); | 220 video_layer_impl->SetBounds(layer_size); |
221 video_layer_impl->SetContentBounds(layer_size); | 221 video_layer_impl->SetContentBounds(layer_size); |
222 video_layer_impl->SetDrawsContent(true); | 222 video_layer_impl->SetDrawsContent(true); |
223 | 223 |
224 impl.CalcDrawProps(viewport_size); | 224 impl.CalcDrawProps(viewport_size); |
225 gfx::Rect occluded; | 225 gfx::Rect occluded; |
226 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); | 226 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); |
227 | 227 |
228 EXPECT_EQ(1u, impl.quad_list().size()); | 228 EXPECT_EQ(1u, impl.quad_list().size()); |
229 | 229 |
230 gfx::Point3F p1(0, impl.quad_list()[0]->rect.height(), 0); | 230 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0); |
231 gfx::Point3F p2(impl.quad_list()[0]->rect.width(), 0, 0); | 231 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0); |
232 impl.quad_list()[0]->quadTransform().TransformPoint(&p1); | 232 impl.quad_list().front()->quadTransform().TransformPoint(&p1); |
233 impl.quad_list()[0]->quadTransform().TransformPoint(&p2); | 233 impl.quad_list().front()->quadTransform().TransformPoint(&p2); |
234 EXPECT_EQ(gfx::Point3F(100, 50, 0), p1); | 234 EXPECT_EQ(gfx::Point3F(100, 50, 0), p1); |
235 EXPECT_EQ(gfx::Point3F(0, 0, 0), p2); | 235 EXPECT_EQ(gfx::Point3F(0, 0, 0), p2); |
236 } | 236 } |
237 | 237 |
238 } // namespace | 238 } // namespace |
239 } // namespace cc | 239 } // namespace cc |
OLD | NEW |