WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
9955
Colors scaled from [0, 1] range to [0, 255] incorrectly
https://bugs.webkit.org/show_bug.cgi?id=9955
Summary
Colors scaled from [0, 1] range to [0, 255] incorrectly
Sam Weinig
Reported
2006-07-16 07:36:23 PDT
In Color.cpp, when a color needs to scaled from the floating-point range of [0.0, 1.0] to the integer range of [0, 255], such as in the HSLA code, the current code is producing an uneven distribution.
Attachments
patch
(11.99 KB, patch)
2006-07-16 07:44 PDT
,
Sam Weinig
darin
: review+
Details
Formatted Diff
Diff
patch 2
(198.43 KB, patch)
2006-07-16 10:32 PDT
,
Sam Weinig
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Sam Weinig
Comment 1
2006-07-16 07:44:53 PDT
Created
attachment 9490
[details]
patch Patch changes scaling behavior and updates Color class to comply with style guidelines.
Darin Adler
Comment 2
2006-07-16 07:53:12 PDT
Comment on
attachment 9490
[details]
patch Looks good. + float alpha = static_cast<float>(a) / 255.0f; The cast above seems unneeded. + c.setRGB(238, 238, 238); // FIXME: if this is a constant it should be specified as one. I agree that would be nice to fix, but I don't think the FIXME adds much. + const double scaleFactor = nextafter(256.0, +0.0); I think the use of + here on +0.0 is a bit queer. We could have + in front of all our floating point constants but we don't. Looks good, those are minor quibbles. r=me
Sam Weinig
Comment 3
2006-07-16 10:32:20 PDT
Created
attachment 9496
[details]
patch 2 Fixes darin's quibbles and adds changed tests.
Darin Adler
Comment 4
2006-07-16 15:20:23 PDT
Comment on
attachment 9496
[details]
patch 2 r=me
Darin Adler
Comment 5
2006-07-31 23:09:24 PDT
Committed revision 15734.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug