| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/common/cc_messages.h" | 5 #include "content/common/cc_messages.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 void Compare(const YUVVideoDrawQuad* a, const YUVVideoDrawQuad* b) { | 191 void Compare(const YUVVideoDrawQuad* a, const YUVVideoDrawQuad* b) { |
| 192 EXPECT_EQ(a->tex_scale, b->tex_scale); | 192 EXPECT_EQ(a->tex_scale, b->tex_scale); |
| 193 EXPECT_EQ(a->y_plane_resource_id, b->y_plane_resource_id); | 193 EXPECT_EQ(a->y_plane_resource_id, b->y_plane_resource_id); |
| 194 EXPECT_EQ(a->u_plane_resource_id, b->u_plane_resource_id); | 194 EXPECT_EQ(a->u_plane_resource_id, b->u_plane_resource_id); |
| 195 EXPECT_EQ(a->v_plane_resource_id, b->v_plane_resource_id); | 195 EXPECT_EQ(a->v_plane_resource_id, b->v_plane_resource_id); |
| 196 EXPECT_EQ(a->a_plane_resource_id, b->a_plane_resource_id); | 196 EXPECT_EQ(a->a_plane_resource_id, b->a_plane_resource_id); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void Compare(const TransferableResource& a, const TransferableResource& b) { | 199 void Compare(const TransferableResource& a, const TransferableResource& b) { |
| 200 EXPECT_EQ(a.id, b.id); | 200 EXPECT_EQ(a.id, b.id); |
| 201 EXPECT_EQ(a.sync_point, b.sync_point); | |
| 202 EXPECT_EQ(a.format, b.format); | 201 EXPECT_EQ(a.format, b.format); |
| 203 EXPECT_EQ(a.target, b.target); | |
| 204 EXPECT_EQ(a.filter, b.filter); | 202 EXPECT_EQ(a.filter, b.filter); |
| 205 EXPECT_EQ(a.size.ToString(), b.size.ToString()); | 203 EXPECT_EQ(a.size.ToString(), b.size.ToString()); |
| 206 for (size_t i = 0; i < arraysize(a.mailbox.name); ++i) | 204 for (size_t i = 0; i < arraysize(a.mailbox_holder.mailbox.name); ++i) { |
| 207 EXPECT_EQ(a.mailbox.name[i], b.mailbox.name[i]); | 205 EXPECT_EQ(a.mailbox_holder.mailbox.name[i], |
| 206 b.mailbox_holder.mailbox.name[i]); |
| 207 } |
| 208 EXPECT_EQ(a.mailbox_holder.texture_target, b.mailbox_holder.texture_target); |
| 209 EXPECT_EQ(a.mailbox_holder.sync_point, b.mailbox_holder.sync_point); |
| 208 } | 210 } |
| 209 }; | 211 }; |
| 210 | 212 |
| 211 TEST_F(CCMessagesTest, AllQuads) { | 213 TEST_F(CCMessagesTest, AllQuads) { |
| 212 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); | 214 IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
| 213 | 215 |
| 214 Transform arbitrary_matrix; | 216 Transform arbitrary_matrix; |
| 215 arbitrary_matrix.Scale(3, 3); | 217 arbitrary_matrix.Scale(3, 3); |
| 216 arbitrary_matrix.Translate(-5, 20); | 218 arbitrary_matrix.Translate(-5, 20); |
| 217 arbitrary_matrix.Rotate(15); | 219 arbitrary_matrix.Rotate(15); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 | 650 |
| 649 GLbyte arbitrary_mailbox2[64] = { | 651 GLbyte arbitrary_mailbox2[64] = { |
| 650 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, | 652 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, |
| 651 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, | 653 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, |
| 652 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, | 654 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, |
| 653 0, 9, 8, 7 | 655 0, 9, 8, 7 |
| 654 }; | 656 }; |
| 655 | 657 |
| 656 TransferableResource arbitrary_resource1; | 658 TransferableResource arbitrary_resource1; |
| 657 arbitrary_resource1.id = 2178312; | 659 arbitrary_resource1.id = 2178312; |
| 658 arbitrary_resource1.sync_point = arbitrary_uint1; | |
| 659 arbitrary_resource1.format = cc::RGBA_8888; | 660 arbitrary_resource1.format = cc::RGBA_8888; |
| 660 arbitrary_resource1.target = GL_TEXTURE_2D; | |
| 661 arbitrary_resource1.filter = 53; | 661 arbitrary_resource1.filter = 53; |
| 662 arbitrary_resource1.size = gfx::Size(37189, 123123); | 662 arbitrary_resource1.size = gfx::Size(37189, 123123); |
| 663 arbitrary_resource1.mailbox.SetName(arbitrary_mailbox1); | 663 arbitrary_resource1.mailbox_holder.mailbox.SetName(arbitrary_mailbox1); |
| 664 arbitrary_resource1.mailbox_holder.texture_target = GL_TEXTURE_2D; |
| 665 arbitrary_resource1.mailbox_holder.sync_point = arbitrary_uint1; |
| 664 | 666 |
| 665 TransferableResource arbitrary_resource2; | 667 TransferableResource arbitrary_resource2; |
| 666 arbitrary_resource2.id = 789132; | 668 arbitrary_resource2.id = 789132; |
| 667 arbitrary_resource2.sync_point = arbitrary_uint2; | |
| 668 arbitrary_resource2.format = cc::RGBA_4444; | 669 arbitrary_resource2.format = cc::RGBA_4444; |
| 669 arbitrary_resource2.target = GL_TEXTURE_EXTERNAL_OES; | |
| 670 arbitrary_resource2.filter = 47; | 670 arbitrary_resource2.filter = 47; |
| 671 arbitrary_resource2.size = gfx::Size(89123, 23789); | 671 arbitrary_resource2.size = gfx::Size(89123, 23789); |
| 672 arbitrary_resource2.mailbox.SetName(arbitrary_mailbox2); | 672 arbitrary_resource2.mailbox_holder.mailbox.SetName(arbitrary_mailbox2); |
| 673 arbitrary_resource2.mailbox_holder.texture_target = GL_TEXTURE_EXTERNAL_OES; |
| 674 arbitrary_resource2.mailbox_holder.sync_point = arbitrary_uint2; |
| 673 | 675 |
| 674 scoped_ptr<RenderPass> renderpass_in = RenderPass::Create(); | 676 scoped_ptr<RenderPass> renderpass_in = RenderPass::Create(); |
| 675 renderpass_in->SetNew( | 677 renderpass_in->SetNew( |
| 676 RenderPass::Id(1, 1), gfx::Rect(), gfx::Rect(), gfx::Transform()); | 678 RenderPass::Id(1, 1), gfx::Rect(), gfx::Rect(), gfx::Transform()); |
| 677 | 679 |
| 678 DelegatedFrameData frame_in; | 680 DelegatedFrameData frame_in; |
| 679 frame_in.resource_list.push_back(arbitrary_resource1); | 681 frame_in.resource_list.push_back(arbitrary_resource1); |
| 680 frame_in.resource_list.push_back(arbitrary_resource2); | 682 frame_in.resource_list.push_back(arbitrary_resource2); |
| 681 frame_in.render_pass_list.push_back(renderpass_in.Pass()); | 683 frame_in.render_pass_list.push_back(renderpass_in.Pass()); |
| 682 | 684 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 } | 741 } |
| 740 | 742 |
| 741 // Verify the largest DrawQuad type is RenderPassDrawQuad. If this ever | 743 // Verify the largest DrawQuad type is RenderPassDrawQuad. If this ever |
| 742 // changes, then the ReserveSizeForRenderPassWrite() method needs to be | 744 // changes, then the ReserveSizeForRenderPassWrite() method needs to be |
| 743 // updated as well to use the new largest quad. | 745 // updated as well to use the new largest quad. |
| 744 EXPECT_EQ(sizeof(RenderPassDrawQuad), largest); | 746 EXPECT_EQ(sizeof(RenderPassDrawQuad), largest); |
| 745 } | 747 } |
| 746 | 748 |
| 747 } // namespace | 749 } // namespace |
| 748 } // namespace content | 750 } // namespace content |
| OLD | NEW |