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

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

Issue 1175113010: cc: Rename visible_content_rect and content stuff on quads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename-visible-content-rect: moreandroid Created 5 years, 6 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/layers/video_layer_impl.cc ('k') | cc/output/bsp_walk_action.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 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 gfx::Rect occluded; 56 gfx::Rect occluded;
57 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); 57 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
58 58
59 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), 59 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(),
60 gfx::Rect(layer_size)); 60 gfx::Rect(layer_size));
61 EXPECT_EQ(1u, impl.quad_list().size()); 61 EXPECT_EQ(1u, impl.quad_list().size());
62 } 62 }
63 63
64 { 64 {
65 SCOPED_TRACE("Full occlusion"); 65 SCOPED_TRACE("Full occlusion");
66 gfx::Rect occluded(video_layer_impl->visible_content_rect()); 66 gfx::Rect occluded(video_layer_impl->visible_layer_rect());
67 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); 67 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
68 68
69 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); 69 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect());
70 EXPECT_EQ(impl.quad_list().size(), 0u); 70 EXPECT_EQ(impl.quad_list().size(), 0u);
71 } 71 }
72 72
73 { 73 {
74 SCOPED_TRACE("Partial occlusion"); 74 SCOPED_TRACE("Partial occlusion");
75 gfx::Rect occluded(200, 0, 800, 1000); 75 gfx::Rect occluded(200, 0, 800, 1000);
76 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); 76 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 impl.CalcDrawProps(viewport_size); 169 impl.CalcDrawProps(viewport_size);
170 gfx::Rect occluded; 170 gfx::Rect occluded;
171 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); 171 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
172 172
173 EXPECT_EQ(1u, impl.quad_list().size()); 173 EXPECT_EQ(1u, impl.quad_list().size());
174 174
175 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0); 175 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0);
176 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0); 176 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0);
177 impl.quad_list() 177 impl.quad_list()
178 .front() 178 .front()
179 ->shared_quad_state->content_to_target_transform.TransformPoint(&p1); 179 ->shared_quad_state->quad_to_target_transform.TransformPoint(&p1);
180 impl.quad_list() 180 impl.quad_list()
181 .front() 181 .front()
182 ->shared_quad_state->content_to_target_transform.TransformPoint(&p2); 182 ->shared_quad_state->quad_to_target_transform.TransformPoint(&p2);
183 EXPECT_EQ(gfx::Point3F(0, 50, 0), p1); 183 EXPECT_EQ(gfx::Point3F(0, 50, 0), p1);
184 EXPECT_EQ(gfx::Point3F(100, 0, 0), p2); 184 EXPECT_EQ(gfx::Point3F(100, 0, 0), p2);
185 } 185 }
186 186
187 TEST(VideoLayerImplTest, Rotated90) { 187 TEST(VideoLayerImplTest, Rotated90) {
188 gfx::Size layer_size(100, 50); 188 gfx::Size layer_size(100, 50);
189 gfx::Size viewport_size(1000, 500); 189 gfx::Size viewport_size(1000, 500);
190 190
191 LayerTestCommon::LayerImplTest impl; 191 LayerTestCommon::LayerImplTest impl;
192 DebugSetImplThreadAndMainThreadBlocked(impl.proxy()); 192 DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
(...skipping 15 matching lines...) Expand all
208 impl.CalcDrawProps(viewport_size); 208 impl.CalcDrawProps(viewport_size);
209 gfx::Rect occluded; 209 gfx::Rect occluded;
210 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); 210 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
211 211
212 EXPECT_EQ(1u, impl.quad_list().size()); 212 EXPECT_EQ(1u, impl.quad_list().size());
213 213
214 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0); 214 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0);
215 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0); 215 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0);
216 impl.quad_list() 216 impl.quad_list()
217 .front() 217 .front()
218 ->shared_quad_state->content_to_target_transform.TransformPoint(&p1); 218 ->shared_quad_state->quad_to_target_transform.TransformPoint(&p1);
219 impl.quad_list() 219 impl.quad_list()
220 .front() 220 .front()
221 ->shared_quad_state->content_to_target_transform.TransformPoint(&p2); 221 ->shared_quad_state->quad_to_target_transform.TransformPoint(&p2);
222 EXPECT_EQ(gfx::Point3F(0, 0, 0), p1); 222 EXPECT_EQ(gfx::Point3F(0, 0, 0), p1);
223 EXPECT_EQ(gfx::Point3F(100, 50, 0), p2); 223 EXPECT_EQ(gfx::Point3F(100, 50, 0), p2);
224 } 224 }
225 225
226 TEST(VideoLayerImplTest, Rotated180) { 226 TEST(VideoLayerImplTest, Rotated180) {
227 gfx::Size layer_size(100, 50); 227 gfx::Size layer_size(100, 50);
228 gfx::Size viewport_size(1000, 500); 228 gfx::Size viewport_size(1000, 500);
229 229
230 LayerTestCommon::LayerImplTest impl; 230 LayerTestCommon::LayerImplTest impl;
231 DebugSetImplThreadAndMainThreadBlocked(impl.proxy()); 231 DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
(...skipping 15 matching lines...) Expand all
247 impl.CalcDrawProps(viewport_size); 247 impl.CalcDrawProps(viewport_size);
248 gfx::Rect occluded; 248 gfx::Rect occluded;
249 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); 249 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
250 250
251 EXPECT_EQ(1u, impl.quad_list().size()); 251 EXPECT_EQ(1u, impl.quad_list().size());
252 252
253 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0); 253 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0);
254 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0); 254 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0);
255 impl.quad_list() 255 impl.quad_list()
256 .front() 256 .front()
257 ->shared_quad_state->content_to_target_transform.TransformPoint(&p1); 257 ->shared_quad_state->quad_to_target_transform.TransformPoint(&p1);
258 impl.quad_list() 258 impl.quad_list()
259 .front() 259 .front()
260 ->shared_quad_state->content_to_target_transform.TransformPoint(&p2); 260 ->shared_quad_state->quad_to_target_transform.TransformPoint(&p2);
261 EXPECT_EQ(gfx::Point3F(100, 0, 0), p1); 261 EXPECT_EQ(gfx::Point3F(100, 0, 0), p1);
262 EXPECT_EQ(gfx::Point3F(0, 50, 0), p2); 262 EXPECT_EQ(gfx::Point3F(0, 50, 0), p2);
263 } 263 }
264 264
265 TEST(VideoLayerImplTest, Rotated270) { 265 TEST(VideoLayerImplTest, Rotated270) {
266 gfx::Size layer_size(100, 50); 266 gfx::Size layer_size(100, 50);
267 gfx::Size viewport_size(1000, 500); 267 gfx::Size viewport_size(1000, 500);
268 268
269 LayerTestCommon::LayerImplTest impl; 269 LayerTestCommon::LayerImplTest impl;
270 DebugSetImplThreadAndMainThreadBlocked(impl.proxy()); 270 DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
(...skipping 15 matching lines...) Expand all
286 impl.CalcDrawProps(viewport_size); 286 impl.CalcDrawProps(viewport_size);
287 gfx::Rect occluded; 287 gfx::Rect occluded;
288 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); 288 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
289 289
290 EXPECT_EQ(1u, impl.quad_list().size()); 290 EXPECT_EQ(1u, impl.quad_list().size());
291 291
292 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0); 292 gfx::Point3F p1(0, impl.quad_list().front()->rect.height(), 0);
293 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0); 293 gfx::Point3F p2(impl.quad_list().front()->rect.width(), 0, 0);
294 impl.quad_list() 294 impl.quad_list()
295 .front() 295 .front()
296 ->shared_quad_state->content_to_target_transform.TransformPoint(&p1); 296 ->shared_quad_state->quad_to_target_transform.TransformPoint(&p1);
297 impl.quad_list() 297 impl.quad_list()
298 .front() 298 .front()
299 ->shared_quad_state->content_to_target_transform.TransformPoint(&p2); 299 ->shared_quad_state->quad_to_target_transform.TransformPoint(&p2);
300 EXPECT_EQ(gfx::Point3F(100, 50, 0), p1); 300 EXPECT_EQ(gfx::Point3F(100, 50, 0), p1);
301 EXPECT_EQ(gfx::Point3F(0, 0, 0), p2); 301 EXPECT_EQ(gfx::Point3F(0, 0, 0), p2);
302 } 302 }
303 303
304 void EmptyCallback(unsigned sync_point) { 304 void EmptyCallback(unsigned sync_point) {
305 } 305 }
306 306
307 TEST(VideoLayerImplTest, SoftwareVideoFrameGeneratesYUVQuad) { 307 TEST(VideoLayerImplTest, SoftwareVideoFrameGeneratesYUVQuad) {
308 gfx::Size layer_size(1000, 1000); 308 gfx::Size layer_size(1000, 1000);
309 gfx::Size viewport_size(1000, 1000); 309 gfx::Size viewport_size(1000, 1000);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 const YUVVideoDrawQuad* yuv_draw_quad = 376 const YUVVideoDrawQuad* yuv_draw_quad =
377 static_cast<const YUVVideoDrawQuad*>(draw_quad); 377 static_cast<const YUVVideoDrawQuad*>(draw_quad);
378 EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(), 378 EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(),
379 (yuv_draw_quad->ya_tex_size.height() + 1) / 2); 379 (yuv_draw_quad->ya_tex_size.height() + 1) / 2);
380 EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(), 380 EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(),
381 (yuv_draw_quad->ya_tex_size.width() + 1) / 2); 381 (yuv_draw_quad->ya_tex_size.width() + 1) / 2);
382 } 382 }
383 383
384 } // namespace 384 } // namespace
385 } // namespace cc 385 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/video_layer_impl.cc ('k') | cc/output/bsp_walk_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698