[cc] Add nearest neighbor filtering for PictureLayer.
[chromium-blink-merge.git] / cc / quads / draw_quad_unittest.cc
blob97fea32cabaf9dd8a2f99f4ebec0baf0b956cd0e
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/checkerboard_draw_quad.h"
14 #include "cc/quads/debug_border_draw_quad.h"
15 #include "cc/quads/io_surface_draw_quad.h"
16 #include "cc/quads/largest_draw_quad.h"
17 #include "cc/quads/picture_draw_quad.h"
18 #include "cc/quads/render_pass.h"
19 #include "cc/quads/render_pass_draw_quad.h"
20 #include "cc/quads/solid_color_draw_quad.h"
21 #include "cc/quads/stream_video_draw_quad.h"
22 #include "cc/quads/surface_draw_quad.h"
23 #include "cc/quads/texture_draw_quad.h"
24 #include "cc/quads/tile_draw_quad.h"
25 #include "cc/quads/yuv_video_draw_quad.h"
26 #include "cc/resources/picture_pile_impl.h"
27 #include "cc/test/geometry_test_utils.h"
28 #include "testing/gtest/include/gtest/gtest.h"
29 #include "third_party/skia/include/effects/SkBlurImageFilter.h"
30 #include "ui/gfx/transform.h"
32 namespace cc {
33 namespace {
35 TEST(DrawQuadTest, CopySharedQuadState) {
36 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0);
37 gfx::Size content_bounds(26, 28);
38 gfx::Rect visible_content_rect(10, 12, 14, 16);
39 gfx::Rect clip_rect(19, 21, 23, 25);
40 bool is_clipped = true;
41 float opacity = 0.25f;
42 SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode;
43 int sorting_context_id = 65536;
45 scoped_ptr<SharedQuadState> state(new SharedQuadState);
46 state->SetAll(quad_transform,
47 content_bounds,
48 visible_content_rect,
49 clip_rect,
50 is_clipped,
51 opacity,
52 blend_mode,
53 sorting_context_id);
55 scoped_ptr<SharedQuadState> copy(new SharedQuadState);
56 copy->CopyFrom(state.get());
57 EXPECT_EQ(quad_transform, copy->content_to_target_transform);
58 EXPECT_EQ(visible_content_rect, copy->visible_content_rect);
59 EXPECT_EQ(opacity, copy->opacity);
60 EXPECT_EQ(clip_rect, copy->clip_rect);
61 EXPECT_EQ(is_clipped, copy->is_clipped);
62 EXPECT_EQ(blend_mode, copy->blend_mode);
65 SharedQuadState* CreateSharedQuadState(RenderPass* render_pass) {
66 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0);
67 gfx::Size content_bounds(26, 28);
68 gfx::Rect visible_content_rect(10, 12, 14, 16);
69 gfx::Rect clip_rect(19, 21, 23, 25);
70 bool is_clipped = false;
71 float opacity = 1.f;
72 int sorting_context_id = 65536;
73 SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode;
75 SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState();
76 state->SetAll(quad_transform,
77 content_bounds,
78 visible_content_rect,
79 clip_rect,
80 is_clipped,
81 opacity,
82 blend_mode,
83 sorting_context_id);
84 return state;
87 void CompareDrawQuad(DrawQuad* quad,
88 DrawQuad* copy,
89 SharedQuadState* copy_shared_state) {
90 EXPECT_EQ(quad->material, copy->material);
91 EXPECT_EQ(quad->rect, copy->rect);
92 EXPECT_EQ(quad->visible_rect, copy->visible_rect);
93 EXPECT_EQ(quad->opaque_rect, copy->opaque_rect);
94 EXPECT_EQ(quad->needs_blending, copy->needs_blending);
95 EXPECT_EQ(copy_shared_state, copy->shared_quad_state);
98 #define CREATE_SHARED_STATE() \
99 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); \
100 SharedQuadState* shared_state(CreateSharedQuadState(render_pass.get())); \
101 SharedQuadState* copy_shared_state = \
102 render_pass->CreateAndAppendSharedQuadState(); \
103 copy_shared_state->CopyFrom(shared_state);
105 #define QUAD_DATA \
106 gfx::Rect quad_rect(30, 40, 50, 60); \
107 gfx::Rect quad_visible_rect(40, 50, 30, 20); \
108 gfx::Rect quad_opaque_rect(60, 55, 10, 10); \
109 ALLOW_UNUSED_LOCAL(quad_opaque_rect); \
110 bool needs_blending = true; \
111 ALLOW_UNUSED_LOCAL(needs_blending);
113 #define SETUP_AND_COPY_QUAD_NEW(Type, quad) \
114 DrawQuad* copy_new = \
115 render_pass->CopyFromAndAppendDrawQuad(quad_new, copy_shared_state); \
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(Type, quad) \
121 DrawQuad* copy_all = \
122 render_pass->CopyFromAndAppendDrawQuad(quad_all, copy_shared_state); \
123 CompareDrawQuad(quad_all, copy_all, copy_shared_state); \
124 copy_quad = Type::MaterialCast(copy_all);
126 #define SETUP_AND_COPY_QUAD_NEW_RP(Type, quad, a) \
127 DrawQuad* copy_new = render_pass->CopyFromAndAppendRenderPassDrawQuad( \
128 quad_new, copy_shared_state, a); \
129 CompareDrawQuad(quad_new, copy_new, copy_shared_state); \
130 const Type* copy_quad = Type::MaterialCast(copy_new); \
131 ALLOW_UNUSED_LOCAL(copy_quad);
133 #define SETUP_AND_COPY_QUAD_ALL_RP(Type, quad, a) \
134 DrawQuad* copy_all = render_pass->CopyFromAndAppendRenderPassDrawQuad( \
135 quad_all, copy_shared_state, a); \
136 CompareDrawQuad(quad_all, copy_all, copy_shared_state); \
137 copy_quad = Type::MaterialCast(copy_all);
139 #define CREATE_QUAD_1_NEW(Type, a) \
140 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
141 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a); } \
142 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
144 #define CREATE_QUAD_1_ALL(Type, a) \
145 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
147 QUAD_DATA quad_all->SetAll(shared_state, \
148 quad_rect, \
149 quad_opaque_rect, \
150 quad_visible_rect, \
151 needs_blending, \
152 a); \
154 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
156 #define CREATE_QUAD_2_NEW(Type, a, b) \
157 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
158 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b); } \
159 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
161 #define CREATE_QUAD_2_ALL(Type, a, b) \
162 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
164 QUAD_DATA quad_all->SetAll(shared_state, \
165 quad_rect, \
166 quad_opaque_rect, \
167 quad_visible_rect, \
168 needs_blending, \
169 a, \
170 b); \
172 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
174 #define CREATE_QUAD_3_NEW(Type, a, b, c) \
175 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
176 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c); } \
177 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
179 #define CREATE_QUAD_3_ALL(Type, a, b, c) \
180 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
182 QUAD_DATA quad_all->SetAll(shared_state, \
183 quad_rect, \
184 quad_opaque_rect, \
185 quad_visible_rect, \
186 needs_blending, \
187 a, \
188 b, \
189 c); \
191 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
193 #define CREATE_QUAD_4_NEW(Type, a, b, c, d) \
194 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
195 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d); } \
196 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
198 #define CREATE_QUAD_4_ALL(Type, a, b, c, d) \
199 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
201 QUAD_DATA quad_all->SetAll(shared_state, \
202 quad_rect, \
203 quad_opaque_rect, \
204 quad_visible_rect, \
205 needs_blending, \
206 a, \
207 b, \
208 c, \
209 d); \
211 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
213 #define CREATE_QUAD_5_NEW(Type, a, b, c, d, e) \
214 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
215 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d, e); } \
216 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
218 #define CREATE_QUAD_5_ALL(Type, a, b, c, d, e) \
219 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
221 QUAD_DATA quad_all->SetAll(shared_state, \
222 quad_rect, \
223 quad_opaque_rect, \
224 quad_visible_rect, \
225 needs_blending, \
226 a, \
227 b, \
228 c, \
229 d, \
230 e); \
232 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
234 #define CREATE_QUAD_6_NEW(Type, a, b, c, d, e, f) \
235 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
236 { QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d, e, f); } \
237 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
239 #define CREATE_QUAD_6_ALL(Type, a, b, c, d, e, f) \
240 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
242 QUAD_DATA quad_all->SetAll(shared_state, \
243 quad_rect, \
244 quad_opaque_rect, \
245 quad_visible_rect, \
246 needs_blending, \
247 a, \
248 b, \
249 c, \
250 d, \
251 e, \
252 f); \
254 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
256 #define CREATE_QUAD_7_NEW(Type, a, b, c, d, e, f, g) \
257 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
259 QUAD_DATA quad_new->SetNew(shared_state, quad_rect, a, b, c, d, e, f, g); \
261 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
263 #define CREATE_QUAD_7_ALL(Type, a, b, c, d, e, f, g) \
264 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
266 QUAD_DATA quad_all->SetAll(shared_state, \
267 quad_rect, \
268 quad_opaque_rect, \
269 quad_visible_rect, \
270 needs_blending, \
271 a, \
272 b, \
273 c, \
274 d, \
275 e, \
276 f, \
277 g); \
279 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
281 #define CREATE_QUAD_8_NEW(Type, a, b, c, d, e, f, g, h) \
282 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
284 QUAD_DATA quad_new->SetNew( \
285 shared_state, quad_rect, a, b, c, d, e, f, g, h); \
287 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
289 #define CREATE_QUAD_8_ALL(Type, a, b, c, d, e, f, g, h) \
290 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
292 QUAD_DATA quad_all->SetAll(shared_state, \
293 quad_rect, \
294 quad_opaque_rect, \
295 quad_visible_rect, \
296 needs_blending, \
297 a, \
298 b, \
299 c, \
300 d, \
301 e, \
302 f, \
303 g, \
304 h); \
306 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
308 #define CREATE_QUAD_9_NEW(Type, a, b, c, d, e, f, g, h, i) \
309 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
311 QUAD_DATA quad_new->SetNew( \
312 shared_state, quad_rect, a, b, c, d, e, f, g, h, i); \
314 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
316 #define CREATE_QUAD_9_ALL(Type, a, b, c, d, e, f, g, h, i) \
318 QUAD_DATA quad_all->SetAll(shared_state, \
319 quad_rect, \
320 quad_opaque_rect, \
321 quad_visible_rect, \
322 needs_blending, \
323 a, \
324 b, \
325 c, \
326 d, \
327 e, \
328 f, \
329 g, \
330 h, \
331 i); \
333 SETUP_AND_COPY_QUAD_ALL(Type, quad_all);
335 #define CREATE_QUAD_10_NEW(Type, a, b, c, d, e, f, g, h, i, j) \
336 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
338 QUAD_DATA quad_new->SetNew( \
339 shared_state, quad_rect, a, b, c, d, e, f, g, h, i, j); \
341 SETUP_AND_COPY_QUAD_NEW(Type, quad_new);
343 #define CREATE_QUAD_ALL_RP(Type, a, b, c, d, e, f, g, copy_a) \
344 Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \
346 QUAD_DATA quad_all->SetAll(shared_state, \
347 quad_rect, \
348 quad_opaque_rect, \
349 quad_visible_rect, \
350 needs_blending, \
351 a, \
352 b, \
353 c, \
354 d, \
355 e, \
356 f, \
357 g); \
359 SETUP_AND_COPY_QUAD_ALL_RP(Type, quad_all, copy_a);
361 #define CREATE_QUAD_NEW_RP(Type, a, b, c, d, e, f, g, h, copy_a) \
362 Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \
364 QUAD_DATA quad_new->SetNew( \
365 shared_state, quad_rect, a, b, c, d, e, f, g, h); \
367 SETUP_AND_COPY_QUAD_NEW_RP(Type, quad_new, copy_a);
369 TEST(DrawQuadTest, CopyCheckerboardDrawQuad) {
370 gfx::Rect visible_rect(40, 50, 30, 20);
371 SkColor color = 0xfabb0011;
372 CREATE_SHARED_STATE();
374 CREATE_QUAD_2_NEW(CheckerboardDrawQuad, visible_rect, color);
375 EXPECT_EQ(DrawQuad::CHECKERBOARD, copy_quad->material);
376 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
377 EXPECT_EQ(color, copy_quad->color);
379 CREATE_QUAD_1_ALL(CheckerboardDrawQuad, color);
380 EXPECT_EQ(DrawQuad::CHECKERBOARD, copy_quad->material);
381 EXPECT_EQ(color, copy_quad->color);
384 TEST(DrawQuadTest, CopyDebugBorderDrawQuad) {
385 gfx::Rect visible_rect(40, 50, 30, 20);
386 SkColor color = 0xfabb0011;
387 int width = 99;
388 CREATE_SHARED_STATE();
390 CREATE_QUAD_3_NEW(DebugBorderDrawQuad, visible_rect, color, width);
391 EXPECT_EQ(DrawQuad::DEBUG_BORDER, copy_quad->material);
392 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
393 EXPECT_EQ(color, copy_quad->color);
394 EXPECT_EQ(width, copy_quad->width);
396 CREATE_QUAD_2_ALL(DebugBorderDrawQuad, color, width);
397 EXPECT_EQ(DrawQuad::DEBUG_BORDER, copy_quad->material);
398 EXPECT_EQ(color, copy_quad->color);
399 EXPECT_EQ(width, copy_quad->width);
402 TEST(DrawQuadTest, CopyIOSurfaceDrawQuad) {
403 gfx::Rect opaque_rect(33, 47, 10, 12);
404 gfx::Rect visible_rect(40, 50, 30, 20);
405 gfx::Size size(58, 95);
406 ResourceProvider::ResourceId resource_id = 72;
407 IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED;
408 CREATE_SHARED_STATE();
410 CREATE_QUAD_5_NEW(IOSurfaceDrawQuad,
411 opaque_rect,
412 visible_rect,
413 size,
414 resource_id,
415 orientation);
416 EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material);
417 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
418 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
419 EXPECT_EQ(size, copy_quad->io_surface_size);
420 EXPECT_EQ(resource_id, copy_quad->io_surface_resource_id);
421 EXPECT_EQ(orientation, copy_quad->orientation);
423 CREATE_QUAD_3_ALL(IOSurfaceDrawQuad, size, resource_id, orientation);
424 EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material);
425 EXPECT_EQ(size, copy_quad->io_surface_size);
426 EXPECT_EQ(resource_id, copy_quad->io_surface_resource_id);
427 EXPECT_EQ(orientation, copy_quad->orientation);
430 TEST(DrawQuadTest, CopyRenderPassDrawQuad) {
431 gfx::Rect visible_rect(40, 50, 30, 20);
432 RenderPassId render_pass_id(22, 64);
433 ResourceProvider::ResourceId mask_resource_id = 78;
434 gfx::Vector2dF mask_uv_scale(33.f, 19.f);
435 gfx::Size mask_texture_size(128, 134);
436 FilterOperations filters;
437 filters.Append(FilterOperation::CreateBlurFilter(1.f));
438 gfx::Vector2dF filters_scale;
439 FilterOperations background_filters;
440 background_filters.Append(
441 FilterOperation::CreateGrayscaleFilter(1.f));
443 RenderPassId copied_render_pass_id(235, 11);
444 CREATE_SHARED_STATE();
446 CREATE_QUAD_NEW_RP(RenderPassDrawQuad,
447 visible_rect,
448 render_pass_id,
449 mask_resource_id,
450 mask_uv_scale,
451 mask_texture_size,
452 filters,
453 filters_scale,
454 background_filters,
455 copied_render_pass_id);
456 EXPECT_EQ(DrawQuad::RENDER_PASS, copy_quad->material);
457 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
458 EXPECT_EQ(copied_render_pass_id, copy_quad->render_pass_id);
459 EXPECT_EQ(mask_resource_id, copy_quad->mask_resource_id);
460 EXPECT_EQ(mask_uv_scale.ToString(), copy_quad->mask_uv_scale.ToString());
461 EXPECT_EQ(mask_texture_size.ToString(),
462 copy_quad->mask_texture_size.ToString());
463 EXPECT_EQ(filters, copy_quad->filters);
464 EXPECT_EQ(filters_scale, copy_quad->filters_scale);
465 EXPECT_EQ(background_filters, copy_quad->background_filters);
467 CREATE_QUAD_ALL_RP(RenderPassDrawQuad,
468 render_pass_id,
469 mask_resource_id,
470 mask_uv_scale,
471 mask_texture_size,
472 filters,
473 filters_scale,
474 background_filters,
475 copied_render_pass_id);
476 EXPECT_EQ(DrawQuad::RENDER_PASS, copy_quad->material);
477 EXPECT_EQ(copied_render_pass_id, copy_quad->render_pass_id);
478 EXPECT_EQ(mask_resource_id, copy_quad->mask_resource_id);
479 EXPECT_EQ(mask_uv_scale.ToString(), copy_quad->mask_uv_scale.ToString());
480 EXPECT_EQ(mask_texture_size.ToString(),
481 copy_quad->mask_texture_size.ToString());
482 EXPECT_EQ(filters, copy_quad->filters);
483 EXPECT_EQ(filters_scale, copy_quad->filters_scale);
484 EXPECT_EQ(background_filters, copy_quad->background_filters);
487 TEST(DrawQuadTest, CopySolidColorDrawQuad) {
488 gfx::Rect visible_rect(40, 50, 30, 20);
489 SkColor color = 0x49494949;
490 bool force_anti_aliasing_off = false;
491 CREATE_SHARED_STATE();
493 CREATE_QUAD_3_NEW(
494 SolidColorDrawQuad, visible_rect, color, force_anti_aliasing_off);
495 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material);
496 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
497 EXPECT_EQ(color, copy_quad->color);
498 EXPECT_EQ(force_anti_aliasing_off, copy_quad->force_anti_aliasing_off);
500 CREATE_QUAD_2_ALL(SolidColorDrawQuad, color, force_anti_aliasing_off);
501 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material);
502 EXPECT_EQ(color, copy_quad->color);
503 EXPECT_EQ(force_anti_aliasing_off, copy_quad->force_anti_aliasing_off);
506 TEST(DrawQuadTest, CopyStreamVideoDrawQuad) {
507 gfx::Rect opaque_rect(33, 47, 10, 12);
508 gfx::Rect visible_rect(40, 50, 30, 20);
509 ResourceProvider::ResourceId resource_id = 64;
510 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1);
511 CREATE_SHARED_STATE();
513 CREATE_QUAD_4_NEW(
514 StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, matrix);
515 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material);
516 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
517 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
518 EXPECT_EQ(resource_id, copy_quad->resource_id);
519 EXPECT_EQ(matrix, copy_quad->matrix);
521 CREATE_QUAD_2_ALL(StreamVideoDrawQuad, resource_id, matrix);
522 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material);
523 EXPECT_EQ(resource_id, copy_quad->resource_id);
524 EXPECT_EQ(matrix, copy_quad->matrix);
527 TEST(DrawQuadTest, CopySurfaceDrawQuad) {
528 gfx::Rect visible_rect(40, 50, 30, 20);
529 SurfaceId surface_id(1234);
530 CREATE_SHARED_STATE();
532 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id);
533 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material);
534 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
535 EXPECT_EQ(surface_id, copy_quad->surface_id);
537 CREATE_QUAD_1_ALL(SurfaceDrawQuad, surface_id);
538 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material);
539 EXPECT_EQ(surface_id, copy_quad->surface_id);
543 TEST(DrawQuadTest, CopyTextureDrawQuad) {
544 gfx::Rect opaque_rect(33, 47, 10, 12);
545 gfx::Rect visible_rect(40, 50, 30, 20);
546 unsigned resource_id = 82;
547 bool premultiplied_alpha = true;
548 gfx::PointF uv_top_left(0.5f, 224.f);
549 gfx::PointF uv_bottom_right(51.5f, 260.f);
550 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f };
551 bool flipped = true;
552 bool nearest_neighbor = true;
553 CREATE_SHARED_STATE();
555 CREATE_QUAD_10_NEW(TextureDrawQuad,
556 opaque_rect,
557 visible_rect,
558 resource_id,
559 premultiplied_alpha,
560 uv_top_left,
561 uv_bottom_right,
562 SK_ColorTRANSPARENT,
563 vertex_opacity,
564 flipped,
565 nearest_neighbor);
566 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material);
567 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
568 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
569 EXPECT_EQ(resource_id, copy_quad->resource_id);
570 EXPECT_EQ(premultiplied_alpha, copy_quad->premultiplied_alpha);
571 EXPECT_EQ(uv_top_left, copy_quad->uv_top_left);
572 EXPECT_EQ(uv_bottom_right, copy_quad->uv_bottom_right);
573 EXPECT_FLOAT_ARRAY_EQ(vertex_opacity, copy_quad->vertex_opacity, 4);
574 EXPECT_EQ(flipped, copy_quad->flipped);
575 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
577 CREATE_QUAD_8_ALL(TextureDrawQuad,
578 resource_id,
579 premultiplied_alpha,
580 uv_top_left,
581 uv_bottom_right,
582 SK_ColorTRANSPARENT,
583 vertex_opacity,
584 flipped,
585 nearest_neighbor);
586 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material);
587 EXPECT_EQ(resource_id, copy_quad->resource_id);
588 EXPECT_EQ(premultiplied_alpha, copy_quad->premultiplied_alpha);
589 EXPECT_EQ(uv_top_left, copy_quad->uv_top_left);
590 EXPECT_EQ(uv_bottom_right, copy_quad->uv_bottom_right);
591 EXPECT_FLOAT_ARRAY_EQ(vertex_opacity, copy_quad->vertex_opacity, 4);
592 EXPECT_EQ(flipped, copy_quad->flipped);
593 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
596 TEST(DrawQuadTest, CopyTileDrawQuad) {
597 gfx::Rect opaque_rect(33, 44, 22, 33);
598 gfx::Rect visible_rect(40, 50, 30, 20);
599 unsigned resource_id = 104;
600 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
601 gfx::Size texture_size(85, 32);
602 bool swizzle_contents = true;
603 bool nearest_neighbor = true;
604 CREATE_SHARED_STATE();
606 CREATE_QUAD_7_NEW(TileDrawQuad,
607 opaque_rect,
608 visible_rect,
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(opaque_rect, copy_quad->opaque_rect);
616 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
617 EXPECT_EQ(resource_id, copy_quad->resource_id);
618 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
619 EXPECT_EQ(texture_size, copy_quad->texture_size);
620 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents);
621 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
623 CREATE_QUAD_5_ALL(TileDrawQuad,
624 resource_id,
625 tex_coord_rect,
626 texture_size,
627 swizzle_contents,
628 nearest_neighbor);
629 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material);
630 EXPECT_EQ(resource_id, copy_quad->resource_id);
631 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
632 EXPECT_EQ(texture_size, copy_quad->texture_size);
633 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents);
634 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
637 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) {
638 gfx::Rect opaque_rect(33, 47, 10, 12);
639 gfx::Rect visible_rect(40, 50, 30, 20);
640 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f);
641 ResourceProvider::ResourceId y_plane_resource_id = 45;
642 ResourceProvider::ResourceId u_plane_resource_id = 532;
643 ResourceProvider::ResourceId v_plane_resource_id = 4;
644 ResourceProvider::ResourceId a_plane_resource_id = 63;
645 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601_JPEG;
646 CREATE_SHARED_STATE();
648 CREATE_QUAD_8_NEW(YUVVideoDrawQuad,
649 opaque_rect,
650 visible_rect,
651 tex_coord_rect,
652 y_plane_resource_id,
653 u_plane_resource_id,
654 v_plane_resource_id,
655 a_plane_resource_id,
656 color_space);
657 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material);
658 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
659 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
660 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
661 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id);
662 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id);
663 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id);
664 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id);
665 EXPECT_EQ(color_space, copy_quad->color_space);
667 CREATE_QUAD_6_ALL(YUVVideoDrawQuad,
668 tex_coord_rect,
669 y_plane_resource_id,
670 u_plane_resource_id,
671 v_plane_resource_id,
672 a_plane_resource_id,
673 color_space);
674 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material);
675 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
676 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id);
677 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id);
678 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id);
679 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id);
680 EXPECT_EQ(color_space, copy_quad->color_space);
683 TEST(DrawQuadTest, CopyPictureDrawQuad) {
684 gfx::Rect opaque_rect(33, 44, 22, 33);
685 gfx::Rect visible_rect(40, 50, 30, 20);
686 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
687 gfx::Size texture_size(85, 32);
688 bool nearest_neighbor = true;
689 ResourceFormat texture_format = RGBA_8888;
690 gfx::Rect content_rect(30, 40, 20, 30);
691 float contents_scale = 3.141592f;
692 scoped_refptr<RasterSource> raster_source = PicturePileImpl::Create();
693 CREATE_SHARED_STATE();
695 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect,
696 texture_size, nearest_neighbor, texture_format,
697 content_rect, contents_scale, raster_source);
698 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material);
699 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
700 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
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);
709 CREATE_QUAD_7_ALL(PictureDrawQuad, tex_coord_rect, texture_size,
710 nearest_neighbor, texture_format, content_rect,
711 contents_scale, raster_source);
712 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material);
713 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
714 EXPECT_EQ(texture_size, copy_quad->texture_size);
715 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
716 EXPECT_EQ(texture_format, copy_quad->texture_format);
717 EXPECT_EQ(content_rect, copy_quad->content_rect);
718 EXPECT_EQ(contents_scale, copy_quad->contents_scale);
719 EXPECT_EQ(raster_source, copy_quad->raster_source);
722 class DrawQuadIteratorTest : public testing::Test {
723 protected:
724 ResourceProvider::ResourceId IncrementResourceId(
725 ResourceProvider::ResourceId id) {
726 ++num_resources_;
727 return id + 1;
730 int IterateAndCount(DrawQuad* quad) {
731 num_resources_ = 0;
732 quad->IterateResources(base::Bind(
733 &DrawQuadIteratorTest::IncrementResourceId, base::Unretained(this)));
734 return num_resources_;
737 private:
738 int num_resources_;
741 TEST_F(DrawQuadIteratorTest, CheckerboardDrawQuad) {
742 gfx::Rect visible_rect(40, 50, 30, 20);
743 SkColor color = 0xfabb0011;
745 CREATE_SHARED_STATE();
746 CREATE_QUAD_2_NEW(CheckerboardDrawQuad, visible_rect, color);
747 EXPECT_EQ(0, IterateAndCount(quad_new));
750 TEST_F(DrawQuadIteratorTest, DebugBorderDrawQuad) {
751 gfx::Rect visible_rect(40, 50, 30, 20);
752 SkColor color = 0xfabb0011;
753 int width = 99;
755 CREATE_SHARED_STATE();
756 CREATE_QUAD_3_NEW(DebugBorderDrawQuad, visible_rect, color, width);
757 EXPECT_EQ(0, IterateAndCount(quad_new));
760 TEST_F(DrawQuadIteratorTest, IOSurfaceDrawQuad) {
761 gfx::Rect opaque_rect(33, 47, 10, 12);
762 gfx::Rect visible_rect(40, 50, 30, 20);
763 gfx::Size size(58, 95);
764 ResourceProvider::ResourceId resource_id = 72;
765 IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED;
767 CREATE_SHARED_STATE();
768 CREATE_QUAD_5_NEW(IOSurfaceDrawQuad,
769 opaque_rect,
770 visible_rect,
771 size,
772 resource_id,
773 orientation);
774 EXPECT_EQ(resource_id, quad_new->io_surface_resource_id);
775 EXPECT_EQ(1, IterateAndCount(quad_new));
776 EXPECT_EQ(resource_id + 1, quad_new->io_surface_resource_id);
779 TEST_F(DrawQuadIteratorTest, RenderPassDrawQuad) {
780 gfx::Rect visible_rect(40, 50, 30, 20);
781 RenderPassId render_pass_id(22, 64);
782 ResourceProvider::ResourceId mask_resource_id = 78;
783 gfx::Vector2dF mask_uv_scale(33.f, 19.f);
784 gfx::Size mask_texture_size(128, 134);
785 FilterOperations filters;
786 filters.Append(FilterOperation::CreateBlurFilter(1.f));
787 gfx::Vector2dF filters_scale(2.f, 3.f);
788 FilterOperations background_filters;
789 background_filters.Append(
790 FilterOperation::CreateGrayscaleFilter(1.f));
792 RenderPassId copied_render_pass_id(235, 11);
794 CREATE_SHARED_STATE();
795 CREATE_QUAD_NEW_RP(RenderPassDrawQuad,
796 visible_rect,
797 render_pass_id,
798 mask_resource_id,
799 mask_uv_scale,
800 mask_texture_size,
801 filters,
802 filters_scale,
803 background_filters,
804 copied_render_pass_id);
805 EXPECT_EQ(mask_resource_id, quad_new->mask_resource_id);
806 EXPECT_EQ(1, IterateAndCount(quad_new));
807 EXPECT_EQ(mask_resource_id + 1, quad_new->mask_resource_id);
808 quad_new->mask_resource_id = 0;
809 EXPECT_EQ(0, IterateAndCount(quad_new));
810 EXPECT_EQ(0u, quad_new->mask_resource_id);
813 TEST_F(DrawQuadIteratorTest, SolidColorDrawQuad) {
814 gfx::Rect visible_rect(40, 50, 30, 20);
815 SkColor color = 0x49494949;
816 bool force_anti_aliasing_off = false;
818 CREATE_SHARED_STATE();
819 CREATE_QUAD_3_NEW(
820 SolidColorDrawQuad, visible_rect, color, force_anti_aliasing_off);
821 EXPECT_EQ(0, IterateAndCount(quad_new));
824 TEST_F(DrawQuadIteratorTest, StreamVideoDrawQuad) {
825 gfx::Rect opaque_rect(33, 47, 10, 12);
826 gfx::Rect visible_rect(40, 50, 30, 20);
827 ResourceProvider::ResourceId resource_id = 64;
828 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1);
830 CREATE_SHARED_STATE();
831 CREATE_QUAD_4_NEW(
832 StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, matrix);
833 EXPECT_EQ(resource_id, quad_new->resource_id);
834 EXPECT_EQ(1, IterateAndCount(quad_new));
835 EXPECT_EQ(resource_id + 1, quad_new->resource_id);
838 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) {
839 gfx::Rect visible_rect(40, 50, 30, 20);
840 SurfaceId surface_id(4321);
842 CREATE_SHARED_STATE();
843 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id);
844 EXPECT_EQ(0, IterateAndCount(quad_new));
847 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) {
848 gfx::Rect opaque_rect(33, 47, 10, 12);
849 gfx::Rect visible_rect(40, 50, 30, 20);
850 unsigned resource_id = 82;
851 bool premultiplied_alpha = true;
852 gfx::PointF uv_top_left(0.5f, 224.f);
853 gfx::PointF uv_bottom_right(51.5f, 260.f);
854 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f };
855 bool flipped = true;
856 bool nearest_neighbor = true;
858 CREATE_SHARED_STATE();
859 CREATE_QUAD_10_NEW(TextureDrawQuad,
860 opaque_rect,
861 visible_rect,
862 resource_id,
863 premultiplied_alpha,
864 uv_top_left,
865 uv_bottom_right,
866 SK_ColorTRANSPARENT,
867 vertex_opacity,
868 flipped,
869 nearest_neighbor);
870 EXPECT_EQ(resource_id, quad_new->resource_id);
871 EXPECT_EQ(1, IterateAndCount(quad_new));
872 EXPECT_EQ(resource_id + 1, quad_new->resource_id);
875 TEST_F(DrawQuadIteratorTest, TileDrawQuad) {
876 gfx::Rect opaque_rect(33, 44, 22, 33);
877 gfx::Rect visible_rect(40, 50, 30, 20);
878 unsigned resource_id = 104;
879 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
880 gfx::Size texture_size(85, 32);
881 bool swizzle_contents = true;
882 bool nearest_neighbor = true;
884 CREATE_SHARED_STATE();
885 CREATE_QUAD_7_NEW(TileDrawQuad,
886 opaque_rect,
887 visible_rect,
888 resource_id,
889 tex_coord_rect,
890 texture_size,
891 swizzle_contents,
892 nearest_neighbor);
893 EXPECT_EQ(resource_id, quad_new->resource_id);
894 EXPECT_EQ(1, IterateAndCount(quad_new));
895 EXPECT_EQ(resource_id + 1, quad_new->resource_id);
898 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) {
899 gfx::Rect opaque_rect(33, 47, 10, 12);
900 gfx::Rect visible_rect(40, 50, 30, 20);
901 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f);
902 ResourceProvider::ResourceId y_plane_resource_id = 45;
903 ResourceProvider::ResourceId u_plane_resource_id = 532;
904 ResourceProvider::ResourceId v_plane_resource_id = 4;
905 ResourceProvider::ResourceId a_plane_resource_id = 63;
906 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::REC_601_JPEG;
908 CREATE_SHARED_STATE();
909 CREATE_QUAD_8_NEW(YUVVideoDrawQuad,
910 opaque_rect,
911 visible_rect,
912 tex_coord_rect,
913 y_plane_resource_id,
914 u_plane_resource_id,
915 v_plane_resource_id,
916 a_plane_resource_id,
917 color_space);
918 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material);
919 EXPECT_EQ(y_plane_resource_id, quad_new->y_plane_resource_id);
920 EXPECT_EQ(u_plane_resource_id, quad_new->u_plane_resource_id);
921 EXPECT_EQ(v_plane_resource_id, quad_new->v_plane_resource_id);
922 EXPECT_EQ(a_plane_resource_id, quad_new->a_plane_resource_id);
923 EXPECT_EQ(color_space, quad_new->color_space);
924 EXPECT_EQ(4, IterateAndCount(quad_new));
925 EXPECT_EQ(y_plane_resource_id + 1, quad_new->y_plane_resource_id);
926 EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id);
927 EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id);
928 EXPECT_EQ(a_plane_resource_id + 1, quad_new->a_plane_resource_id);
931 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715
932 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) {
933 gfx::Rect opaque_rect(33, 44, 22, 33);
934 gfx::Rect visible_rect(40, 50, 30, 20);
935 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
936 gfx::Size texture_size(85, 32);
937 bool nearest_neighbor = true;
938 ResourceFormat texture_format = RGBA_8888;
939 gfx::Rect content_rect(30, 40, 20, 30);
940 float contents_scale = 3.141592f;
941 scoped_refptr<PicturePileImpl> raster_source = PicturePileImpl::Create();
943 CREATE_SHARED_STATE();
944 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect,
945 texture_size, nearest_neighbor, texture_format,
946 content_rect, contents_scale, raster_source);
947 EXPECT_EQ(0, IterateAndCount(quad_new));
950 TEST(DrawQuadTest, LargestQuadType) {
951 size_t largest = 0;
953 for (int i = 0; i <= DrawQuad::MATERIAL_LAST; ++i) {
954 switch (static_cast<DrawQuad::Material>(i)) {
955 case DrawQuad::CHECKERBOARD:
956 largest = std::max(largest, sizeof(CheckerboardDrawQuad));
957 break;
958 case DrawQuad::DEBUG_BORDER:
959 largest = std::max(largest, sizeof(DebugBorderDrawQuad));
960 break;
961 case DrawQuad::IO_SURFACE_CONTENT:
962 largest = std::max(largest, sizeof(IOSurfaceDrawQuad));
963 break;
964 case DrawQuad::PICTURE_CONTENT:
965 largest = std::max(largest, sizeof(PictureDrawQuad));
966 break;
967 case DrawQuad::TEXTURE_CONTENT:
968 largest = std::max(largest, sizeof(TextureDrawQuad));
969 break;
970 case DrawQuad::RENDER_PASS:
971 largest = std::max(largest, sizeof(RenderPassDrawQuad));
972 break;
973 case DrawQuad::SOLID_COLOR:
974 largest = std::max(largest, sizeof(SolidColorDrawQuad));
975 break;
976 case DrawQuad::SURFACE_CONTENT:
977 largest = std::max(largest, sizeof(SurfaceDrawQuad));
978 break;
979 case DrawQuad::TILED_CONTENT:
980 largest = std::max(largest, sizeof(TileDrawQuad));
981 break;
982 case DrawQuad::STREAM_VIDEO_CONTENT:
983 largest = std::max(largest, sizeof(StreamVideoDrawQuad));
984 break;
985 case DrawQuad::YUV_VIDEO_CONTENT:
986 largest = std::max(largest, sizeof(YUVVideoDrawQuad));
987 break;
988 case DrawQuad::INVALID:
989 break;
992 EXPECT_EQ(LargestDrawQuadSize(), largest);
994 if (!HasFailure())
995 return;
997 // On failure, output the size of all quads for debugging.
998 LOG(ERROR) << "largest " << largest;
999 LOG(ERROR) << "kLargestDrawQuad " << LargestDrawQuadSize();
1000 for (int i = 0; i <= DrawQuad::MATERIAL_LAST; ++i) {
1001 switch (static_cast<DrawQuad::Material>(i)) {
1002 case DrawQuad::CHECKERBOARD:
1003 LOG(ERROR) << "CheckerboardDrawQuad " << sizeof(CheckerboardDrawQuad);
1004 break;
1005 case DrawQuad::DEBUG_BORDER:
1006 LOG(ERROR) << "DebugBorderDrawQuad " << sizeof(DebugBorderDrawQuad);
1007 break;
1008 case DrawQuad::IO_SURFACE_CONTENT:
1009 LOG(ERROR) << "IOSurfaceDrawQuad " << sizeof(IOSurfaceDrawQuad);
1010 break;
1011 case DrawQuad::PICTURE_CONTENT:
1012 LOG(ERROR) << "PictureDrawQuad " << sizeof(PictureDrawQuad);
1013 break;
1014 case DrawQuad::TEXTURE_CONTENT:
1015 LOG(ERROR) << "TextureDrawQuad " << sizeof(TextureDrawQuad);
1016 break;
1017 case DrawQuad::RENDER_PASS:
1018 LOG(ERROR) << "RenderPassDrawQuad " << sizeof(RenderPassDrawQuad);
1019 break;
1020 case DrawQuad::SOLID_COLOR:
1021 LOG(ERROR) << "SolidColorDrawQuad " << sizeof(SolidColorDrawQuad);
1022 break;
1023 case DrawQuad::SURFACE_CONTENT:
1024 LOG(ERROR) << "SurfaceDrawQuad " << sizeof(SurfaceDrawQuad);
1025 break;
1026 case DrawQuad::TILED_CONTENT:
1027 LOG(ERROR) << "TileDrawQuad " << sizeof(TileDrawQuad);
1028 break;
1029 case DrawQuad::STREAM_VIDEO_CONTENT:
1030 LOG(ERROR) << "StreamVideoDrawQuad " << sizeof(StreamVideoDrawQuad);
1031 break;
1032 case DrawQuad::YUV_VIDEO_CONTENT:
1033 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad);
1034 break;
1035 case DrawQuad::INVALID:
1036 break;
1041 } // namespace
1042 } // namespace cc