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/trace_event/trace_event.h" | 7 #include "base/trace_event/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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 DCHECK(!output_surface_->HasExternalStencilTest()); | 153 DCHECK(!output_surface_->HasExternalStencilTest()); |
154 current_framebuffer_lock_ = nullptr; | 154 current_framebuffer_lock_ = nullptr; |
155 current_framebuffer_canvas_.clear(); | 155 current_framebuffer_canvas_.clear(); |
156 current_canvas_ = root_canvas_; | 156 current_canvas_ = root_canvas_; |
157 } | 157 } |
158 | 158 |
159 bool SoftwareRenderer::BindFramebufferToTexture( | 159 bool SoftwareRenderer::BindFramebufferToTexture( |
160 DrawingFrame* frame, | 160 DrawingFrame* frame, |
161 const ScopedResource* texture, | 161 const ScopedResource* texture, |
162 const gfx::Rect& target_rect) { | 162 const gfx::Rect& target_rect) { |
| 163 DCHECK(texture->id()); |
| 164 |
| 165 // Explicitly release lock, otherwise we can crash when try to lock |
| 166 // same texture again. |
| 167 current_framebuffer_lock_ = nullptr; |
163 current_framebuffer_lock_ = make_scoped_ptr( | 168 current_framebuffer_lock_ = make_scoped_ptr( |
164 new ResourceProvider::ScopedWriteLockSoftware( | 169 new ResourceProvider::ScopedWriteLockSoftware( |
165 resource_provider_, texture->id())); | 170 resource_provider_, texture->id())); |
166 current_framebuffer_canvas_ = | 171 current_framebuffer_canvas_ = |
167 skia::AdoptRef(new SkCanvas(current_framebuffer_lock_->sk_bitmap())); | 172 skia::AdoptRef(new SkCanvas(current_framebuffer_lock_->sk_bitmap())); |
168 current_canvas_ = current_framebuffer_canvas_.get(); | 173 current_canvas_ = current_framebuffer_canvas_.get(); |
169 InitializeViewport(frame, | 174 InitializeViewport(frame, |
170 target_rect, | 175 target_rect, |
171 gfx::Rect(target_rect.size()), | 176 gfx::Rect(target_rect.size()), |
172 target_rect.size()); | 177 target_rect.size()); |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 } | 612 } |
608 | 613 |
609 void SoftwareRenderer::DidChangeVisibility() { | 614 void SoftwareRenderer::DidChangeVisibility() { |
610 if (visible()) | 615 if (visible()) |
611 EnsureBackbuffer(); | 616 EnsureBackbuffer(); |
612 else | 617 else |
613 DiscardBackbuffer(); | 618 DiscardBackbuffer(); |
614 } | 619 } |
615 | 620 |
616 } // namespace cc | 621 } // namespace cc |
OLD | NEW |