Project

General

Profile

Feature #6802 » 0005-Fix-parseCssColor-to-take-a-float-alpha-in-rgba.patch

Bruce Toll, 12/11/2018 11:08 PM

View differences:

src/web/ColorUtils.C
#include "ColorUtils.h"
#include "Wt/WException.h"
#include "Wt/WLogger.h"
#include "web/WebUtils.h"
......
if (has_alpha) {
try {
alpha = Utils::stoi(boost::trim_copy(arguments[3]));
double alpha_d = Utils::stof(boost::trim_copy(arguments[3]));
if (alpha_d < 0.0 || alpha_d > 1.0)
throw WException("parseCssColor: alpha value out of range 0.0 to 1.0");
alpha = std::round(alpha_d * 255.);
} catch (std::exception& e) {
LOG_ERROR("could not parse rgb format: " << n);
alpha = 255;
(5-5/8)