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

Side by Side Diff: cc/draw_quad_unittest.cc

Issue 12328098: cc: Moving anti-aliasing decision to parent compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@solidaa
Patch Set: Addressed change request from message #6 (updated unit tests). Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/draw_quad.h" 5 #include "cc/draw_quad.h"
6 6
7 #include "cc/checkerboard_draw_quad.h" 7 #include "cc/checkerboard_draw_quad.h"
8 #include "cc/debug_border_draw_quad.h" 8 #include "cc/debug_border_draw_quad.h"
9 #include "cc/io_surface_draw_quad.h" 9 #include "cc/io_surface_draw_quad.h"
10 #include "cc/math_util.h" 10 #include "cc/math_util.h"
11 #include "cc/render_pass_draw_quad.h" 11 #include "cc/render_pass_draw_quad.h"
12 #include "cc/solid_color_draw_quad.h" 12 #include "cc/solid_color_draw_quad.h"
13 #include "cc/stream_video_draw_quad.h" 13 #include "cc/stream_video_draw_quad.h"
14 #include "cc/test/geometry_test_utils.h" 14 #include "cc/test/geometry_test_utils.h"
15 #include "cc/texture_draw_quad.h" 15 #include "cc/texture_draw_quad.h"
16 #include "cc/tile_draw_quad.h" 16 #include "cc/tile_draw_quad.h"
17 #include "cc/yuv_video_draw_quad.h" 17 #include "cc/yuv_video_draw_quad.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h" 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h"
20 #include "third_party/skia/include/effects/SkBlurImageFilter.h" 20 #include "third_party/skia/include/effects/SkBlurImageFilter.h"
21 #include "ui/gfx/transform.h" 21 #include "ui/gfx/transform.h"
22 22
23 namespace cc { 23 namespace cc {
24 namespace { 24 namespace {
25 25
26 TEST(DrawQuadTest, copySharedQuadState) 26 TEST(DrawQuadTest, copySharedQuadState)
27 { 27 {
28 gfx::Transform quadTransform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); 28 gfx::Transform quadTransform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0);
29 gfx::Size contentBounds(26, 28);
29 gfx::Rect visibleContentRect(10, 12, 14, 16); 30 gfx::Rect visibleContentRect(10, 12, 14, 16);
30 gfx::Rect clipRect(19, 21, 23, 25); 31 gfx::Rect clipRect(19, 21, 23, 25);
31 bool isClipped = true; 32 bool isClipped = true;
32 float opacity = 0.25; 33 float opacity = 0.25;
33 34
34 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); 35 scoped_ptr<SharedQuadState> state(SharedQuadState::Create());
35 state->SetAll(quadTransform, visibleContentRect, clipRect, isClipped, opacit y); 36 state->SetAll(quadTransform, contentBounds, visibleContentRect, clipRect,
37 isClipped, opacity);
36 38
37 scoped_ptr<SharedQuadState> copy(state->Copy()); 39 scoped_ptr<SharedQuadState> copy(state->Copy());
38 EXPECT_EQ(quadTransform, copy->content_to_target_transform); 40 EXPECT_EQ(quadTransform, copy->content_to_target_transform);
39 EXPECT_RECT_EQ(visibleContentRect, copy->visible_content_rect); 41 EXPECT_RECT_EQ(visibleContentRect, copy->visible_content_rect);
40 EXPECT_EQ(opacity, copy->opacity); 42 EXPECT_EQ(opacity, copy->opacity);
41 EXPECT_RECT_EQ(clipRect, copy->clip_rect); 43 EXPECT_RECT_EQ(clipRect, copy->clip_rect);
42 EXPECT_EQ(isClipped, copy->is_clipped); 44 EXPECT_EQ(isClipped, copy->is_clipped);
43 } 45 }
44 46
45 scoped_ptr<SharedQuadState> createSharedQuadState() 47 scoped_ptr<SharedQuadState> createSharedQuadState()
46 { 48 {
47 gfx::Transform quadTransform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); 49 gfx::Transform quadTransform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0);
50 gfx::Size contentBounds(26, 28);
48 gfx::Rect visibleContentRect(10, 12, 14, 16); 51 gfx::Rect visibleContentRect(10, 12, 14, 16);
49 gfx::Rect clipRect(19, 21, 23, 25); 52 gfx::Rect clipRect(19, 21, 23, 25);
50 bool isClipped = false; 53 bool isClipped = false;
51 float opacity = 1; 54 float opacity = 1;
52 55
53 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); 56 scoped_ptr<SharedQuadState> state(SharedQuadState::Create());
54 state->SetAll(quadTransform, visibleContentRect, clipRect, isClipped, opacit y); 57 state->SetAll(quadTransform, contentBounds, visibleContentRect, clipRect,
58 isClipped, opacity);
55 return state.Pass(); 59 return state.Pass();
56 } 60 }
57 61
58 void compareDrawQuad(DrawQuad* quad, DrawQuad* copy, SharedQuadState* copyShared State) 62 void compareDrawQuad(DrawQuad* quad, DrawQuad* copy, SharedQuadState* copyShared State)
59 { 63 {
60 EXPECT_EQ(quad->material, copy->material); 64 EXPECT_EQ(quad->material, copy->material);
61 EXPECT_RECT_EQ(quad->rect, copy->rect); 65 EXPECT_RECT_EQ(quad->rect, copy->rect);
62 EXPECT_RECT_EQ(quad->visible_rect, copy->visible_rect); 66 EXPECT_RECT_EQ(quad->visible_rect, copy->visible_rect);
63 EXPECT_RECT_EQ(quad->opaque_rect, copy->opaque_rect); 67 EXPECT_RECT_EQ(quad->opaque_rect, copy->opaque_rect);
64 EXPECT_EQ(quad->needs_blending, copy->needs_blending); 68 EXPECT_EQ(quad->needs_blending, copy->needs_blending);
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 457 }
454 } 458 }
455 459
456 TEST(DrawQuadTest, copyTileDrawQuad) 460 TEST(DrawQuadTest, copyTileDrawQuad)
457 { 461 {
458 gfx::Rect opaqueRect(33, 44, 22, 33); 462 gfx::Rect opaqueRect(33, 44, 22, 33);
459 unsigned resourceId = 104; 463 unsigned resourceId = 104;
460 gfx::RectF texCoordRect(31, 12, 54, 20); 464 gfx::RectF texCoordRect(31, 12, 54, 20);
461 gfx::Size textureSize(85, 32); 465 gfx::Size textureSize(85, 32);
462 bool swizzleContents = true; 466 bool swizzleContents = true;
463 bool leftEdgeAA = true;
464 bool topEdgeAA = true;
465 bool rightEdgeAA = false;
466 bool bottomEdgeAA = true;
467 CREATE_SHARED_STATE(); 467 CREATE_SHARED_STATE();
468 468
469 CREATE_QUAD_9_NEW(TileDrawQuad, opaqueRect, resourceId, texCoordRect, textur eSize, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA); 469 CREATE_QUAD_5_NEW(TileDrawQuad, opaqueRect, resourceId, texCoordRect, textur eSize, swizzleContents);
470 EXPECT_EQ(DrawQuad::TILED_CONTENT, copyQuad->material); 470 EXPECT_EQ(DrawQuad::TILED_CONTENT, copyQuad->material);
471 EXPECT_RECT_EQ(opaqueRect, copyQuad->opaque_rect); 471 EXPECT_RECT_EQ(opaqueRect, copyQuad->opaque_rect);
472 EXPECT_EQ(resourceId, copyQuad->resource_id); 472 EXPECT_EQ(resourceId, copyQuad->resource_id);
473 EXPECT_EQ(texCoordRect, copyQuad->tex_coord_rect); 473 EXPECT_EQ(texCoordRect, copyQuad->tex_coord_rect);
474 EXPECT_EQ(textureSize, copyQuad->texture_size); 474 EXPECT_EQ(textureSize, copyQuad->texture_size);
475 EXPECT_EQ(swizzleContents, copyQuad->swizzle_contents); 475 EXPECT_EQ(swizzleContents, copyQuad->swizzle_contents);
476 EXPECT_EQ(leftEdgeAA, copyQuad->left_edge_aa);
477 EXPECT_EQ(topEdgeAA, copyQuad->top_edge_aa);
478 EXPECT_EQ(rightEdgeAA, copyQuad->right_edge_aa);
479 EXPECT_EQ(bottomEdgeAA, copyQuad->bottom_edge_aa);
480 476
481 CREATE_QUAD_8_ALL(TileDrawQuad, resourceId, texCoordRect, textureSize, swizz leContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA); 477 CREATE_QUAD_4_ALL(TileDrawQuad, resourceId, texCoordRect, textureSize, swizz leContents);
482 EXPECT_EQ(DrawQuad::TILED_CONTENT, copyQuad->material); 478 EXPECT_EQ(DrawQuad::TILED_CONTENT, copyQuad->material);
483 EXPECT_EQ(resourceId, copyQuad->resource_id); 479 EXPECT_EQ(resourceId, copyQuad->resource_id);
484 EXPECT_EQ(texCoordRect, copyQuad->tex_coord_rect); 480 EXPECT_EQ(texCoordRect, copyQuad->tex_coord_rect);
485 EXPECT_EQ(textureSize, copyQuad->texture_size); 481 EXPECT_EQ(textureSize, copyQuad->texture_size);
486 EXPECT_EQ(swizzleContents, copyQuad->swizzle_contents); 482 EXPECT_EQ(swizzleContents, copyQuad->swizzle_contents);
487 EXPECT_EQ(leftEdgeAA, copyQuad->left_edge_aa);
488 EXPECT_EQ(topEdgeAA, copyQuad->top_edge_aa);
489 EXPECT_EQ(rightEdgeAA, copyQuad->right_edge_aa);
490 EXPECT_EQ(bottomEdgeAA, copyQuad->bottom_edge_aa);
491 } 483 }
492 484
493 TEST(DrawQuadTest, copyYUVVideoDrawQuad) 485 TEST(DrawQuadTest, copyYUVVideoDrawQuad)
494 { 486 {
495 gfx::Rect opaqueRect(3, 7, 10, 12); 487 gfx::Rect opaqueRect(3, 7, 10, 12);
496 gfx::SizeF texScale(0.75, 0.5); 488 gfx::SizeF texScale(0.75, 0.5);
497 VideoLayerImpl::FramePlane yPlane; 489 VideoLayerImpl::FramePlane yPlane;
498 yPlane.resourceId = 45; 490 yPlane.resourceId = 45;
499 yPlane.size = gfx::Size(34, 23); 491 yPlane.size = gfx::Size(34, 23);
500 yPlane.format = 8; 492 yPlane.format = 8;
(...skipping 30 matching lines...) Expand all
531 EXPECT_EQ(uPlane.resourceId, copyQuad->u_plane.resourceId); 523 EXPECT_EQ(uPlane.resourceId, copyQuad->u_plane.resourceId);
532 EXPECT_EQ(uPlane.size, copyQuad->u_plane.size); 524 EXPECT_EQ(uPlane.size, copyQuad->u_plane.size);
533 EXPECT_EQ(uPlane.format, copyQuad->u_plane.format); 525 EXPECT_EQ(uPlane.format, copyQuad->u_plane.format);
534 EXPECT_EQ(vPlane.resourceId, copyQuad->v_plane.resourceId); 526 EXPECT_EQ(vPlane.resourceId, copyQuad->v_plane.resourceId);
535 EXPECT_EQ(vPlane.size, copyQuad->v_plane.size); 527 EXPECT_EQ(vPlane.size, copyQuad->v_plane.size);
536 EXPECT_EQ(vPlane.format, copyQuad->v_plane.format); 528 EXPECT_EQ(vPlane.format, copyQuad->v_plane.format);
537 } 529 }
538 530
539 } // namespace 531 } // namespace
540 } // namespace cc 532 } // namespace cc
OLDNEW
« no previous file with comments | « cc/draw_quad.h ('k') | cc/gl_renderer.cc » ('j') | content/common/cc_messages_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698