Windows/macOS: Fix incorrect clear of buffer during software rendering (issue #2197)

This commit is contained in:
Marshall Greenblatt 2017-06-23 18:37:49 -04:00
parent cb0dfccddc
commit 8e69e3dcea
2 changed files with 27 additions and 0 deletions

View File

@ -308,4 +308,9 @@ patches = [
# https://bitbucket.org/chromiumembedded/cef/issues/2196
'name': 'printing_context_2196',
},
{
# Windows/macOS: Fix incorrect clear of buffer during software rendering.
# https://bugs.chromium.org/p/chromium/issues/detail?id=729363
'name': 'software_renderer_729363',
},
]

View File

@ -0,0 +1,22 @@
diff --git cc/output/software_renderer.cc cc/output/software_renderer.cc
index 34eda97..6fc30a0 100644
--- cc/output/software_renderer.cc
+++ cc/output/software_renderer.cc
@@ -152,7 +152,16 @@ void SoftwareRenderer::SetClipRect(const gfx::Rect& rect) {
void SoftwareRenderer::ClearCanvas(SkColor color) {
if (!current_canvas_)
return;
- current_canvas_->clear(color);
+
+ if (is_scissor_enabled_) {
+ // The same paint used by SkCanvas::clear, but applied to the scissor rect.
+ SkPaint clear_paint;
+ clear_paint.setColor(color);
+ clear_paint.setBlendMode(SkBlendMode::kSrc);
+ current_canvas_->drawRect(gfx::RectToSkRect(scissor_rect_), clear_paint);
+ } else {
+ current_canvas_->clear(color);
+ }
}
void SoftwareRenderer::ClearFramebuffer() {