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

Side by Side Diff: cc/draw_quad_unittest.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « cc/draw_quad.h ('k') | cc/float_quad_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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/render_pass_draw_quad.h" 11 #include "cc/render_pass_draw_quad.h"
11 #include "cc/solid_color_draw_quad.h" 12 #include "cc/solid_color_draw_quad.h"
12 #include "cc/stream_video_draw_quad.h" 13 #include "cc/stream_video_draw_quad.h"
13 #include "cc/test/geometry_test_utils.h" 14 #include "cc/test/geometry_test_utils.h"
14 #include "cc/texture_draw_quad.h" 15 #include "cc/texture_draw_quad.h"
15 #include "cc/tile_draw_quad.h" 16 #include "cc/tile_draw_quad.h"
16 #include "cc/yuv_video_draw_quad.h" 17 #include "cc/yuv_video_draw_quad.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include <public/WebTransformationMatrix.h> 19 #include "ui/gfx/transform.h"
19
20 using WebKit::WebTransformationMatrix;
21 20
22 namespace cc { 21 namespace cc {
23 namespace { 22 namespace {
24 23
25 TEST(DrawQuadTest, copySharedQuadState) 24 TEST(DrawQuadTest, copySharedQuadState)
26 { 25 {
27 WebTransformationMatrix quadTransform(1, 0.5, 0, 1, 0.5, 0); 26 gfx::Transform quadTransform = MathUtil::createGfxTransform(1, 0.5, 0, 1, 0. 5, 0);
28 gfx::Rect visibleContentRect(10, 12, 14, 16); 27 gfx::Rect visibleContentRect(10, 12, 14, 16);
29 gfx::Rect clippedRectInTarget(19, 21, 23, 25); 28 gfx::Rect clippedRectInTarget(19, 21, 23, 25);
30 gfx::Rect clipRect = clippedRectInTarget; 29 gfx::Rect clipRect = clippedRectInTarget;
31 bool isClipped = true; 30 bool isClipped = true;
32 float opacity = 0.25; 31 float opacity = 0.25;
33 32
34 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); 33 scoped_ptr<SharedQuadState> state(SharedQuadState::Create());
35 state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRe ct, isClipped, opacity); 34 state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRe ct, isClipped, opacity);
36 35
37 scoped_ptr<SharedQuadState> copy(state->Copy()); 36 scoped_ptr<SharedQuadState> copy(state->Copy());
38 EXPECT_EQ(quadTransform, copy->content_to_target_transform); 37 EXPECT_EQ(quadTransform, copy->content_to_target_transform);
39 EXPECT_RECT_EQ(visibleContentRect, copy->visible_content_rect); 38 EXPECT_RECT_EQ(visibleContentRect, copy->visible_content_rect);
40 EXPECT_RECT_EQ(clippedRectInTarget, copy->clipped_rect_in_target); 39 EXPECT_RECT_EQ(clippedRectInTarget, copy->clipped_rect_in_target);
41 EXPECT_EQ(opacity, copy->opacity); 40 EXPECT_EQ(opacity, copy->opacity);
42 EXPECT_RECT_EQ(clipRect, copy->clip_rect); 41 EXPECT_RECT_EQ(clipRect, copy->clip_rect);
43 EXPECT_EQ(isClipped, copy->is_clipped); 42 EXPECT_EQ(isClipped, copy->is_clipped);
44 } 43 }
45 44
46 scoped_ptr<SharedQuadState> createSharedQuadState() 45 scoped_ptr<SharedQuadState> createSharedQuadState()
47 { 46 {
48 WebTransformationMatrix quadTransform(1, 0.5, 0, 1, 0.5, 0); 47 gfx::Transform quadTransform = MathUtil::createGfxTransform(1, 0.5, 0, 1, 0. 5, 0);
49 gfx::Rect visibleContentRect(10, 12, 14, 16); 48 gfx::Rect visibleContentRect(10, 12, 14, 16);
50 gfx::Rect clippedRectInTarget(19, 21, 23, 25); 49 gfx::Rect clippedRectInTarget(19, 21, 23, 25);
51 gfx::Rect clipRect = clippedRectInTarget; 50 gfx::Rect clipRect = clippedRectInTarget;
52 bool isClipped = false; 51 bool isClipped = false;
53 float opacity = 1; 52 float opacity = 1;
54 53
55 scoped_ptr<SharedQuadState> state(SharedQuadState::Create()); 54 scoped_ptr<SharedQuadState> state(SharedQuadState::Create());
56 state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRe ct, isClipped, opacity); 55 state->SetAll(quadTransform, visibleContentRect, clippedRectInTarget, clipRe ct, isClipped, opacity);
57 return state.Pass(); 56 return state.Pass();
58 } 57 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 317
319 CREATE_QUAD_1_ALL(SolidColorDrawQuad, color); 318 CREATE_QUAD_1_ALL(SolidColorDrawQuad, color);
320 EXPECT_EQ(DrawQuad::SOLID_COLOR, copyQuad->material); 319 EXPECT_EQ(DrawQuad::SOLID_COLOR, copyQuad->material);
321 EXPECT_EQ(color, copyQuad->color); 320 EXPECT_EQ(color, copyQuad->color);
322 } 321 }
323 322
324 TEST(DrawQuadTest, copyStreamVideoDrawQuad) 323 TEST(DrawQuadTest, copyStreamVideoDrawQuad)
325 { 324 {
326 gfx::Rect opaqueRect(3, 7, 10, 12); 325 gfx::Rect opaqueRect(3, 7, 10, 12);
327 unsigned textureId = 64; 326 unsigned textureId = 64;
328 WebTransformationMatrix matrix(0.5, 1, 0.25, 0.75, 0, 1); 327 gfx::Transform matrix = MathUtil::createGfxTransform(0.5, 1, 0.25, 0.75, 0, 1);
329 CREATE_SHARED_STATE(); 328 CREATE_SHARED_STATE();
330 329
331 CREATE_QUAD_3_NEW(StreamVideoDrawQuad, opaqueRect, textureId, matrix); 330 CREATE_QUAD_3_NEW(StreamVideoDrawQuad, opaqueRect, textureId, matrix);
332 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copyQuad->material); 331 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copyQuad->material);
333 EXPECT_RECT_EQ(opaqueRect, copyQuad->opaque_rect); 332 EXPECT_RECT_EQ(opaqueRect, copyQuad->opaque_rect);
334 EXPECT_EQ(textureId, copyQuad->texture_id); 333 EXPECT_EQ(textureId, copyQuad->texture_id);
335 EXPECT_EQ(matrix, copyQuad->matrix); 334 EXPECT_EQ(matrix, copyQuad->matrix);
336 335
337 CREATE_QUAD_2_ALL(StreamVideoDrawQuad, textureId, matrix); 336 CREATE_QUAD_2_ALL(StreamVideoDrawQuad, textureId, matrix);
338 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copyQuad->material); 337 EXPECT_EQ(DrawQuad::STREAM_VIDEO_CONTENT, copyQuad->material);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 EXPECT_EQ(uPlane.resourceId, copyQuad->u_plane.resourceId); 442 EXPECT_EQ(uPlane.resourceId, copyQuad->u_plane.resourceId);
444 EXPECT_EQ(uPlane.size, copyQuad->u_plane.size); 443 EXPECT_EQ(uPlane.size, copyQuad->u_plane.size);
445 EXPECT_EQ(uPlane.format, copyQuad->u_plane.format); 444 EXPECT_EQ(uPlane.format, copyQuad->u_plane.format);
446 EXPECT_EQ(vPlane.resourceId, copyQuad->v_plane.resourceId); 445 EXPECT_EQ(vPlane.resourceId, copyQuad->v_plane.resourceId);
447 EXPECT_EQ(vPlane.size, copyQuad->v_plane.size); 446 EXPECT_EQ(vPlane.size, copyQuad->v_plane.size);
448 EXPECT_EQ(vPlane.format, copyQuad->v_plane.format); 447 EXPECT_EQ(vPlane.format, copyQuad->v_plane.format);
449 } 448 }
450 449
451 } // namespace 450 } // namespace
452 } // namespace cc 451 } // namespace cc
OLDNEW
« no previous file with comments | « cc/draw_quad.h ('k') | cc/float_quad_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698