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/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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 bool SoftwareRenderer::BindFramebufferToTexture( | 145 bool SoftwareRenderer::BindFramebufferToTexture( |
146 DrawingFrame* frame, | 146 DrawingFrame* frame, |
147 const ScopedResource* texture, | 147 const ScopedResource* texture, |
148 gfx::Rect framebuffer_rect) { | 148 gfx::Rect framebuffer_rect) { |
149 current_framebuffer_lock_.reset(); | 149 current_framebuffer_lock_.reset(); |
150 current_framebuffer_lock_ = make_scoped_ptr( | 150 current_framebuffer_lock_ = make_scoped_ptr( |
151 new ResourceProvider::ScopedWriteLockSoftware( | 151 new ResourceProvider::ScopedWriteLockSoftware( |
152 resource_provider_, texture->id())); | 152 resource_provider_, texture->id())); |
153 current_canvas_ = current_framebuffer_lock_->sk_canvas(); | 153 current_canvas_ = current_framebuffer_lock_->sk_canvas(); |
154 InitializeMatrices(frame, framebuffer_rect, false); | 154 InitializeMatrices(frame, gfx::Vector2d(), framebuffer_rect, false); |
155 SetDrawViewportSize(framebuffer_rect.size()); | 155 SetDrawViewport(gfx::Rect(framebuffer_rect.size())); |
156 | 156 |
157 return true; | 157 return true; |
158 } | 158 } |
159 | 159 |
160 void SoftwareRenderer::SetScissorTestRect(gfx::Rect scissor_rect) { | 160 void SoftwareRenderer::SetScissorTestRect(gfx::Rect scissor_rect) { |
161 is_scissor_enabled_ = true; | 161 is_scissor_enabled_ = true; |
162 scissor_rect_ = scissor_rect; | 162 scissor_rect_ = scissor_rect; |
163 SetClipRect(scissor_rect); | 163 SetClipRect(scissor_rect); |
164 } | 164 } |
165 | 165 |
(...skipping 19 matching lines...) Expand all Loading... |
185 ClearCanvas(SkColorSetARGB(0, 0, 0, 0)); | 185 ClearCanvas(SkColorSetARGB(0, 0, 0, 0)); |
186 } else { | 186 } else { |
187 #ifndef NDEBUG | 187 #ifndef NDEBUG |
188 // On DEBUG builds, opaque render passes are cleared to blue | 188 // On DEBUG builds, opaque render passes are cleared to blue |
189 // to easily see regions that were not drawn on the screen. | 189 // to easily see regions that were not drawn on the screen. |
190 ClearCanvas(SkColorSetARGB(255, 0, 0, 255)); | 190 ClearCanvas(SkColorSetARGB(255, 0, 0, 255)); |
191 #endif | 191 #endif |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 void SoftwareRenderer::SetDrawViewportSize(gfx::Size viewport_size) {} | 195 void SoftwareRenderer::SetDrawViewport(gfx::Rect viewport) {} |
196 | 196 |
197 bool SoftwareRenderer::IsSoftwareResource( | 197 bool SoftwareRenderer::IsSoftwareResource( |
198 ResourceProvider::ResourceId resource_id) const { | 198 ResourceProvider::ResourceId resource_id) const { |
199 switch (resource_provider_->GetResourceType(resource_id)) { | 199 switch (resource_provider_->GetResourceType(resource_id)) { |
200 case ResourceProvider::GLTexture: | 200 case ResourceProvider::GLTexture: |
201 return false; | 201 return false; |
202 case ResourceProvider::Bitmap: | 202 case ResourceProvider::Bitmap: |
203 return true; | 203 return true; |
204 } | 204 } |
205 | 205 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 4 * rect.width()); | 456 4 * rect.width()); |
457 } | 457 } |
458 | 458 |
459 void SoftwareRenderer::SetVisible(bool visible) { | 459 void SoftwareRenderer::SetVisible(bool visible) { |
460 if (visible_ == visible) | 460 if (visible_ == visible) |
461 return; | 461 return; |
462 visible_ = visible; | 462 visible_ = visible; |
463 } | 463 } |
464 | 464 |
465 } // namespace cc | 465 } // namespace cc |
OLD | NEW |