[Webkit-unassigned] [Bug 194746] drawImage does not work correctly when source and destination have overlap

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 18 09:28:44 PST 2019


https://bugs.webkit.org/show_bug.cgi?id=194746

--- Comment #2 from Said Abou-Hallawa <sabouhallawa at apple.com> ---
Looking at the test case:

The bug happens because of this setting:
    ctx.globalCompositeOperation = "copy";

Looking at the source code of CanvasRenderingContext2DBase::drawImage() and when 

if (state().globalComposite == CompositeCopy) {
    clearCanvas();
    c->drawImageBuffer(*buffer, dstRect, srcRect, ImagePaintingOptions(state().globalComposite, state().globalBlend));
    didDrawEntireCanvas();
}

Calling clearCanvas() will clear the entire canvas rectangle. Because the test case clips to the destination rect(64, 64, 128, 128), clearCanvas() will only clear this rectangle. But this destination rectangle overlaps the source rectangle rect(0, 0, 128, 128). So the intersection rectangle (64, 64, 128, 128) is also cleared from the source rectangle. And this is why a white rectangle in the middle of the cnavas is drawn.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190218/fd018615/attachment.html>


More information about the webkit-unassigned mailing list