OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 } | 870 } |
871 | 871 |
872 *unclipped_rect = backdrop_rect; | 872 *unclipped_rect = backdrop_rect; |
873 backdrop_rect.Intersect(MoveFromDrawToWindowSpace( | 873 backdrop_rect.Intersect(MoveFromDrawToWindowSpace( |
874 current_frame()->current_render_pass->output_rect)); | 874 current_frame()->current_render_pass->output_rect)); |
875 return backdrop_rect; | 875 return backdrop_rect; |
876 } | 876 } |
877 | 877 |
878 std::unique_ptr<ScopedResource> GLRenderer::GetBackdropTexture( | 878 std::unique_ptr<ScopedResource> GLRenderer::GetBackdropTexture( |
879 const gfx::Rect& bounding_rect) { | 879 const gfx::Rect& bounding_rect) { |
880 std::unique_ptr<ScopedResource> device_background_texture = | 880 auto device_background_texture = |
881 ScopedResource::Create(resource_provider_); | 881 base::MakeUnique<ScopedResource>(resource_provider_); |
882 // CopyTexImage2D fails when called on a texture having immutable storage. | 882 // CopyTexImage2D fails when called on a texture having immutable storage. |
883 device_background_texture->Allocate( | 883 device_background_texture->Allocate( |
884 bounding_rect.size(), ResourceProvider::TEXTURE_HINT_DEFAULT, | 884 bounding_rect.size(), ResourceProvider::TEXTURE_HINT_DEFAULT, |
885 BackbufferFormat(), current_frame()->current_render_pass->color_space); | 885 BackbufferFormat(), current_frame()->current_render_pass->color_space); |
886 { | 886 { |
887 ResourceProvider::ScopedWriteLockGL lock( | 887 ResourceProvider::ScopedWriteLockGL lock( |
888 resource_provider_, device_background_texture->id(), false); | 888 resource_provider_, device_background_texture->id(), false); |
889 GetFramebufferTexture(lock.texture_id(), bounding_rect); | 889 GetFramebufferTexture(lock.texture_id(), bounding_rect); |
890 } | 890 } |
891 return device_background_texture; | 891 return device_background_texture; |
(...skipping 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3527 return; | 3527 return; |
3528 | 3528 |
3529 // Report GPU overdraw as a percentage of |max_result|. | 3529 // Report GPU overdraw as a percentage of |max_result|. |
3530 TRACE_COUNTER1( | 3530 TRACE_COUNTER1( |
3531 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", | 3531 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", |
3532 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / | 3532 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / |
3533 max_result); | 3533 max_result); |
3534 } | 3534 } |
3535 | 3535 |
3536 } // namespace cc | 3536 } // namespace cc |
OLD | NEW |