| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 void SoftwareRenderer::SetScissorTestRect(const gfx::Rect& scissor_rect) { | 176 void SoftwareRenderer::SetScissorTestRect(const gfx::Rect& scissor_rect) { |
| 177 is_scissor_enabled_ = true; | 177 is_scissor_enabled_ = true; |
| 178 scissor_rect_ = scissor_rect; | 178 scissor_rect_ = scissor_rect; |
| 179 SetClipRect(scissor_rect); | 179 SetClipRect(scissor_rect); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void SoftwareRenderer::SetClipRect(const gfx::Rect& rect) { | 182 void SoftwareRenderer::SetClipRect(const gfx::Rect& rect) { |
| 183 // Skia applies the current matrix to clip rects so we reset it temporary. | 183 // Skia applies the current matrix to clip rects so we reset it temporary. |
| 184 SkMatrix current_matrix = current_canvas_->getTotalMatrix(); | 184 SkMatrix current_matrix = current_canvas_->getTotalMatrix(); |
| 185 current_canvas_->resetMatrix(); | 185 current_canvas_->resetMatrix(); |
| 186 current_canvas_->clipRect(gfx::RectToSkRect(rect), SkRegion::kReplace_Op); | 186 current_canvas_->legacyClipRect(gfx::RectToSkRect(rect), |
| 187 SkRegion::kReplace_Op); |
| 187 current_canvas_->setMatrix(current_matrix); | 188 current_canvas_->setMatrix(current_matrix); |
| 188 } | 189 } |
| 189 | 190 |
| 190 void SoftwareRenderer::ClearCanvas(SkColor color) { | 191 void SoftwareRenderer::ClearCanvas(SkColor color) { |
| 191 // SkCanvas::clear doesn't respect the current clipping region | 192 // SkCanvas::clear doesn't respect the current clipping region |
| 192 // so we SkCanvas::drawColor instead if scissoring is active. | 193 // so we SkCanvas::drawColor instead if scissoring is active. |
| 193 if (is_scissor_enabled_) | 194 if (is_scissor_enabled_) |
| 194 current_canvas_->drawColor(color, SkXfermode::kSrc_Mode); | 195 current_canvas_->drawColor(color, SkXfermode::kSrc_Mode); |
| 195 else | 196 else |
| 196 current_canvas_->clear(color); | 197 current_canvas_->clear(color); |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 } | 608 } |
| 608 | 609 |
| 609 void SoftwareRenderer::DidChangeVisibility() { | 610 void SoftwareRenderer::DidChangeVisibility() { |
| 610 if (visible()) | 611 if (visible()) |
| 611 EnsureBackbuffer(); | 612 EnsureBackbuffer(); |
| 612 else | 613 else |
| 613 DiscardBackbuffer(); | 614 DiscardBackbuffer(); |
| 614 } | 615 } |
| 615 | 616 |
| 616 } // namespace cc | 617 } // namespace cc |
| OLD | NEW |