Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: cc/output/gl_renderer.cc

Issue 2697353003: cc: Make ScopedResource constructor public, use MakeUnique to construct (Closed)
Patch Set: construct: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/direct_renderer.cc ('k') | cc/raster/raster_buffer_provider_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « cc/output/direct_renderer.cc ('k') | cc/raster/raster_buffer_provider_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698