| OLD | NEW |
| 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/quads/draw_quad.h" | 5 #include "cc/quads/draw_quad.h" |
| 6 | 6 |
| 7 #include <algorithm> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| 9 #include "cc/quads/checkerboard_draw_quad.h" | 11 #include "cc/quads/checkerboard_draw_quad.h" |
| 10 #include "cc/quads/debug_border_draw_quad.h" | 12 #include "cc/quads/debug_border_draw_quad.h" |
| 11 #include "cc/quads/io_surface_draw_quad.h" | 13 #include "cc/quads/io_surface_draw_quad.h" |
| 12 #include "cc/quads/render_pass_draw_quad.h" | 14 #include "cc/quads/render_pass_draw_quad.h" |
| 13 #include "cc/quads/solid_color_draw_quad.h" | 15 #include "cc/quads/solid_color_draw_quad.h" |
| 14 #include "cc/quads/stream_video_draw_quad.h" | 16 #include "cc/quads/stream_video_draw_quad.h" |
| 15 #include "cc/quads/texture_draw_quad.h" | 17 #include "cc/quads/texture_draw_quad.h" |
| 16 #include "cc/quads/tile_draw_quad.h" | 18 #include "cc/quads/tile_draw_quad.h" |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 bool premultiplied_alpha = true; | 492 bool premultiplied_alpha = true; |
| 491 bool flipped = true; | 493 bool flipped = true; |
| 492 CREATE_SHARED_STATE(); | 494 CREATE_SHARED_STATE(); |
| 493 // The original quad position is (30, 40) its size is 50*60. | 495 // The original quad position is (30, 40) its size is 50*60. |
| 494 shared_state->content_to_target_transform = | 496 shared_state->content_to_target_transform = |
| 495 gfx::Transform(1.f, 0.f, 0.f, 1.f, 10.f, 20.f); | 497 gfx::Transform(1.f, 0.f, 0.f, 1.f, 10.f, 20.f); |
| 496 // After transformation, the quad position is (40, 60) its size is 50*60. | 498 // After transformation, the quad position is (40, 60) its size is 50*60. |
| 497 shared_state->clip_rect = gfx::Rect(50, 70, 30, 20); | 499 shared_state->clip_rect = gfx::Rect(50, 70, 30, 20); |
| 498 | 500 |
| 499 // The original quad is 'ABCD', the clipped quad is 'abcd': | 501 // The original quad is 'ABCD', the clipped quad is 'abcd': |
| 500 //40 50 90 | 502 // 40 50 90 |
| 501 // B--:-------C 60 | 503 // B--:-------C 60 |
| 502 // | b----c -|-70 | 504 // | b----c -|-70 |
| 503 // | | | | | 505 // | | | | |
| 504 // | a----d -|-90 | 506 // | a----d -|-90 |
| 505 // | | | 507 // | | |
| 506 // A----------D 120 | 508 // A----------D 120 |
| 507 // UV and vertex opacity are stored per vertex on the parent rectangle 'ABCD'. | 509 // UV and vertex opacity are stored per vertex on the parent rectangle 'ABCD'. |
| 508 | 510 |
| 509 // This is the UV value for vertex 'B'. | 511 // This is the UV value for vertex 'B'. |
| 510 gfx::PointF uv_top_left(0.1f, 0.2f); | 512 gfx::PointF uv_top_left(0.1f, 0.2f); |
| 511 // This is the UV value for vertex 'D'. | 513 // This is the UV value for vertex 'D'. |
| 512 gfx::PointF uv_bottom_right(0.9f, 0.8f); | 514 gfx::PointF uv_bottom_right(0.9f, 0.8f); |
| 513 // This the vertex opacity for the vertices 'ABCD'. | 515 // This the vertex opacity for the vertices 'ABCD'. |
| 514 const float vertex_opacity[] = { 0.3f, 0.4f, 0.7f, 0.8f }; | 516 const float vertex_opacity[] = { 0.3f, 0.4f, 0.7f, 0.8f }; |
| 515 { | 517 { |
| 516 CREATE_QUAD_7_NEW(TextureDrawQuad, | 518 CREATE_QUAD_7_NEW(TextureDrawQuad, |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 EXPECT_EQ(u_plane.resource_id, quad_new->u_plane.resource_id); | 821 EXPECT_EQ(u_plane.resource_id, quad_new->u_plane.resource_id); |
| 820 EXPECT_EQ(v_plane.resource_id, quad_new->v_plane.resource_id); | 822 EXPECT_EQ(v_plane.resource_id, quad_new->v_plane.resource_id); |
| 821 EXPECT_EQ(3, IterateAndCount(quad_new.get())); | 823 EXPECT_EQ(3, IterateAndCount(quad_new.get())); |
| 822 EXPECT_EQ(y_plane.resource_id + 1, quad_new->y_plane.resource_id); | 824 EXPECT_EQ(y_plane.resource_id + 1, quad_new->y_plane.resource_id); |
| 823 EXPECT_EQ(u_plane.resource_id + 1, quad_new->u_plane.resource_id); | 825 EXPECT_EQ(u_plane.resource_id + 1, quad_new->u_plane.resource_id); |
| 824 EXPECT_EQ(v_plane.resource_id + 1, quad_new->v_plane.resource_id); | 826 EXPECT_EQ(v_plane.resource_id + 1, quad_new->v_plane.resource_id); |
| 825 } | 827 } |
| 826 | 828 |
| 827 } // namespace | 829 } // namespace |
| 828 } // namespace cc | 830 } // namespace cc |
| OLD | NEW |