Changeset 225680 in webkit for trunk/Source/WebCore/css/CSSGradientValue.cpp
- Timestamp:
- Dec 8, 2017, 9:26:58 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/css/CSSGradientValue.cpp
r225036 r225680 120 120 } 121 121 122 static inline int interpolate(int min, int max, float position)123 {124 return min + static_cast<int>(position * (max - min));125 }126 127 static inline Color interpolate(const Color& color1, const Color& color2, float position)128 {129 // FIXME: ExtendedColor - Doesn't work with extended colors, and really should be a helper in Color.h, not here.130 int red = interpolate(color1.red(), color2.red(), position);131 int green = interpolate(color1.green(), color2.green(), position);132 int blue = interpolate(color1.blue(), color2.blue(), position);133 int alpha = interpolate(color1.alpha(), color2.alpha(), position);134 135 return Color(red, green, blue, alpha);136 }137 138 122 class LinearGradientAdapter { 139 123 public: … … 422 406 for (size_t y = 0; y < 9; ++y) { 423 407 float relativeOffset = (newStops[y].offset - offset1) / (offset2 - offset1); 424 float multiplier = powf(relativeOffset, logf(.5f) / logf(midpoint)); 425 newStops[y].color = interpolate(color1, color2, multiplier); 408 float multiplier = std::pow(relativeOffset, std::log(.5f) / std::log(midpoint)); 409 // FIXME: Why not premultiply here? 410 newStops[y].color = blend(color1, color2, multiplier, false /* do not premultiply */); 426 411 } 427 412
Note:
See TracChangeset
for help on using the changeset viewer.