Lock video controls' position during fullscreen
[chromium-blink-merge.git] / cc / quads / draw_quad_unittest.cc
blob1b1e9618a3252e10fe3a8e72d3f8149678c09f87
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
3 // found in the LICENSE file.
5 #include "cc/quads/draw_quad.h"
7 #include <algorithm>
9 #include "base/bind.h"
10 #include "base/compiler_specific.h"
11 #include "cc/base/math_util.h"
12 #include "cc/output/filter_operations.h"
13 #include "cc/quads/debug_border_draw_quad.h"
14 #include "cc/quads/io_surface_draw_quad.h"
15 #include "cc/quads/largest_draw_quad.h"
16 #include "cc/quads/picture_draw_quad.h"
17 #include "cc/quads/render_pass.h"
18 #include "cc/quads/render_pass_draw_quad.h"
19 #include "cc/quads/solid_color_draw_quad.h"
20 #include "cc/quads/stream_video_draw_quad.h"
21 #include "cc/quads/surface_draw_quad.h"
22 #include "cc/quads/texture_draw_quad.h"
23 #include "cc/quads/tile_draw_quad.h"
24 #include "cc/quads/yuv_video_draw_quad.h"
25 #include "cc/test/fake_picture_pile_impl.h"
26 #include "cc/test/geometry_test_utils.h"
27 #include "testing/gtest/include/gtest/gtest.h"
28 #include "third_party/skia/include/effects/SkBlurImageFilter.h"
29 #include "ui/gfx/transform.h"
31 namespace cc {
32 namespace {
34 TEST(DrawQuadTest, CopySharedQuadState) {
35 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0);
36 gfx::Size layer_bounds(26, 28);
37 gfx::Rect visible_layer_rect(10, 12, 14, 16);
38 gfx::Rect clip_rect(19, 21, 23, 25);
39 bool is_clipped = true;
40 float opacity = 0.25f;
41 SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode;
42 int sorting_context_id = 65536;
44 scoped_ptr<SharedQuadState> state(new SharedQuadState);
45 state->SetAll(quad_transform, layer_bounds, visible_layer_rect, clip_rect,
46 is_clipped, opacity, blend_mode, sorting_context_id);
48 scoped_ptr<SharedQuadState> copy(new SharedQuadState);
49 copy->CopyFrom(state.get());
50 EXPECT_EQ(quad_transform, copy->quad_to_target_transform);
51 EXPECT_EQ(visible_layer_rect, copy->visible_quad_layer_rect);
52 EXPECT_EQ(opacity, copy->opacity);
53 EXPECT_EQ(clip_rect, copy->clip_rect);
54 EXPECT_EQ(is_clipped, copy->is_clipped);
55 EXPECT_EQ(blend_mode, copy->blend_mode);
58 SharedQuadState* CreateSharedQuadState(RenderPass* render_pass) {
59 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0);
60 gfx::Size layer_bounds(26, 28);
61 gfx::Rect visible_layer_rect(10, 12, 14, 16);
62 gfx::Rect clip_rect(19, 21, 23, 25);
63 bool is_clipped = false;
64 float opacity = 1.f;
65 int sorting_context_id = 65536;
66 SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode;
68 SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState();
69 state->SetAll(quad_transform, layer_bounds, visible_layer_rect, clip_rect,
70 is_clipped, opacity, blend_mode, sorting_context_id);
71 return state;
74 void CompareDrawQuad(DrawQuad* quad,
75 DrawQuad* copy,
76 SharedQuadState* copy_shared_state) {
77 EXPECT_EQ(quad->material, copy->material);
78 EXPECT_EQ(quad->rect, copy->rect);
79 EXPECT_EQ(quad->visible_rect, copy->visible_rect);
80 EXPECT_EQ(quad->opaque_rect, copy->opaque_rect);
81 EXPECT_EQ(quad->needs_blending, copy->needs_blending);
82 EXPECT_EQ(copy_shared_state, copy->shared_quad_state);
85 #define CREATE_SHARED_STATE() \
86 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); \
87 SharedQuadState* shared_state(CreateSharedQuadState(render_pass.get())); \
88 SharedQuadState* copy_shared_state = \
89 render_pass->CreateAndAppendSharedQuadState(); \
90 copy_shared_state->CopyFrom(shared_state);
92 #define QUAD_DATA \
93 gfx::Rect quad_rect(30, 40, 50, 60); \
94 gfx::Rect quad_visible_rect(40, 50, 30, 20); \
95 gfx::Rect quad_opaque_rect(60, 55, 10, 10); \
96 ALLOW_UNUSED_LOCAL(quad_opaque_rect); \
97 bool needs_blending = true; \
98 ALLOW_UNUSED_LOCAL(needs_blending);
100 #define SETUP_AND_COPY_QUAD_NEW(Type, quad) \
101 DrawQuad* copy_new = \
102 render_pass->CopyFromAndAppendDrawQuad(quad_new, copy_shared_state); \
103 CompareDrawQuad(quad_new, copy_new, copy_shared_state); \
104 const Type* copy_quad = Type::MaterialCast(copy_new); \
105 ALLOW_UNUSED_LOCAL(copy_quad);
107 #define SETUP_AND_COPY_QUAD_ALL(Type, quad) \
108 DrawQuad* copy_all = \
109 render_pass->CopyFromAndAppendDrawQuad(quad_all, copy_shared_state); \
110 CompareDrawQuad(quad_all, copy_all, copy_shared_state); \
111 copy_quad = Type::MaterialCast(copy_all);
113 #define SETUP_AND_COPY_QUAD_NEW_RP(Type, quad, a) \
114 DrawQuad* copy_new = render_pass->CopyFromAndAppendRenderPassDrawQuad( \
115 quad_new, copy_shared_state, a); \
116 CompareDrawQuad(quad_new, copy_new, copy_shared_state); \
117 const Type* copy_quad = Type::MaterialCast(copy_new); \
118 ALLOW_UNUSED_LOCAL(copy_quad);
120 #define SETUP_AND_COPY_QUAD_ALL_RP(Type, quad, a) \
121 DrawQuad* copy_all = render_pass->CopyFromAndAppendRenderPassDrawQuad( \
122 quad_all, copy_shared_state, a); \
123 CompareDrawQuad(quad_all, copy_all, copy_shared_state); \
124 copy_quad = Type::MaterialCast(copy_all);
126 #define CREATE_QUAD_1_NEW(Type, a) \
127 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
128 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a); } \
129 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
131 #define CREATE_QUAD_1_ALL(Type, a) \
132 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
134 QUAD_DATA quad_all->SetAll(shared_state, \
135 quad_rect, \
136 quad_opaque_rect, \
137 quad_visible_rect, \
138 needs_blending, \
139 a); \
141 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
143 #define CREATE_QUAD_2_NEW(Type, a, b) \
144 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
145 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b); } \
146 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
148 #define CREATE_QUAD_2_ALL(Type, a, b) \
149 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
151 QUAD_DATA quad_all->SetAll(shared_state, \
152 quad_rect, \
153 quad_opaque_rect, \
154 quad_visible_rect, \
155 needs_blending, \
156 a, \
157 b); \
159 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
161 #define CREATE_QUAD_3_NEW(Type, a, b, c) \
162 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
163 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c); } \
164 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
166 #define CREATE_QUAD_3_ALL(Type, a, b, c) \
167 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
169 QUAD_DATA quad_all->SetAll(shared_state, \
170 quad_rect, \
171 quad_opaque_rect, \
172 quad_visible_rect, \
173 needs_blending, \
174 a, \
175 b, \
176 c); \
178 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
180 #define CREATE_QUAD_4_NEW(Type, a, b, c, d) \
181 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
182 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d); } \
183 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
185 #define CREATE_QUAD_4_ALL(Type, a, b, c, d) \
186 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
188 QUAD_DATA quad_all->SetAll(shared_state, \
189 quad_rect, \
190 quad_opaque_rect, \
191 quad_visible_rect, \
192 needs_blending, \
193 a, \
194 b, \
195 c, \
196 d); \
198 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
200 #define CREATE_QUAD_5_NEW(Type, a, b, c, d, e) \
201 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
202 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d, e); } \
203 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
205 #define CREATE_QUAD_5_ALL(Type, a, b, c, d, e) \
206 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
208 QUAD_DATA quad_all->SetAll(shared_state, \
209 quad_rect, \
210 quad_opaque_rect, \
211 quad_visible_rect, \
212 needs_blending, \
213 a, \
214 b, \
215 c, \
216 d, \
217 e); \
219 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
221 #define CREATE_QUAD_6_NEW(Type, a, b, c, d, e, f) \
222 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
223 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d, e, f); } \
224 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
226 #define CREATE_QUAD_6_ALL(Type, a, b, c, d, e, f) \
227 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
229 QUAD_DATA quad_all->SetAll(shared_state, \
230 quad_rect, \
231 quad_opaque_rect, \
232 quad_visible_rect, \
233 needs_blending, \
234 a, \
235 b, \
236 c, \
237 d, \
238 e, \
239 f); \
241 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
243 #define CREATE_QUAD_7_NEW(Type, a, b, c, d, e, f, g) \
244 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
246 QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d, e, f, g); \
248 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
250 #define CREATE_QUAD_7_ALL(Type, a, b, c, d, e, f, g) \
251 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
253 QUAD_DATA quad_all->SetAll(shared_state, \
254 quad_rect, \
255 quad_opaque_rect, \
256 quad_visible_rect, \
257 needs_blending, \
258 a, \
259 b, \
260 c, \
261 d, \
262 e, \
263 f, \
264 g); \
266 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
268 #define CREATE_QUAD_8_NEW(Type, a, b, c, d, e, f, g, h) \
269 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
271 QUAD_DATA quad_new->SetNew( \
272 shared_state, quad_rect, a, b, c, d, e, f, g, h); \
274 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
276 #define CREATE_QUAD_8_ALL(Type, a, b, c, d, e, f, g, h) \
277 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
279 QUAD_DATA quad_all->SetAll(shared_state, \
280 quad_rect, \
281 quad_opaque_rect, \
282 quad_visible_rect, \
283 needs_blending, \
284 a, \
285 b, \
286 c, \
287 d, \
288 e, \
289 f, \
290 g, \
291 h); \
293 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
295 #define CREATE_QUAD_9_NEW(Type, a, b, c, d, e, f, g, h, i) \
296 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
298 QUAD_DATA quad_new->SetNew( \
299 shared_state, quad_rect, a, b, c, d, e, f, g, h, i); \
301 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
303 #define CREATE_QUAD_9_ALL(Type, a, b, c, d, e, f, g, h, i) \
304 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
306 QUAD_DATA quad_all->SetAll(shared_state, quad_rect, quad_opaque_rect, \
307 quad_visible_rect, needs_blending, a, b, c, d, \
308 e, f, g, h, i); \
310 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
312 #define CREATE_QUAD_10_NEW(Type, a, b, c, d, e, f, g, h, i, j) \
313 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
315 QUAD_DATA quad_new->SetNew( \
316 shared_state, quad_rect, a, b, c, d, e, f, g, h, i, j); \
318 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
320 #define CREATE_QUAD_10_ALL(Type, a, b, c, d, e, f, g, h, i, j) \
321 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
323 QUAD_DATA quad_all->SetAll(shared_state, quad_rect, quad_opaque_rect, \
324 quad_visible_rect, needs_blending, a, b, c, d, \
325 e, f, g, h, i, j); \
327 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
329 #define CREATE_QUAD_11_NEW(Type, a, b, c, d, e, f, g, h, i, j, k) \
330 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
332 QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d, e, f, g, \
333 h, i, j, k); \
335 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
337 #define CREATE_QUAD_ALL_RP(Type, a, b, c, d, e, f, g, copy_a) \
338 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
340 QUAD_DATA quad_all->SetAll(shared_state, \
341 quad_rect, \
342 quad_opaque_rect, \
343 quad_visible_rect, \
344 needs_blending, \
345 a, \
346 b, \
347 c, \
348 d, \
349 e, \
350 f, \
351 g); \
353 SETUP_AND_COPY_QUAD_ALL_RP(Type, quad_all, copy_a);
355 #define CREATE_QUAD_NEW_RP(Type, a, b, c, d, e, f, g, h, copy_a) \
356 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
358 QUAD_DATA quad_new->SetNew( \
359 shared_state, quad_rect, a, b, c, d, e, f, g, h); \
361 SETUP_AND_COPY_QUAD_NEW_RP(Type, quad_new, copy_a);
363 TEST(DrawQuadTest, CopyDebugBorderDrawQuad) {
364 gfx::Rect visible_rect(40, 50, 30, 20);
365 SkColor color = 0xfabb0011;
366 int width = 99;
367 CREATE_SHARED_STATE();
369 CREATE_QUAD_3_NEW(DebugBorderDrawQuad, visible_rect, color, width);
370 EXPECT_EQ(DrawQuad::DEBUG_BORDER, copy_quad->material);
371 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
372 EXPECT_EQ(color, copy_quad->color);
373 EXPECT_EQ(width, copy_quad->width);
375 CREATE_QUAD_2_ALL(DebugBorderDrawQuad, color, width);
376 EXPECT_EQ(DrawQuad::DEBUG_BORDER, copy_quad->material);
377 EXPECT_EQ(color, copy_quad->color);
378 EXPECT_EQ(width, copy_quad->width);
381 TEST(DrawQuadTest, CopyIOSurfaceDrawQuad) {
382 gfx::Rect opaque_rect(33, 47, 10, 12);
383 gfx::Rect visible_rect(40, 50, 30, 20);
384 gfx::Size size(58, 95);
385 ResourceId resource_id = 72;
386 IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED;
387 CREATE_SHARED_STATE();
389 CREATE_QUAD_5_NEW(IOSurfaceDrawQuad,
390 opaque_rect,
391 visible_rect,
392 size,
393 resource_id,
394 orientation);
395 EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material);
396 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
397 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
398 EXPECT_EQ(size, copy_quad->io_surface_size);
399 EXPECT_EQ(resource_id, copy_quad->io_surface_resource_id());
400 EXPECT_EQ(orientation, copy_quad->orientation);
402 CREATE_QUAD_3_ALL(IOSurfaceDrawQuad, size, resource_id, orientation);
403 EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material);
404 EXPECT_EQ(size, copy_quad->io_surface_size);
405 EXPECT_EQ(resource_id, copy_quad->io_surface_resource_id());
406 EXPECT_EQ(orientation, copy_quad->orientation);
409 TEST(DrawQuadTest, CopyRenderPassDrawQuad) {
410 gfx::Rect visible_rect(40, 50, 30, 20);
411 RenderPassId render_pass_id(22, 64);
412 ResourceId mask_resource_id = 78;
413 gfx::Vector2dF mask_uv_scale(33.f, 19.f);
414 gfx::Size mask_texture_size(128, 134);
415 FilterOperations filters;
416 filters.Append(FilterOperation::CreateBlurFilter(1.f));
417 gfx::Vector2dF filters_scale;
418 FilterOperations background_filters;
419 background_filters.Append(
420 FilterOperation::CreateGrayscaleFilter(1.f));
422 RenderPassId copied_render_pass_id(235, 11);
423 CREATE_SHARED_STATE();
425 CREATE_QUAD_NEW_RP(RenderPassDrawQuad,
426 visible_rect,
427 render_pass_id,
428 mask_resource_id,
429 mask_uv_scale,
430 mask_texture_size,
431 filters,
432 filters_scale,
433 background_filters,
434 copied_render_pass_id);
435 EXPECT_EQ(DrawQuad::RENDER_PASS, copy_quad->material);
436 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
437 EXPECT_EQ(copied_render_pass_id, copy_quad->render_pass_id);
438 EXPECT_EQ(mask_resource_id, copy_quad->mask_resource_id());
439 EXPECT_EQ(mask_uv_scale.ToString(), copy_quad->mask_uv_scale.ToString());
440 EXPECT_EQ(mask_texture_size.ToString(),
441 copy_quad->mask_texture_size.ToString());
442 EXPECT_EQ(filters, copy_quad->filters);
443 EXPECT_EQ(filters_scale, copy_quad->filters_scale);
444 EXPECT_EQ(background_filters, copy_quad->background_filters);
446 CREATE_QUAD_ALL_RP(RenderPassDrawQuad,
447 render_pass_id,
448 mask_resource_id,
449 mask_uv_scale,
450 mask_texture_size,
451 filters,
452 filters_scale,
453 background_filters,
454 copied_render_pass_id);
455 EXPECT_EQ(DrawQuad::RENDER_PASS, copy_quad->material);
456 EXPECT_EQ(copied_render_pass_id, copy_quad->render_pass_id);
457 EXPECT_EQ(mask_resource_id, copy_quad->mask_resource_id());
458 EXPECT_EQ(mask_uv_scale.ToString(), copy_quad->mask_uv_scale.ToString());
459 EXPECT_EQ(mask_texture_size.ToString(),
460 copy_quad->mask_texture_size.ToString());
461 EXPECT_EQ(filters, copy_quad->filters);
462 EXPECT_EQ(filters_scale, copy_quad->filters_scale);
463 EXPECT_EQ(background_filters, copy_quad->background_filters);
466 TEST(DrawQuadTest, CopySolidColorDrawQuad) {
467 gfx::Rect visible_rect(40, 50, 30, 20);
468 SkColor color = 0x49494949;
469 bool force_anti_aliasing_off = false;
470 CREATE_SHARED_STATE();
472 CREATE_QUAD_3_NEW(
473 SolidColorDrawQuad, visible_rect, color, force_anti_aliasing_off);
474 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material);
475 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
476 EXPECT_EQ(color, copy_quad->color);
477 EXPECT_EQ(force_anti_aliasing_off, copy_quad->force_anti_aliasing_off);
479 CREATE_QUAD_2_ALL(SolidColorDrawQuad, color, force_anti_aliasing_off);
480 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material);
481 EXPECT_EQ(color, copy_quad->color);
482 EXPECT_EQ(force_anti_aliasing_off, copy_quad->force_anti_aliasing_off);
485 TEST(DrawQuadTest, CopyStreamVideoDrawQuad) {
486 gfx::Rect opaque_rect(33, 47, 10, 12);
487 gfx::Rect visible_rect(40, 50, 30, 20);
488 ResourceId resource_id = 64;
489 gfx::Size resource_size_in_pixels = gfx::Size(40, 41);
490 bool allow_overlay = true;
491 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1);
492 CREATE_SHARED_STATE();
494 CREATE_QUAD_6_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id,
495 resource_size_in_pixels, allow_overlay, matrix);
496 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material);
497 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
498 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
499 EXPECT_EQ(resource_id, copy_quad->resource_id());
500 EXPECT_EQ(allow_overlay, copy_quad->allow_overlay());
501 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels());
502 EXPECT_EQ(matrix, copy_quad->matrix);
504 CREATE_QUAD_4_ALL(StreamVideoDrawQuad, resource_id, resource_size_in_pixels,
505 allow_overlay, matrix);
506 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material);
507 EXPECT_EQ(resource_id, copy_quad->resource_id());
508 EXPECT_EQ(allow_overlay, copy_quad->allow_overlay());
509 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels());
510 EXPECT_EQ(matrix, copy_quad->matrix);
513 TEST(DrawQuadTest, CopySurfaceDrawQuad) {
514 gfx::Rect visible_rect(40, 50, 30, 20);
515 SurfaceId surface_id(1234);
516 CREATE_SHARED_STATE();
518 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id);
519 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material);
520 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
521 EXPECT_EQ(surface_id, copy_quad->surface_id);
523 CREATE_QUAD_1_ALL(SurfaceDrawQuad, surface_id);
524 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material);
525 EXPECT_EQ(surface_id, copy_quad->surface_id);
529 TEST(DrawQuadTest, CopyTextureDrawQuad) {
530 gfx::Rect opaque_rect(33, 47, 10, 12);
531 gfx::Rect visible_rect(40, 50, 30, 20);
532 unsigned resource_id = 82;
533 gfx::Size resource_size_in_pixels = gfx::Size(40, 41);
534 bool allow_overlay = true;
535 bool premultiplied_alpha = true;
536 gfx::PointF uv_top_left(0.5f, 224.f);
537 gfx::PointF uv_bottom_right(51.5f, 260.f);
538 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f };
539 bool y_flipped = true;
540 bool nearest_neighbor = true;
541 CREATE_SHARED_STATE();
543 CREATE_QUAD_10_NEW(TextureDrawQuad,
544 opaque_rect,
545 visible_rect,
546 resource_id,
547 premultiplied_alpha,
548 uv_top_left,
549 uv_bottom_right,
550 SK_ColorTRANSPARENT,
551 vertex_opacity,
552 y_flipped,
553 nearest_neighbor);
554 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material);
555 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
556 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
557 EXPECT_EQ(resource_id, copy_quad->resource_id());
558 EXPECT_EQ(premultiplied_alpha, copy_quad->premultiplied_alpha);
559 EXPECT_EQ(uv_top_left, copy_quad->uv_top_left);
560 EXPECT_EQ(uv_bottom_right, copy_quad->uv_bottom_right);
561 EXPECT_FLOAT_ARRAY_EQ(vertex_opacity, copy_quad->vertex_opacity, 4);
562 EXPECT_EQ(y_flipped, copy_quad->y_flipped);
563 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
565 CREATE_QUAD_10_ALL(TextureDrawQuad, resource_id, resource_size_in_pixels,
566 allow_overlay, premultiplied_alpha, uv_top_left,
567 uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity,
568 y_flipped, nearest_neighbor);
569 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material);
570 EXPECT_EQ(resource_id, copy_quad->resource_id());
571 EXPECT_EQ(allow_overlay, copy_quad->allow_overlay());
572 EXPECT_EQ(resource_size_in_pixels, copy_quad->resource_size_in_pixels());
573 EXPECT_EQ(premultiplied_alpha, copy_quad->premultiplied_alpha);
574 EXPECT_EQ(uv_top_left, copy_quad->uv_top_left);
575 EXPECT_EQ(uv_bottom_right, copy_quad->uv_bottom_right);
576 EXPECT_FLOAT_ARRAY_EQ(vertex_opacity, copy_quad->vertex_opacity, 4);
577 EXPECT_EQ(y_flipped, copy_quad->y_flipped);
578 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
581 TEST(DrawQuadTest, CopyTileDrawQuad) {
582 gfx::Rect opaque_rect(33, 44, 22, 33);
583 gfx::Rect visible_rect(40, 50, 30, 20);
584 unsigned resource_id = 104;
585 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
586 gfx::Size texture_size(85, 32);
587 bool swizzle_contents = true;
588 bool nearest_neighbor = true;
589 CREATE_SHARED_STATE();
591 CREATE_QUAD_7_NEW(TileDrawQuad,
592 opaque_rect,
593 visible_rect,
594 resource_id,
595 tex_coord_rect,
596 texture_size,
597 swizzle_contents,
598 nearest_neighbor);
599 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material);
600 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
601 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
602 EXPECT_EQ(resource_id, copy_quad->resource_id());
603 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
604 EXPECT_EQ(texture_size, copy_quad->texture_size);
605 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents);
606 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
608 CREATE_QUAD_5_ALL(TileDrawQuad,
609 resource_id,
610 tex_coord_rect,
611 texture_size,
612 swizzle_contents,
613 nearest_neighbor);
614 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material);
615 EXPECT_EQ(resource_id, copy_quad->resource_id());
616 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
617 EXPECT_EQ(texture_size, copy_quad->texture_size);
618 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents);
619 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
622 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) {
623 gfx::Rect opaque_rect(33, 47, 10, 12);
624 gfx::Rect visible_rect(40, 50, 30, 20);
625 gfx::RectF ya_tex_coord_rect(40, 50, 30, 20);
626 gfx::RectF uv_tex_coord_rect(20, 25, 15, 10);
627 gfx::Size ya_tex_size(32, 68);
628 gfx::Size uv_tex_size(41, 51);
629 ResourceId y_plane_resource_id = 45;
630 ResourceId u_plane_resource_id = 532;
631 ResourceId v_plane_resource_id = 4;
632 ResourceId a_plane_resource_id = 63;
633 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::JPEG;
634 CREATE_SHARED_STATE();
636 CREATE_QUAD_11_NEW(YUVVideoDrawQuad, opaque_rect, visible_rect,
637 ya_tex_coord_rect, uv_tex_coord_rect, ya_tex_size,
638 uv_tex_size, y_plane_resource_id, u_plane_resource_id,
639 v_plane_resource_id, a_plane_resource_id, color_space);
640 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material);
641 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
642 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
643 EXPECT_EQ(ya_tex_coord_rect, copy_quad->ya_tex_coord_rect);
644 EXPECT_EQ(uv_tex_coord_rect, copy_quad->uv_tex_coord_rect);
645 EXPECT_EQ(ya_tex_size, copy_quad->ya_tex_size);
646 EXPECT_EQ(uv_tex_size, copy_quad->uv_tex_size);
647 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id());
648 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id());
649 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id());
650 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id());
651 EXPECT_EQ(color_space, copy_quad->color_space);
653 CREATE_QUAD_9_ALL(YUVVideoDrawQuad, ya_tex_coord_rect, uv_tex_coord_rect,
654 ya_tex_size, uv_tex_size, y_plane_resource_id,
655 u_plane_resource_id, v_plane_resource_id,
656 a_plane_resource_id, color_space);
657 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material);
658 EXPECT_EQ(ya_tex_coord_rect, copy_quad->ya_tex_coord_rect);
659 EXPECT_EQ(uv_tex_coord_rect, copy_quad->uv_tex_coord_rect);
660 EXPECT_EQ(ya_tex_size, copy_quad->ya_tex_size);
661 EXPECT_EQ(uv_tex_size, copy_quad->uv_tex_size);
662 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id());
663 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id());
664 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id());
665 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id());
666 EXPECT_EQ(color_space, copy_quad->color_space);
669 TEST(DrawQuadTest, CopyPictureDrawQuad) {
670 gfx::Rect opaque_rect(33, 44, 22, 33);
671 gfx::Rect visible_rect(40, 50, 30, 20);
672 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
673 gfx::Size texture_size(85, 32);
674 bool nearest_neighbor = true;
675 ResourceFormat texture_format = RGBA_8888;
676 gfx::Rect content_rect(30, 40, 20, 30);
677 float contents_scale = 3.141592f;
678 scoped_refptr<RasterSource> raster_source =
679 FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100),
680 gfx::Size(100, 100));
681 CREATE_SHARED_STATE();
683 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect,
684 texture_size, nearest_neighbor, texture_format,
685 content_rect, contents_scale, raster_source);
686 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material);
687 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
688 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
689 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
690 EXPECT_EQ(texture_size, copy_quad->texture_size);
691 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
692 EXPECT_EQ(texture_format, copy_quad->texture_format);
693 EXPECT_EQ(content_rect, copy_quad->content_rect);
694 EXPECT_EQ(contents_scale, copy_quad->contents_scale);
695 EXPECT_EQ(raster_source, copy_quad->raster_source);
697 CREATE_QUAD_7_ALL(PictureDrawQuad, tex_coord_rect, texture_size,
698 nearest_neighbor, texture_format, content_rect,
699 contents_scale, raster_source);
700 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material);
701 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
702 EXPECT_EQ(texture_size, copy_quad->texture_size);
703 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
704 EXPECT_EQ(texture_format, copy_quad->texture_format);
705 EXPECT_EQ(content_rect, copy_quad->content_rect);
706 EXPECT_EQ(contents_scale, copy_quad->contents_scale);
707 EXPECT_EQ(raster_source, copy_quad->raster_source);
710 class DrawQuadIteratorTest : public testing::Test {
711 protected:
712 int IterateAndCount(DrawQuad* quad) {
713 num_resources_ = 0;
714 for (ResourceId& resource_id : quad->resources) {
715 ++num_resources_;
716 ++resource_id;
718 return num_resources_;
721 private:
722 int num_resources_;
725 TEST_F(DrawQuadIteratorTest, DebugBorderDrawQuad) {
726 gfx::Rect visible_rect(40, 50, 30, 20);
727 SkColor color = 0xfabb0011;
728 int width = 99;
730 CREATE_SHARED_STATE();
731 CREATE_QUAD_3_NEW(DebugBorderDrawQuad, visible_rect, color, width);
732 EXPECT_EQ(0, IterateAndCount(quad_new));
735 TEST_F(DrawQuadIteratorTest, IOSurfaceDrawQuad) {
736 gfx::Rect opaque_rect(33, 47, 10, 12);
737 gfx::Rect visible_rect(40, 50, 30, 20);
738 gfx::Size size(58, 95);
739 ResourceId resource_id = 72;
740 IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED;
742 CREATE_SHARED_STATE();
743 CREATE_QUAD_5_NEW(IOSurfaceDrawQuad,
744 opaque_rect,
745 visible_rect,
746 size,
747 resource_id,
748 orientation);
749 EXPECT_EQ(resource_id, quad_new->io_surface_resource_id());
750 EXPECT_EQ(1, IterateAndCount(quad_new));
751 EXPECT_EQ(resource_id + 1, quad_new->io_surface_resource_id());
754 TEST_F(DrawQuadIteratorTest, RenderPassDrawQuad) {
755 gfx::Rect visible_rect(40, 50, 30, 20);
756 RenderPassId render_pass_id(22, 64);
757 ResourceId mask_resource_id = 78;
758 gfx::Vector2dF mask_uv_scale(33.f, 19.f);
759 gfx::Size mask_texture_size(128, 134);
760 FilterOperations filters;
761 filters.Append(FilterOperation::CreateBlurFilter(1.f));
762 gfx::Vector2dF filters_scale(2.f, 3.f);
763 FilterOperations background_filters;
764 background_filters.Append(
765 FilterOperation::CreateGrayscaleFilter(1.f));
767 RenderPassId copied_render_pass_id(235, 11);
769 CREATE_SHARED_STATE();
770 CREATE_QUAD_NEW_RP(RenderPassDrawQuad,
771 visible_rect,
772 render_pass_id,
773 mask_resource_id,
774 mask_uv_scale,
775 mask_texture_size,
776 filters,
777 filters_scale,
778 background_filters,
779 copied_render_pass_id);
780 EXPECT_EQ(mask_resource_id, quad_new->mask_resource_id());
781 EXPECT_EQ(1, IterateAndCount(quad_new));
782 EXPECT_EQ(mask_resource_id + 1, quad_new->mask_resource_id());
784 ResourceId new_mask_resource_id = 0;
785 gfx::Rect quad_rect(30, 40, 50, 60);
786 quad_new->SetNew(shared_state, quad_rect, visible_rect, render_pass_id,
787 new_mask_resource_id, mask_uv_scale, mask_texture_size,
788 filters, filters_scale, background_filters);
789 EXPECT_EQ(0, IterateAndCount(quad_new));
790 EXPECT_EQ(0u, quad_new->mask_resource_id());
793 TEST_F(DrawQuadIteratorTest, SolidColorDrawQuad) {
794 gfx::Rect visible_rect(40, 50, 30, 20);
795 SkColor color = 0x49494949;
796 bool force_anti_aliasing_off = false;
798 CREATE_SHARED_STATE();
799 CREATE_QUAD_3_NEW(
800 SolidColorDrawQuad, visible_rect, color, force_anti_aliasing_off);
801 EXPECT_EQ(0, IterateAndCount(quad_new));
804 TEST_F(DrawQuadIteratorTest, StreamVideoDrawQuad) {
805 gfx::Rect opaque_rect(33, 47, 10, 12);
806 gfx::Rect visible_rect(40, 50, 30, 20);
807 ResourceId resource_id = 64;
808 gfx::Size resource_size_in_pixels = gfx::Size(40, 41);
809 bool allow_overlay = true;
810 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1);
812 CREATE_SHARED_STATE();
813 CREATE_QUAD_6_NEW(StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id,
814 resource_size_in_pixels, allow_overlay, matrix);
815 EXPECT_EQ(resource_id, quad_new->resource_id());
816 EXPECT_EQ(allow_overlay, quad_new->allow_overlay());
817 EXPECT_EQ(resource_size_in_pixels, quad_new->resource_size_in_pixels());
818 EXPECT_EQ(1, IterateAndCount(quad_new));
819 EXPECT_EQ(resource_id + 1, quad_new->resource_id());
822 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) {
823 gfx::Rect visible_rect(40, 50, 30, 20);
824 SurfaceId surface_id(4321);
826 CREATE_SHARED_STATE();
827 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id);
828 EXPECT_EQ(0, IterateAndCount(quad_new));
831 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) {
832 gfx::Rect opaque_rect(33, 47, 10, 12);
833 gfx::Rect visible_rect(40, 50, 30, 20);
834 unsigned resource_id = 82;
835 bool premultiplied_alpha = true;
836 gfx::PointF uv_top_left(0.5f, 224.f);
837 gfx::PointF uv_bottom_right(51.5f, 260.f);
838 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f };
839 bool y_flipped = true;
840 bool nearest_neighbor = true;
842 CREATE_SHARED_STATE();
843 CREATE_QUAD_10_NEW(TextureDrawQuad,
844 opaque_rect,
845 visible_rect,
846 resource_id,
847 premultiplied_alpha,
848 uv_top_left,
849 uv_bottom_right,
850 SK_ColorTRANSPARENT,
851 vertex_opacity,
852 y_flipped,
853 nearest_neighbor);
854 EXPECT_EQ(resource_id, quad_new->resource_id());
855 EXPECT_EQ(1, IterateAndCount(quad_new));
856 EXPECT_EQ(resource_id + 1, quad_new->resource_id());
859 TEST_F(DrawQuadIteratorTest, TileDrawQuad) {
860 gfx::Rect opaque_rect(33, 44, 22, 33);
861 gfx::Rect visible_rect(40, 50, 30, 20);
862 unsigned resource_id = 104;
863 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
864 gfx::Size texture_size(85, 32);
865 bool swizzle_contents = true;
866 bool nearest_neighbor = true;
868 CREATE_SHARED_STATE();
869 CREATE_QUAD_7_NEW(TileDrawQuad,
870 opaque_rect,
871 visible_rect,
872 resource_id,
873 tex_coord_rect,
874 texture_size,
875 swizzle_contents,
876 nearest_neighbor);
877 EXPECT_EQ(resource_id, quad_new->resource_id());
878 EXPECT_EQ(1, IterateAndCount(quad_new));
879 EXPECT_EQ(resource_id + 1, quad_new->resource_id());
882 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) {
883 gfx::Rect opaque_rect(33, 47, 10, 12);
884 gfx::Rect visible_rect(40, 50, 30, 20);
885 gfx::RectF ya_tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f);
886 gfx::RectF uv_tex_coord_rect(0.0f, 0.0f, 0.375f, 0.25f);
887 gfx::Size ya_tex_size(32, 68);
888 gfx::Size uv_tex_size(41, 51);
889 ResourceId y_plane_resource_id = 45;
890 ResourceId u_plane_resource_id = 532;
891 ResourceId v_plane_resource_id = 4;
892 ResourceId a_plane_resource_id = 63;
893 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::JPEG;
895 CREATE_SHARED_STATE();
896 CREATE_QUAD_11_NEW(YUVVideoDrawQuad, opaque_rect, visible_rect,
897 ya_tex_coord_rect, uv_tex_coord_rect, ya_tex_size,
898 uv_tex_size, y_plane_resource_id, u_plane_resource_id,
899 v_plane_resource_id, a_plane_resource_id, color_space);
900 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material);
901 EXPECT_EQ(y_plane_resource_id, quad_new->y_plane_resource_id());
902 EXPECT_EQ(u_plane_resource_id, quad_new->u_plane_resource_id());
903 EXPECT_EQ(v_plane_resource_id, quad_new->v_plane_resource_id());
904 EXPECT_EQ(a_plane_resource_id, quad_new->a_plane_resource_id());
905 EXPECT_EQ(color_space, quad_new->color_space);
906 EXPECT_EQ(4, IterateAndCount(quad_new));
907 EXPECT_EQ(y_plane_resource_id + 1, quad_new->y_plane_resource_id());
908 EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id());
909 EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id());
910 EXPECT_EQ(a_plane_resource_id + 1, quad_new->a_plane_resource_id());
913 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715
914 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) {
915 gfx::Rect opaque_rect(33, 44, 22, 33);
916 gfx::Rect visible_rect(40, 50, 30, 20);
917 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
918 gfx::Size texture_size(85, 32);
919 bool nearest_neighbor = true;
920 ResourceFormat texture_format = RGBA_8888;
921 gfx::Rect content_rect(30, 40, 20, 30);
922 float contents_scale = 3.141592f;
923 scoped_refptr<RasterSource> raster_source =
924 FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100),
925 gfx::Size(100, 100));
927 CREATE_SHARED_STATE();
928 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect,
929 texture_size, nearest_neighbor, texture_format,
930 content_rect, contents_scale, raster_source);
931 EXPECT_EQ(0, IterateAndCount(quad_new));
934 TEST(DrawQuadTest, LargestQuadType) {
935 size_t largest = 0;
937 for (int i = 0; i <= DrawQuad::MATERIAL_LAST; ++i) {
938 switch (static_cast<DrawQuad::Material>(i)) {
939 case DrawQuad::DEBUG_BORDER:
940 largest = std::max(largest, sizeof(DebugBorderDrawQuad));
941 break;
942 case DrawQuad::IO_SURFACE_CONTENT:
943 largest = std::max(largest, sizeof(IOSurfaceDrawQuad));
944 break;
945 case DrawQuad::PICTURE_CONTENT:
946 largest = std::max(largest, sizeof(PictureDrawQuad));
947 break;
948 case DrawQuad::TEXTURE_CONTENT:
949 largest = std::max(largest, sizeof(TextureDrawQuad));
950 break;
951 case DrawQuad::RENDER_PASS:
952 largest = std::max(largest, sizeof(RenderPassDrawQuad));
953 break;
954 case DrawQuad::SOLID_COLOR:
955 largest = std::max(largest, sizeof(SolidColorDrawQuad));
956 break;
957 case DrawQuad::SURFACE_CONTENT:
958 largest = std::max(largest, sizeof(SurfaceDrawQuad));
959 break;
960 case DrawQuad::TILED_CONTENT:
961 largest = std::max(largest, sizeof(TileDrawQuad));
962 break;
963 case DrawQuad::STREAM_VIDEO_CONTENT:
964 largest = std::max(largest, sizeof(StreamVideoDrawQuad));
965 break;
966 case DrawQuad::YUV_VIDEO_CONTENT:
967 largest = std::max(largest, sizeof(YUVVideoDrawQuad));
968 break;
969 case DrawQuad::INVALID:
970 break;
973 EXPECT_EQ(LargestDrawQuadSize(), largest);
975 if (!HasFailure())
976 return;
978 // On failure, output the size of all quads for debugging.
979 LOG(ERROR) << "largest " << largest;
980 LOG(ERROR) << "kLargestDrawQuad " << LargestDrawQuadSize();
981 for (int i = 0; i <= DrawQuad::MATERIAL_LAST; ++i) {
982 switch (static_cast<DrawQuad::Material>(i)) {
983 case DrawQuad::DEBUG_BORDER:
984 LOG(ERROR) << "DebugBorderDrawQuad " << sizeof(DebugBorderDrawQuad);
985 break;
986 case DrawQuad::IO_SURFACE_CONTENT:
987 LOG(ERROR) << "IOSurfaceDrawQuad " << sizeof(IOSurfaceDrawQuad);
988 break;
989 case DrawQuad::PICTURE_CONTENT:
990 LOG(ERROR) << "PictureDrawQuad " << sizeof(PictureDrawQuad);
991 break;
992 case DrawQuad::TEXTURE_CONTENT:
993 LOG(ERROR) << "TextureDrawQuad " << sizeof(TextureDrawQuad);
994 break;
995 case DrawQuad::RENDER_PASS:
996 LOG(ERROR) << "RenderPassDrawQuad " << sizeof(RenderPassDrawQuad);
997 break;
998 case DrawQuad::SOLID_COLOR:
999 LOG(ERROR) << "SolidColorDrawQuad " << sizeof(SolidColorDrawQuad);
1000 break;
1001 case DrawQuad::SURFACE_CONTENT:
1002 LOG(ERROR) << "SurfaceDrawQuad " << sizeof(SurfaceDrawQuad);
1003 break;
1004 case DrawQuad::TILED_CONTENT:
1005 LOG(ERROR) << "TileDrawQuad " << sizeof(TileDrawQuad);
1006 break;
1007 case DrawQuad::STREAM_VIDEO_CONTENT:
1008 LOG(ERROR) << "StreamVideoDrawQuad " << sizeof(StreamVideoDrawQuad);
1009 break;
1010 case DrawQuad::YUV_VIDEO_CONTENT:
1011 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad);
1012 break;
1013 case DrawQuad::INVALID:
1014 break;
1019 } // namespace
1020 } // namespace cc