SVG lighting colors need to be converted into linearSRGB
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 May 2018 15:21:59 +0000 (15:21 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 May 2018 15:21:59 +0000 (15:21 +0000)
commit50f94aceb73edf582c3cf1387f5efd67da341277
tree976c62d665389ffebeaeeadbde3cdf1cb71be272
parent2feeb0732614a7605065b392f73e94f008b3a26e
SVG lighting colors need to be converted into linearSRGB
https://bugs.webkit.org/show_bug.cgi?id=181196

Reviewed by Darin Adler.

Address post-commit comments. Don't make a Color that contains linearRGB components,
but use FloatComponents instead. Since these FloatComponents are in the 0-1 range,
FELighting::setPixelInternal() needs to multiply by 255 since the output pixels are
8-bit 0-255.

Change linearToSRGBColorComponent() and sRGBToLinearColorComponent() to do math in
floats without promoting to doubles.

* platform/graphics/ColorUtilities.cpp:
(WebCore::FloatComponents::FloatComponents):
(WebCore::linearToSRGBColorComponent):
(WebCore::sRGBToLinearColorComponent):
(WebCore::sRGBColorToLinearComponents):
(WebCore::linearToSRGBColor): Deleted.
(WebCore::sRGBToLinearColor): Deleted.
* platform/graphics/ColorUtilities.h:
* platform/graphics/filters/FELighting.cpp:
(WebCore::FELighting::setPixelInternal):
(WebCore::FELighting::drawLighting):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ColorUtilities.cpp
Source/WebCore/platform/graphics/ColorUtilities.h
Source/WebCore/platform/graphics/filters/FELighting.cpp