[Webkit-unassigned] [Bug 80321] New: WebCore::ImageBuffer.cpp has broken color table code
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Mar 5 13:15:14 PST 2012
https://bugs.webkit.org/show_bug.cgi?id=80321
Summary: WebCore::ImageBuffer.cpp has broken color table code
Product: WebKit
Version: 528+ (Nightly build)
Platform: Unspecified
OS/Version: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Platform
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: schenney at chromium.org
The current code for computing color space conversions in WebCore/platform/graphics/ImageBuffer.cpp looks like this:
In the header:
Vector<int> m_linearRgbLUT;
Vector<int> m_deviceRgbLUT;
In the class code:
void ImageBuffer::transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstColorSpace)
{
if (srcColorSpace == dstColorSpace)
return;
// only sRGB <-> linearRGB are supported at the moment
if ((srcColorSpace != ColorSpaceLinearRGB && srcColorSpace != ColorSpaceDeviceRGB)
|| (dstColorSpace != ColorSpaceLinearRGB && dstColorSpace != ColorSpaceDeviceRGB))
return;
if (dstColorSpace == ColorSpaceLinearRGB) {
if (m_linearRgbLUT.isEmpty()) {
for (unsigned i = 0; i < 256; i++) {
float color = i / 255.0f;
color = (color <= 0.04045f ? color / 12.92f : pow((color + 0.055f) / 1.055f, 2.4f));
color = std::max(0.0f, color);
color = std::min(1.0f, color);
m_linearRgbLUT.append(static_cast<int>(color * 255));
}
}
platformTransformColorSpace(m_linearRgbLUT);
} else if (dstColorSpace == ColorSpaceDeviceRGB) {
if (m_deviceRgbLUT.isEmpty()) {
for (unsigned i = 0; i < 256; i++) {
float color = i / 255.0f;
color = (powf(color, 1.0f / 2.4f) * 1.055f) - 0.055f;
color = std::max(0.0f, color);
color = std::min(1.0f, color);
m_deviceRgbLUT.append(static_cast<int>(color * 255));
}
}
platformTransformColorSpace(m_deviceRgbLUT);
}
}
There are two major problems with this. 1. The color space LUT are constants, and should be static. 2. The numerical code to compute the color space transforms has numerical imprecision, meaning that the Linear -> Device LUT maps 255 to 254. So every filter that is applied in SVG, and maybe CSS, drops the intensity of the resulting pixels.
Unfortunately, fixing this will cause massive rebaseline needs as lots of images will change imperceptibly.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list