| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 quad_rect, | 465 quad_rect, |
| 466 ¤t_paint_); | 466 ¤t_paint_); |
| 467 } | 467 } |
| 468 | 468 |
| 469 if (needs_layer) | 469 if (needs_layer) |
| 470 current_canvas_->restore(); | 470 current_canvas_->restore(); |
| 471 } | 471 } |
| 472 | 472 |
| 473 void SoftwareRenderer::DrawTileQuad(const DrawingFrame* frame, | 473 void SoftwareRenderer::DrawTileQuad(const DrawingFrame* frame, |
| 474 const TileDrawQuad* quad) { | 474 const TileDrawQuad* quad) { |
| 475 DCHECK(!output_surface_->ForcedDrawToSoftwareDevice()); | 475 // |resource_provider_| can be NULL in resourceless software draws, which |
| 476 // should never produce tile quads in the first place. |
| 477 DCHECK(resource_provider_); |
| 476 DCHECK(IsSoftwareResource(quad->resource_id)); | 478 DCHECK(IsSoftwareResource(quad->resource_id)); |
| 477 | 479 |
| 478 ResourceProvider::ScopedReadLockSoftware lock(resource_provider_, | 480 ResourceProvider::ScopedReadLockSoftware lock(resource_provider_, |
| 479 quad->resource_id); | 481 quad->resource_id); |
| 480 if (!lock.valid()) | 482 if (!lock.valid()) |
| 481 return; | 483 return; |
| 482 DCHECK_EQ(GL_CLAMP_TO_EDGE, lock.wrap_mode()); | 484 DCHECK_EQ(GL_CLAMP_TO_EDGE, lock.wrap_mode()); |
| 483 | 485 |
| 484 gfx::RectF visible_tex_coord_rect = MathUtil::ScaleRectProportional( | 486 gfx::RectF visible_tex_coord_rect = MathUtil::ScaleRectProportional( |
| 485 quad->tex_coord_rect, quad->rect, quad->visible_rect); | 487 quad->tex_coord_rect, quad->rect, quad->visible_rect); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 } | 646 } |
| 645 | 647 |
| 646 void SoftwareRenderer::DidChangeVisibility() { | 648 void SoftwareRenderer::DidChangeVisibility() { |
| 647 if (visible()) | 649 if (visible()) |
| 648 EnsureBackbuffer(); | 650 EnsureBackbuffer(); |
| 649 else | 651 else |
| 650 DiscardBackbuffer(); | 652 DiscardBackbuffer(); |
| 651 } | 653 } |
| 652 | 654 |
| 653 } // namespace cc | 655 } // namespace cc |
| OLD | NEW |