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/test/render_pass_test_common.h" | 5 #include "cc/test/render_pass_test_common.h" |
6 | 6 |
| 7 #include "base/bind.h" |
7 #include "cc/quads/checkerboard_draw_quad.h" | 8 #include "cc/quads/checkerboard_draw_quad.h" |
8 #include "cc/quads/debug_border_draw_quad.h" | 9 #include "cc/quads/debug_border_draw_quad.h" |
9 #include "cc/quads/io_surface_draw_quad.h" | 10 #include "cc/quads/io_surface_draw_quad.h" |
10 #include "cc/quads/render_pass_draw_quad.h" | 11 #include "cc/quads/render_pass_draw_quad.h" |
11 #include "cc/quads/shared_quad_state.h" | 12 #include "cc/quads/shared_quad_state.h" |
12 #include "cc/quads/solid_color_draw_quad.h" | 13 #include "cc/quads/solid_color_draw_quad.h" |
13 #include "cc/quads/stream_video_draw_quad.h" | 14 #include "cc/quads/stream_video_draw_quad.h" |
14 #include "cc/quads/texture_draw_quad.h" | 15 #include "cc/quads/texture_draw_quad.h" |
15 #include "cc/quads/tile_draw_quad.h" | 16 #include "cc/quads/tile_draw_quad.h" |
16 #include "cc/quads/yuv_video_draw_quad.h" | 17 #include "cc/quads/yuv_video_draw_quad.h" |
17 #include "cc/resources/resource_provider.h" | 18 #include "cc/resources/resource_provider.h" |
18 #include "ui/gfx/transform.h" | 19 #include "ui/gfx/transform.h" |
19 | 20 |
20 namespace cc { | 21 namespace cc { |
21 | 22 |
| 23 static void EmptyReleaseCallback(uint32 sync_point, bool lost_resource) { |
| 24 } |
| 25 |
22 void TestRenderPass::AppendOneOfEveryQuadType( | 26 void TestRenderPass::AppendOneOfEveryQuadType( |
23 ResourceProvider* resource_provider, | 27 ResourceProvider* resource_provider, |
24 RenderPass::Id child_pass) { | 28 RenderPass::Id child_pass) { |
25 gfx::Rect rect(0, 0, 100, 100); | 29 gfx::Rect rect(0, 0, 100, 100); |
26 gfx::Rect opaque_rect(10, 10, 80, 80); | 30 gfx::Rect opaque_rect(10, 10, 80, 80); |
27 gfx::Rect visible_rect(0, 0, 100, 100); | 31 gfx::Rect visible_rect(0, 0, 100, 100); |
28 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; | 32 const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 33 |
29 ResourceProvider::ResourceId resource1 = resource_provider->CreateResource( | 34 ResourceProvider::ResourceId resource1 = resource_provider->CreateResource( |
30 gfx::Size(45, 5), | 35 gfx::Size(45, 5), |
31 GL_CLAMP_TO_EDGE, | 36 GL_CLAMP_TO_EDGE, |
32 ResourceProvider::TextureUsageAny, | 37 ResourceProvider::TextureUsageAny, |
33 resource_provider->best_texture_format()); | 38 resource_provider->best_texture_format()); |
34 resource_provider->AllocateForTesting(resource1); | 39 resource_provider->AllocateForTesting(resource1); |
35 ResourceProvider::ResourceId resource2 = resource_provider->CreateResource( | 40 ResourceProvider::ResourceId resource2 = resource_provider->CreateResource( |
36 gfx::Size(346, 61), | 41 gfx::Size(346, 61), |
37 GL_CLAMP_TO_EDGE, | 42 GL_CLAMP_TO_EDGE, |
38 ResourceProvider::TextureUsageAny, | 43 ResourceProvider::TextureUsageAny, |
(...skipping 23 matching lines...) Expand all Loading... |
62 ResourceProvider::TextureUsageAny, | 67 ResourceProvider::TextureUsageAny, |
63 resource_provider->best_texture_format()); | 68 resource_provider->best_texture_format()); |
64 resource_provider->AllocateForTesting(resource6); | 69 resource_provider->AllocateForTesting(resource6); |
65 ResourceProvider::ResourceId resource7 = resource_provider->CreateResource( | 70 ResourceProvider::ResourceId resource7 = resource_provider->CreateResource( |
66 gfx::Size(9, 14), | 71 gfx::Size(9, 14), |
67 GL_CLAMP_TO_EDGE, | 72 GL_CLAMP_TO_EDGE, |
68 ResourceProvider::TextureUsageAny, | 73 ResourceProvider::TextureUsageAny, |
69 resource_provider->best_texture_format()); | 74 resource_provider->best_texture_format()); |
70 resource_provider->AllocateForTesting(resource7); | 75 resource_provider->AllocateForTesting(resource7); |
71 | 76 |
| 77 unsigned target = GL_TEXTURE_2D; |
| 78 gpu::Mailbox gpu_mailbox; |
| 79 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
| 80 scoped_ptr<SingleReleaseCallback> callback = |
| 81 SingleReleaseCallback::Create(base::Bind(&EmptyReleaseCallback)); |
| 82 TextureMailbox mailbox(gpu_mailbox, target, kSyncPointForMailboxTextureQuad); |
| 83 ResourceProvider::ResourceId resource8 = |
| 84 resource_provider->CreateResourceFromTextureMailbox(mailbox, |
| 85 callback.Pass()); |
| 86 resource_provider->AllocateForTesting(resource8); |
| 87 |
72 SharedQuadState* shared_state = this->CreateAndAppendSharedQuadState(); | 88 SharedQuadState* shared_state = this->CreateAndAppendSharedQuadState(); |
73 shared_state->SetAll(gfx::Transform(), | 89 shared_state->SetAll(gfx::Transform(), |
74 rect.size(), | 90 rect.size(), |
75 rect, | 91 rect, |
76 rect, | 92 rect, |
77 false, | 93 false, |
78 1, | 94 1, |
79 SkXfermode::kSrcOver_Mode, | 95 SkXfermode::kSrcOver_Mode, |
80 0); | 96 0); |
81 | 97 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 opaque_rect, | 160 opaque_rect, |
145 visible_rect, | 161 visible_rect, |
146 resource1, | 162 resource1, |
147 false, | 163 false, |
148 gfx::PointF(0.f, 0.f), | 164 gfx::PointF(0.f, 0.f), |
149 gfx::PointF(1.f, 1.f), | 165 gfx::PointF(1.f, 1.f), |
150 SK_ColorTRANSPARENT, | 166 SK_ColorTRANSPARENT, |
151 vertex_opacity, | 167 vertex_opacity, |
152 false); | 168 false); |
153 | 169 |
| 170 TextureDrawQuad* mailbox_texture_quad = |
| 171 this->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 172 mailbox_texture_quad->SetNew(shared_state, |
| 173 rect, |
| 174 opaque_rect, |
| 175 visible_rect, |
| 176 resource8, |
| 177 false, |
| 178 gfx::PointF(0.f, 0.f), |
| 179 gfx::PointF(1.f, 1.f), |
| 180 SK_ColorTRANSPARENT, |
| 181 vertex_opacity, |
| 182 false); |
| 183 |
154 TileDrawQuad* scaled_tile_quad = | 184 TileDrawQuad* scaled_tile_quad = |
155 this->CreateAndAppendDrawQuad<TileDrawQuad>(); | 185 this->CreateAndAppendDrawQuad<TileDrawQuad>(); |
156 scaled_tile_quad->SetNew(shared_state, | 186 scaled_tile_quad->SetNew(shared_state, |
157 rect, | 187 rect, |
158 opaque_rect, | 188 opaque_rect, |
159 visible_rect, | 189 visible_rect, |
160 resource2, | 190 resource2, |
161 gfx::RectF(0, 0, 50, 50), | 191 gfx::RectF(0, 0, 50, 50), |
162 gfx::Size(50, 50), | 192 gfx::Size(50, 50), |
163 false); | 193 false); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 visible_rect, | 248 visible_rect, |
219 gfx::RectF(0, 0, 100, 100), | 249 gfx::RectF(0, 0, 100, 100), |
220 plane_resources[0], | 250 plane_resources[0], |
221 plane_resources[1], | 251 plane_resources[1], |
222 plane_resources[2], | 252 plane_resources[2], |
223 plane_resources[3], | 253 plane_resources[3], |
224 color_space); | 254 color_space); |
225 } | 255 } |
226 | 256 |
227 } // namespace cc | 257 } // namespace cc |
OLD | NEW |