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/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) { | 1551 TEST_F(GLRendererShaderTest, DrawRenderPassQuadShaderPermutations) { |
1552 gfx::Rect viewport_rect(1, 1); | 1552 gfx::Rect viewport_rect(1, 1); |
1553 | 1553 |
1554 gfx::Rect child_rect(50, 50); | 1554 gfx::Rect child_rect(50, 50); |
1555 RenderPassId child_pass_id(2, 0); | 1555 RenderPassId child_pass_id(2, 0); |
1556 TestRenderPass* child_pass; | 1556 TestRenderPass* child_pass; |
1557 | 1557 |
1558 RenderPassId root_pass_id(1, 0); | 1558 RenderPassId root_pass_id(1, 0); |
1559 TestRenderPass* root_pass; | 1559 TestRenderPass* root_pass; |
1560 | 1560 |
1561 ResourceProvider::ResourceId mask = resource_provider_->CreateResource( | 1561 ResourceId mask = resource_provider_->CreateResource( |
1562 gfx::Size(20, 12), GL_CLAMP_TO_EDGE, | 1562 gfx::Size(20, 12), GL_CLAMP_TO_EDGE, |
1563 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 1563 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
1564 resource_provider_->best_texture_format()); | 1564 resource_provider_->best_texture_format()); |
1565 resource_provider_->AllocateForTesting(mask); | 1565 resource_provider_->AllocateForTesting(mask); |
1566 | 1566 |
1567 SkScalar matrix[20]; | 1567 SkScalar matrix[20]; |
1568 float amount = 0.5f; | 1568 float amount = 0.5f; |
1569 matrix[0] = 0.213f + 0.787f * amount; | 1569 matrix[0] = 0.213f + 0.787f * amount; |
1570 matrix[1] = 0.715f - 0.715f * amount; | 1570 matrix[1] = 0.715f - 0.715f * amount; |
1571 matrix[2] = 1.f - (matrix[0] + matrix[1]); | 1571 matrix[2] = 1.f - (matrix[0] + matrix[1]); |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2162 root_pass->has_transparent_background = false; | 2162 root_pass->has_transparent_background = false; |
2163 root_pass->copy_requests.push_back( | 2163 root_pass->copy_requests.push_back( |
2164 CopyOutputRequest::CreateRequest(base::Bind(&IgnoreCopyResult))); | 2164 CopyOutputRequest::CreateRequest(base::Bind(&IgnoreCopyResult))); |
2165 | 2165 |
2166 unsigned sync_point = 0; | 2166 unsigned sync_point = 0; |
2167 TextureMailbox mailbox = | 2167 TextureMailbox mailbox = |
2168 TextureMailbox(gpu::Mailbox::Generate(), GL_TEXTURE_2D, sync_point); | 2168 TextureMailbox(gpu::Mailbox::Generate(), GL_TEXTURE_2D, sync_point); |
2169 mailbox.set_allow_overlay(true); | 2169 mailbox.set_allow_overlay(true); |
2170 scoped_ptr<SingleReleaseCallbackImpl> release_callback = | 2170 scoped_ptr<SingleReleaseCallbackImpl> release_callback = |
2171 SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); | 2171 SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); |
2172 ResourceProvider::ResourceId resource_id = | 2172 ResourceId resource_id = resource_provider->CreateResourceFromTextureMailbox( |
2173 resource_provider->CreateResourceFromTextureMailbox( | 2173 mailbox, release_callback.Pass()); |
2174 mailbox, release_callback.Pass()); | |
2175 bool premultiplied_alpha = false; | 2174 bool premultiplied_alpha = false; |
2176 bool flipped = false; | 2175 bool flipped = false; |
2177 bool nearest_neighbor = false; | 2176 bool nearest_neighbor = false; |
2178 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 2177 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
2179 | 2178 |
2180 TextureDrawQuad* overlay_quad = | 2179 TextureDrawQuad* overlay_quad = |
2181 root_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 2180 root_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
2182 overlay_quad->SetNew(root_pass->CreateAndAppendSharedQuadState(), | 2181 overlay_quad->SetNew(root_pass->CreateAndAppendSharedQuadState(), |
2183 viewport_rect, viewport_rect, viewport_rect, resource_id, | 2182 viewport_rect, viewport_rect, viewport_rect, resource_id, |
2184 premultiplied_alpha, gfx::PointF(0, 0), | 2183 premultiplied_alpha, gfx::PointF(0, 0), |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2289 AddRenderPass(&render_passes_in_draw_order_, RenderPassId(1, 0), | 2288 AddRenderPass(&render_passes_in_draw_order_, RenderPassId(1, 0), |
2290 viewport_rect, gfx::Transform()); | 2289 viewport_rect, gfx::Transform()); |
2291 root_pass->has_transparent_background = false; | 2290 root_pass->has_transparent_background = false; |
2292 | 2291 |
2293 unsigned sync_point = TestRenderPass::kSyncPointForMailboxTextureQuad; | 2292 unsigned sync_point = TestRenderPass::kSyncPointForMailboxTextureQuad; |
2294 TextureMailbox mailbox = | 2293 TextureMailbox mailbox = |
2295 TextureMailbox(gpu::Mailbox::Generate(), GL_TEXTURE_2D, sync_point); | 2294 TextureMailbox(gpu::Mailbox::Generate(), GL_TEXTURE_2D, sync_point); |
2296 mailbox.set_allow_overlay(true); | 2295 mailbox.set_allow_overlay(true); |
2297 scoped_ptr<SingleReleaseCallbackImpl> release_callback = | 2296 scoped_ptr<SingleReleaseCallbackImpl> release_callback = |
2298 SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); | 2297 SingleReleaseCallbackImpl::Create(base::Bind(&MailboxReleased)); |
2299 ResourceProvider::ResourceId resource_id = | 2298 ResourceId resource_id = resource_provider->CreateResourceFromTextureMailbox( |
2300 resource_provider->CreateResourceFromTextureMailbox( | 2299 mailbox, release_callback.Pass()); |
2301 mailbox, release_callback.Pass()); | |
2302 bool premultiplied_alpha = false; | 2300 bool premultiplied_alpha = false; |
2303 bool flipped = false; | 2301 bool flipped = false; |
2304 bool nearest_neighbor = false; | 2302 bool nearest_neighbor = false; |
2305 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 2303 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
2306 gfx::PointF uv_top_left(0, 0); | 2304 gfx::PointF uv_top_left(0, 0); |
2307 gfx::PointF uv_bottom_right(1, 1); | 2305 gfx::PointF uv_bottom_right(1, 1); |
2308 | 2306 |
2309 TextureDrawQuad* overlay_quad = | 2307 TextureDrawQuad* overlay_quad = |
2310 root_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 2308 root_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
2311 SharedQuadState* shared_state = root_pass->CreateAndAppendSharedQuadState(); | 2309 SharedQuadState* shared_state = root_pass->CreateAndAppendSharedQuadState(); |
(...skipping 12 matching lines...) Expand all Loading... |
2324 EXPECT_CALL(overlay_scheduler, | 2322 EXPECT_CALL(overlay_scheduler, |
2325 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, viewport_rect, | 2323 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, viewport_rect, |
2326 BoundingRect(uv_top_left, uv_bottom_right))).Times(1); | 2324 BoundingRect(uv_top_left, uv_bottom_right))).Times(1); |
2327 | 2325 |
2328 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, | 2326 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, |
2329 viewport_rect, false); | 2327 viewport_rect, false); |
2330 } | 2328 } |
2331 | 2329 |
2332 } // namespace | 2330 } // namespace |
2333 } // namespace cc | 2331 } // namespace cc |
OLD | NEW |