Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply globalAlpha on the canvas filter source
The previous specification for canvas filters applies the globalAlpha on the filter result. The drawing model essentially says: 1. Render the shape, creating image A. 2. When the current filter is set, use it on image A to create image B. 3. Multiply the alpha component of every pixel in B by global alpha. This leads to a unexpected behavior. When drawing a transparent shape with a drop-shadow filter, the shadow should be visible through the transparent foreground. This should be true whether the drawing is made transparent via fillStyle or via globalAlpha. This is how Chromium and Gecko behave. Following the specification to the letter however, the shadow wouldn't be visible through the foreground. Align the standard with Chromium's and Gecko's behavior: 1. Render the shape, creating image A. 2. Multiply the alpha component of every pixel in A by global alpha, creating image B. 3. When the current filter is set, use it on image B to create image C.
- Loading branch information