Closed Bug 1253504 Opened 9 years ago Closed 9 years ago

CanvasRenderingContext2d.drawImage() will add shadows if the shadow properties are set. (as intended)

Categories

(Core :: Graphics: Canvas2D, defect)

44 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: jamie.pate, Unassigned)

Details

(Whiteboard: [gfx-noted])

Attachments

(3 files)

Attached image doubledropshadow2.png
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36 Steps to reproduce: 1. create 2 canvases 2. draw text with a shadow on A, then call clearRect() to clear the entire canvas. (Canvas A is actually 100% clear at this point) 3. draw text with shadow on B, then call A.drawImage(B); Actual results: Image on canvas A has approximately 1/2 the value it should for the text shadow's alpha channel. Canvas A and canvas B do NOT match. Expected results: Images on both canvases should have the same alpha. Canvas A and B should have identical images.
Test case that reproduces the issue. Code is extracted from the labelEditor component at http://www.stoneycreekwinepress.com/wine-labels/What's_New/Photo_Heart_-_Large_Vertical Initially I thought that firefox did not exhibit this bug, but it was just fast enough that it didn't trigger the slow "don't block the UI" codepath with many window.setTimeout() calls between draws to the same canvas. A bug has been reported for chromium as well: https://bugs.chromium.org/p/chromium/issues/detail?id=591644
Component: Untriaged → Canvas: 2D
Is step #2 above required to reproduce the problem?
Flags: needinfo?(jamie.pate)
Whiteboard: [gfx-noted]
Ok, so no, step 2 is not required, all that's required is to have the context's shadow properties set on both canvases. Please see my (GREATLY!) reduced test case *testcase_doublealpha3.html*
Flags: needinfo?(jamie.pate)
Greatly reduced test case.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
Summary: Alpha channel halved when calling CanvasRenderingContext2d clearRect(), drawImage(HTMLCanvasElement) → CanvasRenderingContext2d.drawImage() will add shadows if the shadow properties are set. (as intended)
It took me so long to reduce the testcase to a manageable set of code, I never realized that the shadow* properties are *not* exclusive to the fillText() etc methods, and need to be unset for the expected results.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: