Skip to content

Commit

Permalink
Fix incorrect rounding in software rendering of feColorMatrix.
Browse files Browse the repository at this point in the history
This doesn't fix a similar problem in ArithmeticCombineTwoPixels because the fixes there have performance implications, appear wrong, or are wrong for common inputs.

Since hue-rotate is defined in terms of a color matrix, some tests involving hue-rotate behave slightly differently.

Differential Revision: https://phabricator.services.mozilla.com/D211113

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1897783
gecko-commit: 89be5f4935310003f6d40c515547764c387a583c
gecko-reviewers: longsonr
  • Loading branch information
penteract authored and moz-wptsync-bot committed Dec 13, 2024
1 parent 7c9bf45 commit e45da16
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
18 changes: 18 additions & 0 deletions css/filter-effects/fecolormatrix-negative-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<title>Filter Effects: Test feColorMatrix with negative matrix entries</title>
<link rel="author" title="Toby Cathcart Burn" href="mailto:[email protected]">
</head>

<body>

<p>You should see a cyan colored rectangle.</p>

<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
<rect x='0' y='0' width='100' height='100' fill="#00ffff"></rect>
</svg>

</body>

</html>
35 changes: 35 additions & 0 deletions css/filter-effects/fecolormatrix-negative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>Filter Effects: Test feColorMatrix with negative matrix entries</title>
<link rel="author" title="Toby Cathcart Burn" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#feColorMatrixElement">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#element-attrdef-fecolormatrix-type">
<link rel="match" href="fecolormatrix-negative-ref.html">
<meta name="assert" content="If the test runs, you should see a cyan(#00ffff) colored rectangle.">
</head>

<body>

<p>You should see a cyan colored rectangle.</p>

<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
<defs>
<filter id='invert' color-interpolation-filters='sRGB'>
<feColorMatrix in='SourceGraphic'
values='-1 0 0 0 1
0 -1 0 0 1
0 0 -1 0 1
0 0 0 1 0' result='ef0'>
</feColorMatrix>
<feComposite in='ef0' in2='ef0' operator='arithmetic' k2='255'>
</feComposite>
</filter>
</defs>

<rect x='0' y='0' width='100' height='100' fill="#ffaa00" filter="url(#invert)"></rect>
</svg>

</body>

</html>

0 comments on commit e45da16

Please sign in to comment.