Canvas shadows are transformed separately from it's shape when blur filter applied
Reported by
mor...@gmail.com,
Nov 5
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3602.0 Safari/537.36 Steps to reproduce the problem: 1. Setup JS canvas 2. Set blur filter: ctx.filter = "blur(1px)" 3. Set rotation: ctx.rotate(0.1) 4. Set any visible shadow color: ctx.shadowColor = 'rgba(0,0,0,0.5)'; 4. Set shadow offset: ctx.shadowOffsetX = 5; ctx.shadowOffsetY = 5 5. Use fillRect to draw an rectangle: ctx.fillRect(50,50,100,100); What is the expected behavior? Shadow should be aligned in the same way with or without blur filter applied. What went wrong? Shadow is not aligned with it's shape. Did this work before? No Chrome version: 72.0.3602.0 Channel: canary OS Version: OS X 10.14.1 Flash Version: It works well in Firefox.
,
Nov 5
Hi, Here you have: https://jsbin.com/qagejugopo/edit?js,output
,
Nov 5
thanks for the report.
,
Nov 9
It appears that filters affect canvas matrix and the matrix is not restored after drawing shadows with filters. Adding a c->save() in https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.h?rcl=cca1ac2ce53e420cdc7ef2575a6ef91e29b7a99e&l=491 can fix this bug.
,
Nov 9
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d07d7323809b59b52b1237dacb94330cc9dab4bd commit d07d7323809b59b52b1237dacb94330cc9dab4bd Author: Fernando Serboncini <fserb@chromium.org> Date: Fri Nov 09 16:11:28 2018 Save transform context for filters Otherwise we get weird behavior on filters while transforming. TBR= Bug: 901759 Change-Id: I1d487f500024a309bdb4002ba19a20387b3bb251 Reviewed-on: https://chromium-review.googlesource.com/c/1329342 Reviewed-by: Fernando Serboncini <fserb@chromium.org> Commit-Queue: Fernando Serboncini <fserb@chromium.org> Cr-Commit-Position: refs/heads/master@{#606861} [modify] https://crrev.com/d07d7323809b59b52b1237dacb94330cc9dab4bd/third_party/blink/renderer/modules/canvas/canvas2d/base_rendering_context_2d.h
,
Nov 9
,
Nov 12
Able to reproduce the issue on chrome version 72.0.3602.0 (build without fix) as per the comment #0. Verified the fix on Mac 10.14.0 using Chrome version # 72.0.3608.0 Attaching screencast for reference. Observed that " Shadow is aligned with its shape " The fix is working as expected, adding Verified labels Thanks.! |
||||
►
Sign in to add a comment |
||||
Comment 1 by nzolghadr@chromium.org
, Nov 5