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

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

Issue 609663003: cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cc-passas: PassAs-presubmit-warning Created 6 years, 2 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/renderer_unittest.cc ('k') | cc/output/software_renderer_unittest.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 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/software_renderer.h" 5 #include "cc/output/software_renderer.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/compositor_frame_ack.h" 10 #include "cc/output/compositor_frame_ack.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) { 102 void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) {
103 TRACE_EVENT0("cc", "SoftwareRenderer::BeginDrawingFrame"); 103 TRACE_EVENT0("cc", "SoftwareRenderer::BeginDrawingFrame");
104 root_canvas_ = output_device_->BeginPaint( 104 root_canvas_ = output_device_->BeginPaint(
105 gfx::ToEnclosingRect(frame->root_damage_rect)); 105 gfx::ToEnclosingRect(frame->root_damage_rect));
106 } 106 }
107 107
108 void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) { 108 void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) {
109 TRACE_EVENT0("cc", "SoftwareRenderer::FinishDrawingFrame"); 109 TRACE_EVENT0("cc", "SoftwareRenderer::FinishDrawingFrame");
110 current_framebuffer_lock_.reset(); 110 current_framebuffer_lock_ = nullptr;
111 current_canvas_ = NULL; 111 current_canvas_ = NULL;
112 root_canvas_ = NULL; 112 root_canvas_ = NULL;
113 113
114 current_frame_data_.reset(new SoftwareFrameData); 114 current_frame_data_.reset(new SoftwareFrameData);
115 output_device_->EndPaint(current_frame_data_.get()); 115 output_device_->EndPaint(current_frame_data_.get());
116 } 116 }
117 117
118 void SoftwareRenderer::SwapBuffers(const CompositorFrameMetadata& metadata) { 118 void SoftwareRenderer::SwapBuffers(const CompositorFrameMetadata& metadata) {
119 TRACE_EVENT0("cc,benchmark", "SoftwareRenderer::SwapBuffers"); 119 TRACE_EVENT0("cc,benchmark", "SoftwareRenderer::SwapBuffers");
120 CompositorFrame compositor_frame; 120 CompositorFrame compositor_frame;
(...skipping 22 matching lines...) Expand all
143 // the viewport's dimensions. 143 // the viewport's dimensions.
144 is_scissor_enabled_ = false; 144 is_scissor_enabled_ = false;
145 SkISize size = current_canvas_->getDeviceSize(); 145 SkISize size = current_canvas_->getDeviceSize();
146 SetClipRect(gfx::Rect(size.width(), size.height())); 146 SetClipRect(gfx::Rect(size.width(), size.height()));
147 } 147 }
148 148
149 void SoftwareRenderer::Finish() {} 149 void SoftwareRenderer::Finish() {}
150 150
151 void SoftwareRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) { 151 void SoftwareRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) {
152 DCHECK(!output_surface_->HasExternalStencilTest()); 152 DCHECK(!output_surface_->HasExternalStencilTest());
153 current_framebuffer_lock_.reset(); 153 current_framebuffer_lock_ = nullptr;
154 current_canvas_ = root_canvas_; 154 current_canvas_ = root_canvas_;
155 } 155 }
156 156
157 bool SoftwareRenderer::BindFramebufferToTexture( 157 bool SoftwareRenderer::BindFramebufferToTexture(
158 DrawingFrame* frame, 158 DrawingFrame* frame,
159 const ScopedResource* texture, 159 const ScopedResource* texture,
160 const gfx::Rect& target_rect) { 160 const gfx::Rect& target_rect) {
161 current_framebuffer_lock_.reset();
162 current_framebuffer_lock_ = make_scoped_ptr( 161 current_framebuffer_lock_ = make_scoped_ptr(
163 new ResourceProvider::ScopedWriteLockSoftware( 162 new ResourceProvider::ScopedWriteLockSoftware(
164 resource_provider_, texture->id())); 163 resource_provider_, texture->id()));
165 current_canvas_ = current_framebuffer_lock_->sk_canvas(); 164 current_canvas_ = current_framebuffer_lock_->sk_canvas();
166 InitializeViewport(frame, 165 InitializeViewport(frame,
167 target_rect, 166 target_rect,
168 gfx::Rect(target_rect.size()), 167 gfx::Rect(target_rect.size()),
169 target_rect.size()); 168 target_rect.size());
170 return true; 169 return true;
171 } 170 }
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 } 598 }
600 599
601 void SoftwareRenderer::DidChangeVisibility() { 600 void SoftwareRenderer::DidChangeVisibility() {
602 if (visible()) 601 if (visible())
603 EnsureBackbuffer(); 602 EnsureBackbuffer();
604 else 603 else
605 DiscardBackbuffer(); 604 DiscardBackbuffer();
606 } 605 }
607 606
608 } // namespace cc 607 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/renderer_unittest.cc ('k') | cc/output/software_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698