[Webkit-unassigned] [Bug 67652] Negative width/height values not always treated properly by 2D canvas drawImage

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 2 06:06:56 PDT 2013


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





--- Comment #17 from Rashmi Shyamasundar <rashmi.s2 at samsung.com>  2013-07-02 06:08:53 PST ---
The description at https://bugs.webkit.org/show_bug.cgi?id=67652#c0, given by Mr. Justin Novosad at the time of raising the bug, is not completely correct, with respect to the latest webkit. 

Here is an example to describe this bug :-

Consider the below drawImage call, where "srcImage" can be an image or a canvas or video with width = 60 and height = 60 pixels -

canvas.drawImage(srcImage, -30, 0, 60, 30, 0, 0, 60, 30); // left edge clip

In this case - 
source-rectangle : -30, 0, 60, 30
destination-rectangle : 0, 0, 60, 30

For the source-rectangle :-
x = -30
y = 0
width = 60
height = 30

This is same as the sum of 2 rectangles :-
(-30, 0, 30, 30) + (0, 0, 30, 30)

The first rectangle (-30, 0, 30, 30) has no data to fetch from the source Image/Canvas/Video, since the source Image/Canvas/Video has the dimension - 
(0, 0, 60, 60), where the Width or Height is the width or height of the Image/Canvas/Video.

Hence, the first rectangle should be clipped from the source rectangle and the destination-rectangle should also be clipped in the same proportion.

Applying the functions clipRectangles(), defined in my patch :-

clipRatio = 30/60 = 0.5

Final source-rectangle : (0, 0, 30, 30)
Final destnation-rectangle : (30, 30, 30, 30)

Without my patch, the drawImage fails and it does not draw anything.

Please let me know anything is missing in the above description.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list