CacheStorage: Remove unused return value from put operation
[chromium-blink-merge.git] / cc / quads / draw_quad_unittest.cc
blobd55bfa52ac2d21b0c00b1dfcc89730b824fbd224
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/test/fake_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 float scale = 2.3f;
373 CREATE_SHARED_STATE();
375 CREATE_QUAD_3_NEW(CheckerboardDrawQuad, visible_rect, color, scale);
376 EXPECT_EQ(DrawQuad::CHECKERBOARD, copy_quad->material);
377 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
378 EXPECT_EQ(color, copy_quad->color);
379 EXPECT_EQ(scale, copy_quad->scale);
381 CREATE_QUAD_2_ALL(CheckerboardDrawQuad, color, scale);
382 EXPECT_EQ(DrawQuad::CHECKERBOARD, copy_quad->material);
383 EXPECT_EQ(color, copy_quad->color);
384 EXPECT_EQ(scale, copy_quad->scale);
387 TEST(DrawQuadTest, CopyDebugBorderDrawQuad) {
388 gfx::Rect visible_rect(40, 50, 30, 20);
389 SkColor color = 0xfabb0011;
390 int width = 99;
391 CREATE_SHARED_STATE();
393 CREATE_QUAD_3_NEW(DebugBorderDrawQuad, visible_rect, color, width);
394 EXPECT_EQ(DrawQuad::DEBUG_BORDER, copy_quad->material);
395 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
396 EXPECT_EQ(color, copy_quad->color);
397 EXPECT_EQ(width, copy_quad->width);
399 CREATE_QUAD_2_ALL(DebugBorderDrawQuad, color, width);
400 EXPECT_EQ(DrawQuad::DEBUG_BORDER, copy_quad->material);
401 EXPECT_EQ(color, copy_quad->color);
402 EXPECT_EQ(width, copy_quad->width);
405 TEST(DrawQuadTest, CopyIOSurfaceDrawQuad) {
406 gfx::Rect opaque_rect(33, 47, 10, 12);
407 gfx::Rect visible_rect(40, 50, 30, 20);
408 gfx::Size size(58, 95);
409 ResourceProvider::ResourceId resource_id = 72;
410 IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED;
411 CREATE_SHARED_STATE();
413 CREATE_QUAD_5_NEW(IOSurfaceDrawQuad,
414 opaque_rect,
415 visible_rect,
416 size,
417 resource_id,
418 orientation);
419 EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material);
420 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
421 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
422 EXPECT_EQ(size, copy_quad->io_surface_size);
423 EXPECT_EQ(resource_id, copy_quad->io_surface_resource_id);
424 EXPECT_EQ(orientation, copy_quad->orientation);
426 CREATE_QUAD_3_ALL(IOSurfaceDrawQuad, size, resource_id, orientation);
427 EXPECT_EQ(DrawQuad::IO_SURFACE_CONTENT, copy_quad->material);
428 EXPECT_EQ(size, copy_quad->io_surface_size);
429 EXPECT_EQ(resource_id, copy_quad->io_surface_resource_id);
430 EXPECT_EQ(orientation, copy_quad->orientation);
433 TEST(DrawQuadTest, CopyRenderPassDrawQuad) {
434 gfx::Rect visible_rect(40, 50, 30, 20);
435 RenderPassId render_pass_id(22, 64);
436 ResourceProvider::ResourceId mask_resource_id = 78;
437 gfx::Vector2dF mask_uv_scale(33.f, 19.f);
438 gfx::Size mask_texture_size(128, 134);
439 FilterOperations filters;
440 filters.Append(FilterOperation::CreateBlurFilter(1.f));
441 gfx::Vector2dF filters_scale;
442 FilterOperations background_filters;
443 background_filters.Append(
444 FilterOperation::CreateGrayscaleFilter(1.f));
446 RenderPassId copied_render_pass_id(235, 11);
447 CREATE_SHARED_STATE();
449 CREATE_QUAD_NEW_RP(RenderPassDrawQuad,
450 visible_rect,
451 render_pass_id,
452 mask_resource_id,
453 mask_uv_scale,
454 mask_texture_size,
455 filters,
456 filters_scale,
457 background_filters,
458 copied_render_pass_id);
459 EXPECT_EQ(DrawQuad::RENDER_PASS, copy_quad->material);
460 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
461 EXPECT_EQ(copied_render_pass_id, copy_quad->render_pass_id);
462 EXPECT_EQ(mask_resource_id, copy_quad->mask_resource_id);
463 EXPECT_EQ(mask_uv_scale.ToString(), copy_quad->mask_uv_scale.ToString());
464 EXPECT_EQ(mask_texture_size.ToString(),
465 copy_quad->mask_texture_size.ToString());
466 EXPECT_EQ(filters, copy_quad->filters);
467 EXPECT_EQ(filters_scale, copy_quad->filters_scale);
468 EXPECT_EQ(background_filters, copy_quad->background_filters);
470 CREATE_QUAD_ALL_RP(RenderPassDrawQuad,
471 render_pass_id,
472 mask_resource_id,
473 mask_uv_scale,
474 mask_texture_size,
475 filters,
476 filters_scale,
477 background_filters,
478 copied_render_pass_id);
479 EXPECT_EQ(DrawQuad::RENDER_PASS, copy_quad->material);
480 EXPECT_EQ(copied_render_pass_id, copy_quad->render_pass_id);
481 EXPECT_EQ(mask_resource_id, copy_quad->mask_resource_id);
482 EXPECT_EQ(mask_uv_scale.ToString(), copy_quad->mask_uv_scale.ToString());
483 EXPECT_EQ(mask_texture_size.ToString(),
484 copy_quad->mask_texture_size.ToString());
485 EXPECT_EQ(filters, copy_quad->filters);
486 EXPECT_EQ(filters_scale, copy_quad->filters_scale);
487 EXPECT_EQ(background_filters, copy_quad->background_filters);
490 TEST(DrawQuadTest, CopySolidColorDrawQuad) {
491 gfx::Rect visible_rect(40, 50, 30, 20);
492 SkColor color = 0x49494949;
493 bool force_anti_aliasing_off = false;
494 CREATE_SHARED_STATE();
496 CREATE_QUAD_3_NEW(
497 SolidColorDrawQuad, visible_rect, color, force_anti_aliasing_off);
498 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material);
499 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
500 EXPECT_EQ(color, copy_quad->color);
501 EXPECT_EQ(force_anti_aliasing_off, copy_quad->force_anti_aliasing_off);
503 CREATE_QUAD_2_ALL(SolidColorDrawQuad, color, force_anti_aliasing_off);
504 EXPECT_EQ(DrawQuad::SOLID_COLOR, copy_quad->material);
505 EXPECT_EQ(color, copy_quad->color);
506 EXPECT_EQ(force_anti_aliasing_off, copy_quad->force_anti_aliasing_off);
509 TEST(DrawQuadTest, CopyStreamVideoDrawQuad) {
510 gfx::Rect opaque_rect(33, 47, 10, 12);
511 gfx::Rect visible_rect(40, 50, 30, 20);
512 ResourceProvider::ResourceId resource_id = 64;
513 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1);
514 CREATE_SHARED_STATE();
516 CREATE_QUAD_4_NEW(
517 StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, matrix);
518 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material);
519 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
520 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
521 EXPECT_EQ(resource_id, copy_quad->resource_id);
522 EXPECT_EQ(matrix, copy_quad->matrix);
524 CREATE_QUAD_2_ALL(StreamVideoDrawQuad, resource_id, matrix);
525 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copy_quad->material);
526 EXPECT_EQ(resource_id, copy_quad->resource_id);
527 EXPECT_EQ(matrix, copy_quad->matrix);
530 TEST(DrawQuadTest, CopySurfaceDrawQuad) {
531 gfx::Rect visible_rect(40, 50, 30, 20);
532 SurfaceId surface_id(1234);
533 CREATE_SHARED_STATE();
535 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id);
536 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material);
537 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
538 EXPECT_EQ(surface_id, copy_quad->surface_id);
540 CREATE_QUAD_1_ALL(SurfaceDrawQuad, surface_id);
541 EXPECT_EQ(DrawQuad::SURFACE_CONTENT, copy_quad->material);
542 EXPECT_EQ(surface_id, copy_quad->surface_id);
546 TEST(DrawQuadTest, CopyTextureDrawQuad) {
547 gfx::Rect opaque_rect(33, 47, 10, 12);
548 gfx::Rect visible_rect(40, 50, 30, 20);
549 unsigned resource_id = 82;
550 bool premultiplied_alpha = true;
551 gfx::PointF uv_top_left(0.5f, 224.f);
552 gfx::PointF uv_bottom_right(51.5f, 260.f);
553 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f };
554 bool flipped = true;
555 bool nearest_neighbor = true;
556 CREATE_SHARED_STATE();
558 CREATE_QUAD_10_NEW(TextureDrawQuad,
559 opaque_rect,
560 visible_rect,
561 resource_id,
562 premultiplied_alpha,
563 uv_top_left,
564 uv_bottom_right,
565 SK_ColorTRANSPARENT,
566 vertex_opacity,
567 flipped,
568 nearest_neighbor);
569 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material);
570 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
571 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
572 EXPECT_EQ(resource_id, copy_quad->resource_id);
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(flipped, copy_quad->flipped);
578 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
580 CREATE_QUAD_8_ALL(TextureDrawQuad,
581 resource_id,
582 premultiplied_alpha,
583 uv_top_left,
584 uv_bottom_right,
585 SK_ColorTRANSPARENT,
586 vertex_opacity,
587 flipped,
588 nearest_neighbor);
589 EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material);
590 EXPECT_EQ(resource_id, copy_quad->resource_id);
591 EXPECT_EQ(premultiplied_alpha, copy_quad->premultiplied_alpha);
592 EXPECT_EQ(uv_top_left, copy_quad->uv_top_left);
593 EXPECT_EQ(uv_bottom_right, copy_quad->uv_bottom_right);
594 EXPECT_FLOAT_ARRAY_EQ(vertex_opacity, copy_quad->vertex_opacity, 4);
595 EXPECT_EQ(flipped, copy_quad->flipped);
596 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
599 TEST(DrawQuadTest, CopyTileDrawQuad) {
600 gfx::Rect opaque_rect(33, 44, 22, 33);
601 gfx::Rect visible_rect(40, 50, 30, 20);
602 unsigned resource_id = 104;
603 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
604 gfx::Size texture_size(85, 32);
605 bool swizzle_contents = true;
606 bool nearest_neighbor = true;
607 CREATE_SHARED_STATE();
609 CREATE_QUAD_7_NEW(TileDrawQuad,
610 opaque_rect,
611 visible_rect,
612 resource_id,
613 tex_coord_rect,
614 texture_size,
615 swizzle_contents,
616 nearest_neighbor);
617 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material);
618 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
619 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
620 EXPECT_EQ(resource_id, copy_quad->resource_id);
621 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
622 EXPECT_EQ(texture_size, copy_quad->texture_size);
623 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents);
624 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
626 CREATE_QUAD_5_ALL(TileDrawQuad,
627 resource_id,
628 tex_coord_rect,
629 texture_size,
630 swizzle_contents,
631 nearest_neighbor);
632 EXPECT_EQ(DrawQuad::TILED_CONTENT, copy_quad->material);
633 EXPECT_EQ(resource_id, copy_quad->resource_id);
634 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
635 EXPECT_EQ(texture_size, copy_quad->texture_size);
636 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents);
637 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
640 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) {
641 gfx::Rect opaque_rect(33, 47, 10, 12);
642 gfx::Rect visible_rect(40, 50, 30, 20);
643 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f);
644 gfx::Size ya_tex_size(32, 68);
645 gfx::Size uv_tex_size(41, 51);
646 ResourceProvider::ResourceId y_plane_resource_id = 45;
647 ResourceProvider::ResourceId u_plane_resource_id = 532;
648 ResourceProvider::ResourceId v_plane_resource_id = 4;
649 ResourceProvider::ResourceId a_plane_resource_id = 63;
650 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::JPEG;
651 CREATE_SHARED_STATE();
653 CREATE_QUAD_10_NEW(YUVVideoDrawQuad, opaque_rect, visible_rect,
654 tex_coord_rect, ya_tex_size, uv_tex_size,
655 y_plane_resource_id, u_plane_resource_id,
656 v_plane_resource_id, a_plane_resource_id, 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(ya_tex_size, copy_quad->ya_tex_size);
662 EXPECT_EQ(uv_tex_size, copy_quad->uv_tex_size);
663 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id);
664 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id);
665 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id);
666 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id);
667 EXPECT_EQ(color_space, copy_quad->color_space);
669 CREATE_QUAD_8_ALL(YUVVideoDrawQuad, tex_coord_rect, ya_tex_size, uv_tex_size,
670 y_plane_resource_id, u_plane_resource_id,
671 v_plane_resource_id, a_plane_resource_id, color_space);
672 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material);
673 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
674 EXPECT_EQ(ya_tex_size, copy_quad->ya_tex_size);
675 EXPECT_EQ(uv_tex_size, copy_quad->uv_tex_size);
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 =
693 FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100),
694 gfx::Size(100, 100));
695 CREATE_SHARED_STATE();
697 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect,
698 texture_size, nearest_neighbor, texture_format,
699 content_rect, contents_scale, raster_source);
700 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material);
701 EXPECT_EQ(opaque_rect, copy_quad->opaque_rect);
702 EXPECT_EQ(visible_rect, copy_quad->visible_rect);
703 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
704 EXPECT_EQ(texture_size, copy_quad->texture_size);
705 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
706 EXPECT_EQ(texture_format, copy_quad->texture_format);
707 EXPECT_EQ(content_rect, copy_quad->content_rect);
708 EXPECT_EQ(contents_scale, copy_quad->contents_scale);
709 EXPECT_EQ(raster_source, copy_quad->raster_source);
711 CREATE_QUAD_7_ALL(PictureDrawQuad, tex_coord_rect, texture_size,
712 nearest_neighbor, texture_format, content_rect,
713 contents_scale, raster_source);
714 EXPECT_EQ(DrawQuad::PICTURE_CONTENT, copy_quad->material);
715 EXPECT_EQ(tex_coord_rect, copy_quad->tex_coord_rect);
716 EXPECT_EQ(texture_size, copy_quad->texture_size);
717 EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor);
718 EXPECT_EQ(texture_format, copy_quad->texture_format);
719 EXPECT_EQ(content_rect, copy_quad->content_rect);
720 EXPECT_EQ(contents_scale, copy_quad->contents_scale);
721 EXPECT_EQ(raster_source, copy_quad->raster_source);
724 class DrawQuadIteratorTest : public testing::Test {
725 protected:
726 ResourceProvider::ResourceId IncrementResourceId(
727 ResourceProvider::ResourceId id) {
728 ++num_resources_;
729 return id + 1;
732 int IterateAndCount(DrawQuad* quad) {
733 num_resources_ = 0;
734 quad->IterateResources(base::Bind(
735 &DrawQuadIteratorTest::IncrementResourceId, base::Unretained(this)));
736 return num_resources_;
739 private:
740 int num_resources_;
743 TEST_F(DrawQuadIteratorTest, CheckerboardDrawQuad) {
744 gfx::Rect visible_rect(40, 50, 30, 20);
745 SkColor color = 0xfabb0011;
746 float scale = 3.2f;
748 CREATE_SHARED_STATE();
749 CREATE_QUAD_3_NEW(CheckerboardDrawQuad, visible_rect, color, scale);
750 EXPECT_EQ(0, IterateAndCount(quad_new));
753 TEST_F(DrawQuadIteratorTest, DebugBorderDrawQuad) {
754 gfx::Rect visible_rect(40, 50, 30, 20);
755 SkColor color = 0xfabb0011;
756 int width = 99;
758 CREATE_SHARED_STATE();
759 CREATE_QUAD_3_NEW(DebugBorderDrawQuad, visible_rect, color, width);
760 EXPECT_EQ(0, IterateAndCount(quad_new));
763 TEST_F(DrawQuadIteratorTest, IOSurfaceDrawQuad) {
764 gfx::Rect opaque_rect(33, 47, 10, 12);
765 gfx::Rect visible_rect(40, 50, 30, 20);
766 gfx::Size size(58, 95);
767 ResourceProvider::ResourceId resource_id = 72;
768 IOSurfaceDrawQuad::Orientation orientation = IOSurfaceDrawQuad::UNFLIPPED;
770 CREATE_SHARED_STATE();
771 CREATE_QUAD_5_NEW(IOSurfaceDrawQuad,
772 opaque_rect,
773 visible_rect,
774 size,
775 resource_id,
776 orientation);
777 EXPECT_EQ(resource_id, quad_new->io_surface_resource_id);
778 EXPECT_EQ(1, IterateAndCount(quad_new));
779 EXPECT_EQ(resource_id + 1, quad_new->io_surface_resource_id);
782 TEST_F(DrawQuadIteratorTest, RenderPassDrawQuad) {
783 gfx::Rect visible_rect(40, 50, 30, 20);
784 RenderPassId render_pass_id(22, 64);
785 ResourceProvider::ResourceId mask_resource_id = 78;
786 gfx::Vector2dF mask_uv_scale(33.f, 19.f);
787 gfx::Size mask_texture_size(128, 134);
788 FilterOperations filters;
789 filters.Append(FilterOperation::CreateBlurFilter(1.f));
790 gfx::Vector2dF filters_scale(2.f, 3.f);
791 FilterOperations background_filters;
792 background_filters.Append(
793 FilterOperation::CreateGrayscaleFilter(1.f));
795 RenderPassId copied_render_pass_id(235, 11);
797 CREATE_SHARED_STATE();
798 CREATE_QUAD_NEW_RP(RenderPassDrawQuad,
799 visible_rect,
800 render_pass_id,
801 mask_resource_id,
802 mask_uv_scale,
803 mask_texture_size,
804 filters,
805 filters_scale,
806 background_filters,
807 copied_render_pass_id);
808 EXPECT_EQ(mask_resource_id, quad_new->mask_resource_id);
809 EXPECT_EQ(1, IterateAndCount(quad_new));
810 EXPECT_EQ(mask_resource_id + 1, quad_new->mask_resource_id);
811 quad_new->mask_resource_id = 0;
812 EXPECT_EQ(0, IterateAndCount(quad_new));
813 EXPECT_EQ(0u, quad_new->mask_resource_id);
816 TEST_F(DrawQuadIteratorTest, SolidColorDrawQuad) {
817 gfx::Rect visible_rect(40, 50, 30, 20);
818 SkColor color = 0x49494949;
819 bool force_anti_aliasing_off = false;
821 CREATE_SHARED_STATE();
822 CREATE_QUAD_3_NEW(
823 SolidColorDrawQuad, visible_rect, color, force_anti_aliasing_off);
824 EXPECT_EQ(0, IterateAndCount(quad_new));
827 TEST_F(DrawQuadIteratorTest, StreamVideoDrawQuad) {
828 gfx::Rect opaque_rect(33, 47, 10, 12);
829 gfx::Rect visible_rect(40, 50, 30, 20);
830 ResourceProvider::ResourceId resource_id = 64;
831 gfx::Transform matrix = gfx::Transform(0.5, 0.25, 1, 0.75, 0, 1);
833 CREATE_SHARED_STATE();
834 CREATE_QUAD_4_NEW(
835 StreamVideoDrawQuad, opaque_rect, visible_rect, resource_id, matrix);
836 EXPECT_EQ(resource_id, quad_new->resource_id);
837 EXPECT_EQ(1, IterateAndCount(quad_new));
838 EXPECT_EQ(resource_id + 1, quad_new->resource_id);
841 TEST_F(DrawQuadIteratorTest, SurfaceDrawQuad) {
842 gfx::Rect visible_rect(40, 50, 30, 20);
843 SurfaceId surface_id(4321);
845 CREATE_SHARED_STATE();
846 CREATE_QUAD_2_NEW(SurfaceDrawQuad, visible_rect, surface_id);
847 EXPECT_EQ(0, IterateAndCount(quad_new));
850 TEST_F(DrawQuadIteratorTest, TextureDrawQuad) {
851 gfx::Rect opaque_rect(33, 47, 10, 12);
852 gfx::Rect visible_rect(40, 50, 30, 20);
853 unsigned resource_id = 82;
854 bool premultiplied_alpha = true;
855 gfx::PointF uv_top_left(0.5f, 224.f);
856 gfx::PointF uv_bottom_right(51.5f, 260.f);
857 const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f };
858 bool flipped = true;
859 bool nearest_neighbor = true;
861 CREATE_SHARED_STATE();
862 CREATE_QUAD_10_NEW(TextureDrawQuad,
863 opaque_rect,
864 visible_rect,
865 resource_id,
866 premultiplied_alpha,
867 uv_top_left,
868 uv_bottom_right,
869 SK_ColorTRANSPARENT,
870 vertex_opacity,
871 flipped,
872 nearest_neighbor);
873 EXPECT_EQ(resource_id, quad_new->resource_id);
874 EXPECT_EQ(1, IterateAndCount(quad_new));
875 EXPECT_EQ(resource_id + 1, quad_new->resource_id);
878 TEST_F(DrawQuadIteratorTest, TileDrawQuad) {
879 gfx::Rect opaque_rect(33, 44, 22, 33);
880 gfx::Rect visible_rect(40, 50, 30, 20);
881 unsigned resource_id = 104;
882 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f);
883 gfx::Size texture_size(85, 32);
884 bool swizzle_contents = true;
885 bool nearest_neighbor = true;
887 CREATE_SHARED_STATE();
888 CREATE_QUAD_7_NEW(TileDrawQuad,
889 opaque_rect,
890 visible_rect,
891 resource_id,
892 tex_coord_rect,
893 texture_size,
894 swizzle_contents,
895 nearest_neighbor);
896 EXPECT_EQ(resource_id, quad_new->resource_id);
897 EXPECT_EQ(1, IterateAndCount(quad_new));
898 EXPECT_EQ(resource_id + 1, quad_new->resource_id);
901 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) {
902 gfx::Rect opaque_rect(33, 47, 10, 12);
903 gfx::Rect visible_rect(40, 50, 30, 20);
904 gfx::RectF tex_coord_rect(0.0f, 0.0f, 0.75f, 0.5f);
905 gfx::Size ya_tex_size(32, 68);
906 gfx::Size uv_tex_size(41, 51);
907 ResourceProvider::ResourceId y_plane_resource_id = 45;
908 ResourceProvider::ResourceId u_plane_resource_id = 532;
909 ResourceProvider::ResourceId v_plane_resource_id = 4;
910 ResourceProvider::ResourceId a_plane_resource_id = 63;
911 YUVVideoDrawQuad::ColorSpace color_space = YUVVideoDrawQuad::JPEG;
913 CREATE_SHARED_STATE();
914 CREATE_QUAD_10_NEW(YUVVideoDrawQuad, opaque_rect, visible_rect,
915 tex_coord_rect, ya_tex_size, uv_tex_size,
916 y_plane_resource_id, u_plane_resource_id,
917 v_plane_resource_id, a_plane_resource_id, 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<RasterSource> raster_source =
942 FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100),
943 gfx::Size(100, 100));
945 CREATE_SHARED_STATE();
946 CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect,
947 texture_size, nearest_neighbor, texture_format,
948 content_rect, contents_scale, raster_source);
949 EXPECT_EQ(0, IterateAndCount(quad_new));
952 TEST(DrawQuadTest, LargestQuadType) {
953 size_t largest = 0;
955 for (int i = 0; i <= DrawQuad::MATERIAL_LAST; ++i) {
956 switch (static_cast<DrawQuad::Material>(i)) {
957 case DrawQuad::CHECKERBOARD:
958 largest = std::max(largest, sizeof(CheckerboardDrawQuad));
959 break;
960 case DrawQuad::DEBUG_BORDER:
961 largest = std::max(largest, sizeof(DebugBorderDrawQuad));
962 break;
963 case DrawQuad::IO_SURFACE_CONTENT:
964 largest = std::max(largest, sizeof(IOSurfaceDrawQuad));
965 break;
966 case DrawQuad::PICTURE_CONTENT:
967 largest = std::max(largest, sizeof(PictureDrawQuad));
968 break;
969 case DrawQuad::TEXTURE_CONTENT:
970 largest = std::max(largest, sizeof(TextureDrawQuad));
971 break;
972 case DrawQuad::RENDER_PASS:
973 largest = std::max(largest, sizeof(RenderPassDrawQuad));
974 break;
975 case DrawQuad::SOLID_COLOR:
976 largest = std::max(largest, sizeof(SolidColorDrawQuad));
977 break;
978 case DrawQuad::SURFACE_CONTENT:
979 largest = std::max(largest, sizeof(SurfaceDrawQuad));
980 break;
981 case DrawQuad::TILED_CONTENT:
982 largest = std::max(largest, sizeof(TileDrawQuad));
983 break;
984 case DrawQuad::STREAM_VIDEO_CONTENT:
985 largest = std::max(largest, sizeof(StreamVideoDrawQuad));
986 break;
987 case DrawQuad::YUV_VIDEO_CONTENT:
988 largest = std::max(largest, sizeof(YUVVideoDrawQuad));
989 break;
990 case DrawQuad::INVALID:
991 break;
994 EXPECT_EQ(LargestDrawQuadSize(), largest);
996 if (!HasFailure())
997 return;
999 // On failure, output the size of all quads for debugging.
1000 LOG(ERROR) << "largest " << largest;
1001 LOG(ERROR) << "kLargestDrawQuad " << LargestDrawQuadSize();
1002 for (int i = 0; i <= DrawQuad::MATERIAL_LAST; ++i) {
1003 switch (static_cast<DrawQuad::Material>(i)) {
1004 case DrawQuad::CHECKERBOARD:
1005 LOG(ERROR) << "CheckerboardDrawQuad " << sizeof(CheckerboardDrawQuad);
1006 break;
1007 case DrawQuad::DEBUG_BORDER:
1008 LOG(ERROR) << "DebugBorderDrawQuad " << sizeof(DebugBorderDrawQuad);
1009 break;
1010 case DrawQuad::IO_SURFACE_CONTENT:
1011 LOG(ERROR) << "IOSurfaceDrawQuad " << sizeof(IOSurfaceDrawQuad);
1012 break;
1013 case DrawQuad::PICTURE_CONTENT:
1014 LOG(ERROR) << "PictureDrawQuad " << sizeof(PictureDrawQuad);
1015 break;
1016 case DrawQuad::TEXTURE_CONTENT:
1017 LOG(ERROR) << "TextureDrawQuad " << sizeof(TextureDrawQuad);
1018 break;
1019 case DrawQuad::RENDER_PASS:
1020 LOG(ERROR) << "RenderPassDrawQuad " << sizeof(RenderPassDrawQuad);
1021 break;
1022 case DrawQuad::SOLID_COLOR:
1023 LOG(ERROR) << "SolidColorDrawQuad " << sizeof(SolidColorDrawQuad);
1024 break;
1025 case DrawQuad::SURFACE_CONTENT:
1026 LOG(ERROR) << "SurfaceDrawQuad " << sizeof(SurfaceDrawQuad);
1027 break;
1028 case DrawQuad::TILED_CONTENT:
1029 LOG(ERROR) << "TileDrawQuad " << sizeof(TileDrawQuad);
1030 break;
1031 case DrawQuad::STREAM_VIDEO_CONTENT:
1032 LOG(ERROR) << "StreamVideoDrawQuad " << sizeof(StreamVideoDrawQuad);
1033 break;
1034 case DrawQuad::YUV_VIDEO_CONTENT:
1035 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad);
1036 break;
1037 case DrawQuad::INVALID:
1038 break;
1043 } // namespace
1044 } // namespace cc