Commit 3d27db20 authored by Nathan Zabriskie's avatar Nathan Zabriskie Committed by Commit Bot

Ensure shared images are cleared in OOPR mode

Currently, shared images in OOPR mode are cleared only during
BeginRasterCHROMIUM. This can present some issues when an application
triggers a readback of the image before it has been drawn to. This CL
changes CanvasResourceProvider::Clear to also support OOPR mode to
allow for shared images to be cleared when they're created.

Bug: 1023281, 1023259
Change-Id: Ia6bc76efd65156b14a430f7db197868628385325
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2388434Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Commit-Queue: Nathan Zabriskie <nazabris@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#809495}
parent 941baa74
...@@ -1338,12 +1338,6 @@ bool CanvasResourceProvider::WritePixels(const SkImageInfo& orig_info, ...@@ -1338,12 +1338,6 @@ bool CanvasResourceProvider::WritePixels(const SkImageInfo& orig_info,
} }
void CanvasResourceProvider::Clear() { void CanvasResourceProvider::Clear() {
// We don't have an SkCanvas in OOPR mode so we can't do the clear below, plus
// OOPR already clears the canvas in BeginRaster.
if (UseOopRasterization()) {
return;
}
// Clear the background transparent or opaque, as required. This should only // Clear the background transparent or opaque, as required. This should only
// be called when a new resource provider is created to ensure that we're // be called when a new resource provider is created to ensure that we're
// not leaking data or displaying bad pixels (in the case of kOpaque // not leaking data or displaying bad pixels (in the case of kOpaque
...@@ -1352,9 +1346,11 @@ void CanvasResourceProvider::Clear() { ...@@ -1352,9 +1346,11 @@ void CanvasResourceProvider::Clear() {
// printing operations. See crbug.com/1003114 // printing operations. See crbug.com/1003114
DCHECK(IsValid()); DCHECK(IsValid());
if (color_params_.GetOpacityMode() == kOpaque) if (color_params_.GetOpacityMode() == kOpaque)
GetSkSurface()->getCanvas()->clear(SK_ColorBLACK); Canvas()->clear(SK_ColorBLACK);
else else
GetSkSurface()->getCanvas()->clear(SK_ColorTRANSPARENT); Canvas()->clear(SK_ColorTRANSPARENT);
FlushCanvas();
} }
uint32_t CanvasResourceProvider::ContentUniqueID() const { uint32_t CanvasResourceProvider::ContentUniqueID() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment