Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ba807ab430770f1a34bc50171301a7e175b1b1b5
      
https://github.com/WebKit/WebKit/commit/ba807ab430770f1a34bc50171301a7e175b1b1b5
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-08-24 (Mon, 24 Aug 2026)

  Changed paths:
    M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp

  Log Message:
  -----------
  [canvas] transformAreaToDevice() walks the path twice
https://bugs.webkit.org/show_bug.cgi?id=322361
rdar://185649955

Reviewed by Gerald Squelart.

transformAreaToDevice() applied the state CTM and the base transform as two
separate Path::transform() calls. Matrix multiplication is associative (and
close enough to associative in double), so the pair is equivalent to a single
transform by the composed matrix baseTransform() * state().transform. The
operands read in the opposite order from the two calls because AffineTransform's
`A * B` maps a point through B first and then A, so the transform that was
applied second is the left operand.

The second pass is not free. The only caller reaches this via the FloatRect
overload, and PathRect::canTransform is false, so the first transform()
already materializes a platform path; on CG each subsequent transform() is a
CGPathCreateMutableCopyByTransformingPath, i.e. a fresh CGMutablePath
allocation. Pre-multiplying drops one path allocation and one full walk per
composited drawImage().

No change in behavior, covered by the existing full-canvas composite tests
(fast/canvas/canvas-composite-*).

* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::transformAreaToDevice const):

Canonical link: https://commits.webkit.org/319757@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to