From 8e69e3dcea8b3757ff11f15eb91c1ac303f7ad29 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 23 Jun 2017 18:37:49 -0400 Subject: [PATCH] Windows/macOS: Fix incorrect clear of buffer during software rendering (issue #2197) --- patch/patch.cfg | 5 +++++ patch/patches/software_renderer_729363.patch | 22 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 patch/patches/software_renderer_729363.patch diff --git a/patch/patch.cfg b/patch/patch.cfg index 6e4d9e8ff..032974750 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -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', + }, ] diff --git a/patch/patches/software_renderer_729363.patch b/patch/patches/software_renderer_729363.patch new file mode 100644 index 000000000..1526ec85a --- /dev/null +++ b/patch/patches/software_renderer_729363.patch @@ -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() {