Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
REGRESSION(r289580): Canvas: putImageData sometimes draws nothing
https://bugs.webkit.org/show_bug.cgi?id=240802 rdar://93801722 Reviewed by Simon Fraser. RemoteImageBufferProxy::putPixelBuffer() needs to setNeedsFlush(true) once the request to change the backend is sent to GPUProcess. If WebProcess has access to the ImageBufferBackend, flushDrawingContext() will be called from copyNativeImage(). This call has to wait all DisplayList items and PutPixelBuffer messages to be flushed to the backend before copyNativeImage() copies the pixels of the backend to a NativeImage. * Source/WebCore/platform/graphics/ImageBuffer.h: (WebCore::ImageBuffer::setNeedsFlush): * Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h: (WebKit::RemoteDisplayListRecorderProxy::send): (WebKit::RemoteDisplayListRecorderProxy::resetNeedsFlush): Deleted. (WebKit::RemoteDisplayListRecorderProxy::needsFlush const): Deleted. (): Deleted. * Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h: (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): Canonical link: https://commits.webkit.org/251039@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294928 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
9 changed files
with
89 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,13 @@ | ||
<body> | ||
<canvas id="target" width="400" height="400"></canvas> | ||
<script> | ||
const targetCanvas = document.getElementById('target'); | ||
const target = targetCanvas.getContext('2d'); | ||
|
||
const canvasWidth = targetCanvas.width; | ||
const canvasHeight = targetCanvas.height | ||
|
||
target.fillStyle = 'green'; | ||
target.fillRect(0, 0, canvasWidth, canvasHeight); | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,50 @@ | ||
<body> | ||
<canvas id="target" width="400" height="400"></canvas> | ||
<script> | ||
const targetCanvas = document.getElementById('target'); | ||
const target = targetCanvas.getContext('2d'); | ||
|
||
const canvasWidth = targetCanvas.width; | ||
const canvasHeight = targetCanvas.height | ||
|
||
var sourceCanvas = document.createElement('canvas'); | ||
sourceCanvas.width = canvasWidth; | ||
sourceCanvas.height = canvasHeight; | ||
|
||
const source = sourceCanvas.getContext('2d'); | ||
|
||
let progressX = 0; | ||
let progressY = 0; | ||
const paintSize = 100; | ||
|
||
source.fillStyle = 'green'; | ||
source.fillRect(0, 0, canvasWidth, canvasHeight); | ||
const imagedata = source.getImageData(0, 0, canvasWidth, canvasHeight); | ||
|
||
function drawLoop() { | ||
target.putImageData(imagedata, 0, 0, progressX, progressY, paintSize, paintSize); | ||
|
||
progressX += paintSize; | ||
|
||
if (progressX + paintSize <= canvasWidth) { | ||
requestAnimationFrame(drawLoop); | ||
return; | ||
} | ||
|
||
if (progressY + paintSize > canvasHeight) { | ||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
return; | ||
} | ||
|
||
progressX = 0; | ||
progressY += paintSize; | ||
requestAnimationFrame(drawLoop); | ||
} | ||
|
||
if (window.testRunner) | ||
testRunner.waitUntilDone(); | ||
|
||
requestAnimationFrame(drawLoop); | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters