| 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/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/base/render_surface_filters.h" | 10 #include "cc/base/render_surface_filters.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 current_canvas_->imageInfo().width()); | 145 current_canvas_->imageInfo().width()); |
| 146 DCHECK_EQ(current_canvas_->getDeviceClipBounds().height(), | 146 DCHECK_EQ(current_canvas_->getDeviceClipBounds().height(), |
| 147 current_canvas_->imageInfo().height()); | 147 current_canvas_->imageInfo().height()); |
| 148 current_canvas_->clipRect(gfx::RectToSkRect(rect)); | 148 current_canvas_->clipRect(gfx::RectToSkRect(rect)); |
| 149 current_canvas_->setMatrix(current_matrix); | 149 current_canvas_->setMatrix(current_matrix); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void SoftwareRenderer::ClearCanvas(SkColor color) { | 152 void SoftwareRenderer::ClearCanvas(SkColor color) { |
| 153 if (!current_canvas_) | 153 if (!current_canvas_) |
| 154 return; | 154 return; |
| 155 current_canvas_->clear(color); | 155 |
| 156 if (is_scissor_enabled_) { |
| 157 // The same paint used by SkCanvas::clear, but applied to the scissor rect. |
| 158 SkPaint clear_paint; |
| 159 clear_paint.setColor(color); |
| 160 clear_paint.setBlendMode(SkBlendMode::kSrc); |
| 161 current_canvas_->drawRect(gfx::RectToSkRect(scissor_rect_), clear_paint); |
| 162 } else { |
| 163 current_canvas_->clear(color); |
| 164 } |
| 156 } | 165 } |
| 157 | 166 |
| 158 void SoftwareRenderer::ClearFramebuffer() { | 167 void SoftwareRenderer::ClearFramebuffer() { |
| 159 if (current_frame()->current_render_pass->has_transparent_background) { | 168 if (current_frame()->current_render_pass->has_transparent_background) { |
| 160 ClearCanvas(SkColorSetARGB(0, 0, 0, 0)); | 169 ClearCanvas(SkColorSetARGB(0, 0, 0, 0)); |
| 161 } else { | 170 } else { |
| 162 #ifndef NDEBUG | 171 #ifndef NDEBUG |
| 163 // On DEBUG builds, opaque render passes are cleared to blue | 172 // On DEBUG builds, opaque render passes are cleared to blue |
| 164 // to easily see regions that were not drawn on the screen. | 173 // to easily see regions that were not drawn on the screen. |
| 165 ClearCanvas(SkColorSetARGB(255, 0, 0, 255)); | 174 ClearCanvas(SkColorSetARGB(255, 0, 0, 255)); |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); | 730 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); |
| 722 | 731 |
| 723 if (!filter_backdrop_image) | 732 if (!filter_backdrop_image) |
| 724 return nullptr; | 733 return nullptr; |
| 725 | 734 |
| 726 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, | 735 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, |
| 727 &filter_backdrop_transform); | 736 &filter_backdrop_transform); |
| 728 } | 737 } |
| 729 | 738 |
| 730 } // namespace cc | 739 } // namespace cc |
| OLD | NEW |