Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Unified Diff: ui/gfx/color_utils.cc

Issue 1698083004: Use a more correct conversion to uint8_t. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_utils.cc
diff --git a/ui/gfx/color_utils.cc b/ui/gfx/color_utils.cc
index 978283d29ab7a326781548940c448c104a57201b..bea78b0916e00a6a676596c0b6fba5a38b4c6bec 100644
--- a/ui/gfx/color_utils.cc
+++ b/ui/gfx/color_utils.cc
@@ -141,7 +141,8 @@ SkColor HSLToSkColor(const HSL& hsl, SkAlpha alpha) {
else if (lightness >= 1.0)
light = 255;
else
- light = static_cast<uint8_t>(SkDoubleToFixed(lightness) >> 8);
+ // Scale from 0 - 255 and round off the value.
+ light = static_cast<uint8_t>(lightness * 255 + .5);
Peter Kasting 2016/02/18 23:54:03 Seems like we could replace this entire conditiona
dogben 2016/02/22 17:30:30 SGTM, thanks!
return SkColorSetARGB(alpha, light, light, light);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698