Skip to content

Commit 67d1f71

Browse files
vanceingallsclaude
andcommitted
fix(hdr): route identity-matrix HDR elements through region blit for clip rect support
parseTransformMatrix returns a valid matrix even for untransformed HDR elements (Chrome reports matrix(1,0,0,1,0,0)). This made the affine blit path always run, bypassing the region blit path which is the only one that applies clip rects from overflow:hidden ancestors. Fix: detect identity matrices and route them through the region path so the cropRgb48le clip logic is reachable for split-screen layouts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f743e1c commit 67d1f71

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

packages/producer/src/services/renderOrchestrator.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,22 @@ function blitHdrVideoLayer(
578578
clipped = true;
579579
}
580580

581-
if (viewportMatrix) {
581+
// Detect identity matrix — route through the region path (which supports
582+
// clip rects) instead of the affine path. Chrome reports a viewport matrix
583+
// for all HDR elements, including untransformed ones inside overflow:hidden
584+
// wrappers. An identity matrix means no visual transform is applied.
585+
const isIdentity = !!(
586+
viewportMatrix &&
587+
viewportMatrix.length >= 6 &&
588+
Math.abs(viewportMatrix[0]! - 1) < 0.001 &&
589+
Math.abs(viewportMatrix[1]!) < 0.001 &&
590+
Math.abs(viewportMatrix[2]!) < 0.001 &&
591+
Math.abs(viewportMatrix[3]! - 1) < 0.001 &&
592+
Math.abs(viewportMatrix[4]!) < 0.001 &&
593+
Math.abs(viewportMatrix[5]!) < 0.001
594+
);
595+
596+
if (viewportMatrix && !isIdentity) {
582597
if (clipped && log) {
583598
log.debug(
584599
`HDR clip rect on affine-transformed element ${el.id} — clip not applied (affine scissor not yet supported)`,

0 commit comments

Comments
 (0)