Closed
Bug 295302
Opened 20 years ago
Closed 20 years ago
[FIX,crash] Canvas drawImage (9-argument) method renders incorrectly
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: firefox, Assigned: vlad)
References
()
Details
Attachments
(1 file)
3.31 KB,
patch
|
pavlov
:
review+
chofmann
:
approval-aviary1.1a1+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3 http://www.whatwg.org/specs/web-apps/current-work/#images The 9-argument variant of drawImage() specifies 8 coordinates. When used, the output is not what you'd expect. Some cursory analysis of the Canvas/Cairo code seems to point to an incorrect matrix being set up. The dx/dy/dh/dw seem to be affected by the sx/sy/sh/sw arguments. My test case was a rudimentary Doom-style renderer using vertical scanlines, rendering one drawImage per horizontal pixel for the walls. Reproducible: Always Steps to Reproduce: 1. create a 256x256 JPG image and a test page with canvas element 2. ... 3. ctx.drawImage( img, 64, 64, 128, 128, 16, 16, 32, 32 ); Actual Results: Borked render, random color fringing, incorrect pixels written to. Expected Results: Should render the center 128x128 pixel section of the image to the canvas @ 16, 16 and 32x32.
Reporter | ||
Updated•20 years ago
|
Alias: drawImage
Reporter | ||
Comment 1•20 years ago
|
||
Created test case: http://akiba.shaderlab.com/test/canvas-bug.html User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050524 Firefox/1.0+
Assignee | ||
Comment 3•20 years ago
|
||
This fixes the crash (gfx was lying to us about the image format), and also fixes the functionality. It's probably entirely too late to get this in to 1.8b2, but if at all possible, it should be a low-risk crash fix patch.
Assignee: nobody → vladimir
Status: UNCONFIRMED → ASSIGNED
Attachment #184782 -
Flags: review?(pavlov)
Assignee | ||
Comment 4•20 years ago
|
||
(Forgot to set a?) This fixes the crash (gfx was lying to us about the image format), and also fixes the functionality. It's probably entirely too late to get this in to 1.8b2, but if at all possible, it should be a low-risk crash fix patch.
Flags: blocking1.8b2?
Summary: Canvas drawImage (9-argument) method renders incorrectly → [FIX,crash] Canvas drawImage (9-argument) method renders incorrectly
Comment 5•20 years ago
|
||
Comment on attachment 184782 [details] [diff] [review] 295302-canvas-drawimage.patch I'm not sure how we can have an image that claims to be RGB_A8 with no GetHasAlphaMask.. http://lxr.mozilla.org/seamonkey/source/gfx/src/shared/gfxImageFrame.cpp#110 I'd prefer to figure out where that is going wrong that check in that part of the patch. The rest seems right and I agree with the comment that the scale/transform stuff should be fixed once we move to 0.5.
Assignee | ||
Comment 6•20 years ago
|
||
(In reply to comment #5) > (From update of attachment 184782 [details] [diff] [review] [edit]) > I'm not sure how we can have an image that claims to be RGB_A8 with no > GetHasAlphaMask.. > http://lxr.mozilla.org/seamonkey/source/gfx/src/shared/gfxImageFrame.cpp#110 From stepping through it, it looks like nsImageGTK::Optimize/UpdateCachedImage checks if the image has an all-opaque alpha, and if so, it just tosses it out. Maybe it should also change its format at the same time?
Comment 7•20 years ago
|
||
Comment on attachment 184782 [details] [diff] [review] 295302-canvas-drawimage.patch Change the comment about the GetHasAlphaMask() to reflect that the GTK image stuff sucks.
Attachment #184782 -
Flags: review?(pavlov) → review+
Comment 8•20 years ago
|
||
Comment on attachment 184782 [details] [diff] [review] 295302-canvas-drawimage.patch a=chofmann for quick landing in a1
Attachment #184782 -
Flags: approval-aviary1.1a1+
Assignee | ||
Comment 9•20 years ago
|
||
Checked in, thanks!
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Flags: blocking1.8b2?
Resolution: --- → FIXED
Updated•7 months ago
|
Alias: drawImage
You need to log in
before you can comment on or make changes to this bug.
Description
•