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> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); | 544 EXPECT_EQ(swizzle_contents, copy_quad->swizzle_contents); |
545 } | 545 } |
546 | 546 |
547 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) { | 547 TEST(DrawQuadTest, CopyYUVVideoDrawQuad) { |
548 gfx::Rect opaque_rect(33, 47, 10, 12); | 548 gfx::Rect opaque_rect(33, 47, 10, 12); |
549 gfx::SizeF tex_scale(0.75f, 0.5f); | 549 gfx::SizeF tex_scale(0.75f, 0.5f); |
550 ResourceProvider::ResourceId y_plane_resource_id = 45; | 550 ResourceProvider::ResourceId y_plane_resource_id = 45; |
551 ResourceProvider::ResourceId u_plane_resource_id = 532; | 551 ResourceProvider::ResourceId u_plane_resource_id = 532; |
552 ResourceProvider::ResourceId v_plane_resource_id = 4; | 552 ResourceProvider::ResourceId v_plane_resource_id = 4; |
553 ResourceProvider::ResourceId a_plane_resource_id = 63; | 553 ResourceProvider::ResourceId a_plane_resource_id = 63; |
554 bool has_jpeg_color_range = false; | |
danakj
2013/12/03 21:35:34
use a non-0 value for this in case copying just se
| |
554 CREATE_SHARED_STATE(); | 555 CREATE_SHARED_STATE(); |
555 | 556 |
556 CREATE_QUAD_6_NEW(YUVVideoDrawQuad, | 557 CREATE_QUAD_7_NEW(YUVVideoDrawQuad, |
557 opaque_rect, | 558 opaque_rect, |
558 tex_scale, | 559 tex_scale, |
559 y_plane_resource_id, | 560 y_plane_resource_id, |
560 u_plane_resource_id, | 561 u_plane_resource_id, |
561 v_plane_resource_id, | 562 v_plane_resource_id, |
562 a_plane_resource_id); | 563 a_plane_resource_id, |
564 has_jpeg_color_range); | |
563 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 565 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
564 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); | 566 EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); |
565 EXPECT_EQ(tex_scale, copy_quad->tex_scale); | 567 EXPECT_EQ(tex_scale, copy_quad->tex_scale); |
566 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); | 568 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); |
567 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); | 569 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); |
568 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); | 570 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); |
569 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); | 571 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); |
572 EXPECT_EQ(has_jpeg_color_range, copy_quad->has_jpeg_color_range); | |
570 | 573 |
571 CREATE_QUAD_5_ALL(YUVVideoDrawQuad, | 574 CREATE_QUAD_6_ALL(YUVVideoDrawQuad, |
572 tex_scale, | 575 tex_scale, |
573 y_plane_resource_id, | 576 y_plane_resource_id, |
574 u_plane_resource_id, | 577 u_plane_resource_id, |
575 v_plane_resource_id, | 578 v_plane_resource_id, |
576 a_plane_resource_id); | 579 a_plane_resource_id, |
580 has_jpeg_color_range); | |
577 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 581 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
578 EXPECT_EQ(tex_scale, copy_quad->tex_scale); | 582 EXPECT_EQ(tex_scale, copy_quad->tex_scale); |
579 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); | 583 EXPECT_EQ(y_plane_resource_id, copy_quad->y_plane_resource_id); |
580 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); | 584 EXPECT_EQ(u_plane_resource_id, copy_quad->u_plane_resource_id); |
581 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); | 585 EXPECT_EQ(v_plane_resource_id, copy_quad->v_plane_resource_id); |
582 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); | 586 EXPECT_EQ(a_plane_resource_id, copy_quad->a_plane_resource_id); |
587 EXPECT_EQ(has_jpeg_color_range, copy_quad->has_jpeg_color_range); | |
583 } | 588 } |
584 | 589 |
585 TEST(DrawQuadTest, CopyPictureDrawQuad) { | 590 TEST(DrawQuadTest, CopyPictureDrawQuad) { |
586 gfx::Rect opaque_rect(33, 44, 22, 33); | 591 gfx::Rect opaque_rect(33, 44, 22, 33); |
587 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); | 592 gfx::RectF tex_coord_rect(31.f, 12.f, 54.f, 20.f); |
588 gfx::Size texture_size(85, 32); | 593 gfx::Size texture_size(85, 32); |
589 ResourceFormat texture_format = RGBA_8888; | 594 ResourceFormat texture_format = RGBA_8888; |
590 gfx::Rect content_rect(30, 40, 20, 30); | 595 gfx::Rect content_rect(30, 40, 20, 30); |
591 float contents_scale = 3.141592f; | 596 float contents_scale = 3.141592f; |
592 bool can_draw_direct_to_backbuffer = true; | 597 bool can_draw_direct_to_backbuffer = true; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
778 EXPECT_EQ(resource_id + 1, quad_new->resource_id); | 783 EXPECT_EQ(resource_id + 1, quad_new->resource_id); |
779 } | 784 } |
780 | 785 |
781 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { | 786 TEST_F(DrawQuadIteratorTest, YUVVideoDrawQuad) { |
782 gfx::Rect opaque_rect(33, 47, 10, 12); | 787 gfx::Rect opaque_rect(33, 47, 10, 12); |
783 gfx::SizeF tex_scale(0.75f, 0.5f); | 788 gfx::SizeF tex_scale(0.75f, 0.5f); |
784 ResourceProvider::ResourceId y_plane_resource_id = 45; | 789 ResourceProvider::ResourceId y_plane_resource_id = 45; |
785 ResourceProvider::ResourceId u_plane_resource_id = 532; | 790 ResourceProvider::ResourceId u_plane_resource_id = 532; |
786 ResourceProvider::ResourceId v_plane_resource_id = 4; | 791 ResourceProvider::ResourceId v_plane_resource_id = 4; |
787 ResourceProvider::ResourceId a_plane_resource_id = 63; | 792 ResourceProvider::ResourceId a_plane_resource_id = 63; |
793 bool has_jpeg_color_range = false; | |
danakj
2013/12/03 21:35:34
same here
| |
788 | 794 |
789 CREATE_SHARED_STATE(); | 795 CREATE_SHARED_STATE(); |
790 CREATE_QUAD_6_NEW(YUVVideoDrawQuad, | 796 CREATE_QUAD_7_NEW(YUVVideoDrawQuad, |
791 opaque_rect, | 797 opaque_rect, |
792 tex_scale, | 798 tex_scale, |
793 y_plane_resource_id, | 799 y_plane_resource_id, |
794 u_plane_resource_id, | 800 u_plane_resource_id, |
795 v_plane_resource_id, | 801 v_plane_resource_id, |
796 a_plane_resource_id); | 802 a_plane_resource_id, |
803 has_jpeg_color_range); | |
797 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); | 804 EXPECT_EQ(DrawQuad::YUV_VIDEO_CONTENT, copy_quad->material); |
798 EXPECT_EQ(y_plane_resource_id, quad_new->y_plane_resource_id); | 805 EXPECT_EQ(y_plane_resource_id, quad_new->y_plane_resource_id); |
799 EXPECT_EQ(u_plane_resource_id, quad_new->u_plane_resource_id); | 806 EXPECT_EQ(u_plane_resource_id, quad_new->u_plane_resource_id); |
800 EXPECT_EQ(v_plane_resource_id, quad_new->v_plane_resource_id); | 807 EXPECT_EQ(v_plane_resource_id, quad_new->v_plane_resource_id); |
801 EXPECT_EQ(a_plane_resource_id, quad_new->a_plane_resource_id); | 808 EXPECT_EQ(a_plane_resource_id, quad_new->a_plane_resource_id); |
809 EXPECT_EQ(has_jpeg_color_range, quad_new->has_jpeg_color_range); | |
802 EXPECT_EQ(4, IterateAndCount(quad_new.get())); | 810 EXPECT_EQ(4, IterateAndCount(quad_new.get())); |
803 EXPECT_EQ(y_plane_resource_id + 1, quad_new->y_plane_resource_id); | 811 EXPECT_EQ(y_plane_resource_id + 1, quad_new->y_plane_resource_id); |
804 EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id); | 812 EXPECT_EQ(u_plane_resource_id + 1, quad_new->u_plane_resource_id); |
805 EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id); | 813 EXPECT_EQ(v_plane_resource_id + 1, quad_new->v_plane_resource_id); |
806 EXPECT_EQ(a_plane_resource_id + 1, quad_new->a_plane_resource_id); | 814 EXPECT_EQ(a_plane_resource_id + 1, quad_new->a_plane_resource_id); |
807 } | 815 } |
808 | 816 |
809 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 | 817 // Disabled until picture draw quad is supported for ubercomp: crbug.com/231715 |
810 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { | 818 TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) { |
811 gfx::Rect opaque_rect(33, 44, 22, 33); | 819 gfx::Rect opaque_rect(33, 44, 22, 33); |
(...skipping 13 matching lines...) Expand all Loading... | |
825 texture_format, | 833 texture_format, |
826 content_rect, | 834 content_rect, |
827 contents_scale, | 835 contents_scale, |
828 can_draw_direct_to_backbuffer, | 836 can_draw_direct_to_backbuffer, |
829 picture_pile); | 837 picture_pile); |
830 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 838 EXPECT_EQ(0, IterateAndCount(quad_new.get())); |
831 } | 839 } |
832 | 840 |
833 } // namespace | 841 } // namespace |
834 } // namespace cc | 842 } // namespace cc |
OLD | NEW |