More double promote fixes

This commit is contained in:
Ingo Weyrich
2020-02-10 20:06:43 +01:00
parent f0b5ca02e7
commit b4c0bb3acb
8 changed files with 65 additions and 107 deletions

View File

@@ -42,7 +42,6 @@ class rtengine::LCPProfile::LCPPersModel
public: public:
LCPPersModel(); LCPPersModel();
bool hasModeData(LCPCorrectionMode mode) const; bool hasModeData(LCPCorrectionMode mode) const;
void print() const;
float focLen; float focLen;
float focDist; float focDist;
@@ -82,27 +81,18 @@ bool rtengine::LCPModelCommon::empty() const
&& param[2] == 0.0f; && param[2] == 0.0f;
} }
void rtengine::LCPModelCommon::print() const
{
std::printf("focLen %g/%g; imgCenter %g/%g; scale %g; err %g\n", foc_len_x, foc_len_y, img_center_x, img_center_y, scale_factor, mean_error);
std::printf("xy0 %g/%g fxy %g/%g\n", x0, y0, fx, fy);
std::printf("param: %g/%g/%g/%g/%g\n", param[0], param[1], param[2], param[3], param[4]);
}
// weighted merge two parameters // weighted merge two parameters
void rtengine::LCPModelCommon::merge(const LCPModelCommon& a, const LCPModelCommon& b, float facA) void rtengine::LCPModelCommon::merge(const LCPModelCommon& a, const LCPModelCommon& b, float facA)
{ {
const float facB = 1.0f - facA; foc_len_x = rtengine::intp<float>(facA, a.foc_len_x, b.foc_len_x);
foc_len_y = rtengine::intp<float>(facA, a.foc_len_y, b.foc_len_y);
foc_len_x = facA * a.foc_len_x + facB * b.foc_len_x; img_center_x = rtengine::intp<float>(facA, a.img_center_x, b.img_center_x);
foc_len_y = facA * a.foc_len_y + facB * b.foc_len_y; img_center_y = rtengine::intp<float>(facA, a.img_center_y, b.img_center_y);
img_center_x = facA * a.img_center_x + facB * b.img_center_x; scale_factor = rtengine::intp<float>(facA, a.scale_factor, b.scale_factor);
img_center_y = facA * a.img_center_y + facB * b.img_center_y; mean_error = rtengine::intp<float>(facA, a.mean_error, b.mean_error);
scale_factor = facA * a.scale_factor + facB * b.scale_factor;
mean_error = facA * a.mean_error + facB * b.mean_error;
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
param[i] = facA * a.param[i] + facB * b.param[i]; param[i] = rtengine::intp<float>(facA, a.param[i], b.param[i]);
} }
const float param0Sqr = param[0] * param[0]; const float param0Sqr = param[0] * param[0];
@@ -152,7 +142,6 @@ void rtengine::LCPModelCommon::prepareParams(
rfx = 1.0f / fx; rfx = 1.0f / fx;
rfy = 1.0f / fy; rfy = 1.0f / fy;
//std::printf("FW %i /X0 %g FH %i /Y0 %g %g\n",fullWidth,x0,fullHeight,y0, imgYCenter);
} }
rtengine::LCPProfile::LCPPersModel::LCPPersModel() : rtengine::LCPProfile::LCPPersModel::LCPPersModel() :
@@ -188,35 +177,6 @@ bool rtengine::LCPProfile::LCPPersModel::hasModeData(LCPCorrectionMode mode) con
return false; return false;
} }
void rtengine::LCPProfile::LCPPersModel::print() const
{
std::printf("--- PersModel focLen %g; focDist %g; aperture %g\n", focLen, focDist, aperture);
std::printf("Base:\n");
base.print();
if (!chromRG.empty()) {
std::printf("ChromRG:\n");
chromRG.print();
}
if (!chromG.empty()) {
std::printf("ChromG:\n");
chromG.print();
}
if (!chromBG.empty()) {
std::printf("ChromBG:\n");
chromBG.print();
}
if (!vignette.empty()) {
std::printf("Vignette:\n");
vignette.print();
}
std::printf("\n");
}
rtengine::LCPProfile::LCPProfile(const Glib::ustring& fname) : rtengine::LCPProfile::LCPProfile(const Glib::ustring& fname) :
isFisheye(false), isFisheye(false),
sensorFormatFactor(1.f), sensorFormatFactor(1.f),
@@ -522,7 +482,7 @@ void rtengine::LCPProfile::calcParams(
) { ) {
// Mix in aperture // Mix in aperture
const float facAperLow = (pHigh->aperture - aperture) / (pHigh->aperture - pLow->aperture); const float facAperLow = (pHigh->aperture - aperture) / (pHigh->aperture - pLow->aperture);
facLow = focLenOnSpot ? facAperLow : (0.5 * facLow + 0.5 * facAperLow); facLow = focLenOnSpot ? facAperLow : (0.5f * (facLow + facAperLow));
} }
else if ( else if (
mode != LCPCorrectionMode::VIGNETTE mode != LCPCorrectionMode::VIGNETTE
@@ -532,7 +492,7 @@ void rtengine::LCPProfile::calcParams(
) { ) {
// focus distance for all else (if focus distance is given) // focus distance for all else (if focus distance is given)
const float facDistLow = (std::log(pHigh->focDist) + euler - focusDistLog) / (std::log(pHigh->focDist) - std::log(pLow->focDist)); const float facDistLow = (std::log(pHigh->focDist) + euler - focusDistLog) / (std::log(pHigh->focDist) - std::log(pLow->focDist));
facLow = focLenOnSpot ? facDistLow : (0.8 * facLow + 0.2 * facDistLow); facLow = focLenOnSpot ? facDistLow : (0.8f * facLow + 0.2f * facDistLow);
} }
switch (mode) { switch (mode) {
@@ -555,7 +515,16 @@ void rtengine::LCPProfile::calcParams(
} }
if (settings->verbose) { if (settings->verbose) {
std::printf("LCP mode=%i, dist: %g found frames: Fno %g-%g; FocLen %g-%g; Dist %g-%g with weight %g\n", toUnderlying(mode), focusDist, pLow->aperture, pHigh->aperture, pLow->focLen, pHigh->focLen, pLow->focDist, pHigh->focDist, facLow); std::printf("LCP mode=%i, dist: %g found frames: Fno %g-%g; FocLen %g-%g; Dist %g-%g with weight %g\n",
toUnderlying(mode),
static_cast<double>(focusDist),
static_cast<double>(pLow->aperture),
static_cast<double>(pHigh->aperture),
static_cast<double>(pLow->focLen),
static_cast<double>(pHigh->focLen),
static_cast<double>(pLow->focDist),
static_cast<double>(pHigh->focDist),
static_cast<double>(facLow));
} }
} else { } else {
if (settings->verbose) { if (settings->verbose) {
@@ -564,15 +533,6 @@ void rtengine::LCPProfile::calcParams(
} }
} }
void rtengine::LCPProfile::print() const
{
std::printf("=== Profile %s\n", profileName.c_str());
std::printf("Frames: %i, RAW: %i; Fisheye: %i; Sensorformat: %f\n", persModelCount, isRaw, isFisheye, sensorFormatFactor);
for (int pm = 0; pm < persModelCount; ++pm) {
aPersModel[pm]->print();
}
}
// from all frames not marked as bad already, take average and filter out frames with higher deviation than this if there are enough values // from all frames not marked as bad already, take average and filter out frames with higher deviation than this if there are enough values
int rtengine::LCPProfile::filterBadFrames(LCPCorrectionMode mode, double maxAvgDevFac, int minFramesLeft) int rtengine::LCPProfile::filterBadFrames(LCPCorrectionMode mode, double maxAvgDevFac, int minFramesLeft)
@@ -649,7 +609,7 @@ int rtengine::LCPProfile::filterBadFrames(LCPCorrectionMode mode, double maxAvgD
} }
if (settings->verbose && count) { if (settings->verbose && count) {
std::printf("Filtered %.1f%% frames for maxAvgDevFac %g leaving %i\n", filtered * 100.f / count, maxAvgDevFac, count - filtered); std::printf("Filtered %.1f%% frames for maxAvgDevFac %g leaving %i\n", filtered * 100.0 / count, maxAvgDevFac, count - filtered);
} }
} }
@@ -1007,7 +967,7 @@ rtengine::LCPMapper::LCPMapper(
const bool mirrorX = (rot == 90 || rot == 180); const bool mirrorX = (rot == 90 || rot == 180);
const bool mirrorY = (rot == 180 || rot == 270); const bool mirrorY = (rot == 180 || rot == 270);
if (settings->verbose) { if (settings->verbose) {
std::printf("Vign: %i, fullWidth: %i/%i, focLen %g SwapXY: %i / MirX/Y %i / %i on rot:%i from %i\n",vignette, fullWidth, fullHeight, focalLength, swapXY, mirrorX, mirrorY, rot, rawRotationDeg); std::printf("Vign: %i, fullWidth: %i/%i, focLen %g SwapXY: %i / MirX/Y %i / %i on rot:%i from %i\n",vignette, fullWidth, fullHeight, static_cast<double>(focalLength), swapXY, mirrorX, mirrorY, rot, rawRotationDeg);
} }
pProf->calcParams(vignette ? LCPCorrectionMode::VIGNETTE : LCPCorrectionMode::DISTORTION, focalLength, focusDist, aperture, &mc, nullptr, nullptr); pProf->calcParams(vignette ? LCPCorrectionMode::VIGNETTE : LCPCorrectionMode::DISTORTION, focalLength, focusDist, aperture, &mc, nullptr, nullptr);
@@ -1038,8 +998,8 @@ void rtengine::LCPMapper::correctDistortion(double &x, double &y, int cx, int cy
if (isFisheye) { if (isFisheye) {
const double u = x * scale; const double u = x * scale;
const double v = y * scale; const double v = y * scale;
const double u0 = mc.x0 * scale; const double u0 = static_cast<double>(mc.x0) * scale;
const double v0 = mc.y0 * scale; const double v0 = static_cast<double>(mc.y0) * scale;
const double du = (u - u0); const double du = (u - u0);
const double dv = (v - v0); const double dv = (v - v0);
const double fx = mc.fx; const double fx = mc.fx;
@@ -1059,22 +1019,22 @@ void rtengine::LCPMapper::correctDistortion(double &x, double &y, int cx, int cy
} else { } else {
x *= scale; x *= scale;
y *= scale; y *= scale;
const double x0 = mc.x0 * scale; const double x0 = static_cast<double>(mc.x0) * scale;
const double y0 = mc.y0 * scale; const double y0 = static_cast<double>(mc.y0) * scale;
const double xd = (x - x0) / mc.fx, yd = (y - y0) / mc.fy; const double xd = (x - x0) / static_cast<double>(mc.fx), yd = (y - y0) / static_cast<double>(mc.fy);
const LCPModelCommon::Param aDist = mc.param; const auto& aDist = mc.param;
const double rsqr = xd * xd + yd * yd; const double rsqr = xd * xd + yd * yd;
const double xfac = aDist[swapXY ? 3 : 4], yfac = aDist[swapXY ? 4 : 3]; const double xfac = static_cast<double>(aDist[swapXY ? 3 : 4]), yfac = static_cast<double>(aDist[swapXY ? 4 : 3]);
const double commonFac = (((aDist[2] * rsqr + aDist[1]) * rsqr + aDist[0]) * rsqr + 1.) const double commonFac = (((static_cast<double>(aDist[2]) * rsqr + static_cast<double>(aDist[1])) * rsqr + static_cast<double>(aDist[0])) * rsqr + 1.)
+ 2. * (yfac * yd + xfac * xd); + 2. * (yfac * yd + xfac * xd);
const double xnew = xd * commonFac + xfac * rsqr; const double xnew = xd * commonFac + xfac * rsqr;
const double ynew = yd * commonFac + yfac * rsqr; const double ynew = yd * commonFac + yfac * rsqr;
x = xnew * mc.fx + x0; x = xnew * static_cast<double>(mc.fx) + x0;
y = ynew * mc.fy + y0; y = ynew * static_cast<double>(mc.fy) + y0;
} }
x -= cx * scale; x -= cx * scale;
@@ -1094,20 +1054,20 @@ void rtengine::LCPMapper::correctCA(double& x, double& y, int cx, int cy, int ch
// First calc the green channel like normal distortion // First calc the green channel like normal distortion
// the other are just deviations from it // the other are just deviations from it
double xd = (x - chrom[1].x0) / chrom[1].fx; double xd = (x - static_cast<double>(chrom[1].x0)) / static_cast<double>(chrom[1].fx);
double yd = (y - chrom[1].y0) / chrom[1].fy; double yd = (y - static_cast<double>(chrom[1].y0)) / static_cast<double>(chrom[1].fy);
// Green contains main distortion, just like base // Green contains main distortion, just like base
if (useCADist) { if (useCADist) {
const LCPModelCommon::Param aDist = chrom[1].param; const auto& aDist = chrom[1].param;
double rsqr = xd * xd + yd * yd; double rsqr = xd * xd + yd * yd;
double xfac = aDist[swapXY ? 3 : 4], yfac = aDist[swapXY ? 4 : 3]; double xfac = static_cast<double>(aDist[swapXY ? 3 : 4]), yfac = static_cast<double>(aDist[swapXY ? 4 : 3]);
double commonFac = (((aDist[2] * rsqr + aDist[1]) * rsqr + aDist[0]) * rsqr + 1.) double commonFac = (((static_cast<double>(aDist[2]) * rsqr + static_cast<double>(aDist[1])) * rsqr + static_cast<double>(aDist[0])) * rsqr + 1.)
+ 2. * (yfac * yd + xfac * xd); + 2. * (yfac * yd + xfac * xd);
xgreen = xd * commonFac + aDist[4] * rsqr; xgreen = xd * commonFac + static_cast<double>(aDist[4]) * rsqr;
ygreen = yd * commonFac + aDist[3] * rsqr; ygreen = yd * commonFac + static_cast<double>(aDist[3]) * rsqr;
} else { } else {
xgreen = xd; xgreen = xd;
ygreen = yd; ygreen = yd;
@@ -1115,20 +1075,20 @@ void rtengine::LCPMapper::correctCA(double& x, double& y, int cx, int cy, int ch
if (channel == 1) { if (channel == 1) {
// green goes directly // green goes directly
x = xgreen * chrom[1].fx + chrom[1].x0; x = xgreen * static_cast<double>(chrom[1].fx) + static_cast<double>(chrom[1].x0);
y = ygreen * chrom[1].fy + chrom[1].y0; y = ygreen * static_cast<double>(chrom[1].fy) + static_cast<double>(chrom[1].y0);
} else { } else {
// others are diffs from green // others are diffs from green
xd = xgreen; xd = xgreen;
yd = ygreen; yd = ygreen;
const double rsqr = xd * xd + yd * yd; const double rsqr = xd * xd + yd * yd;
const LCPModelCommon::Param aCA = chrom[channel].param; const auto& aCA = chrom[channel].param;
const double xfac = aCA[swapXY ? 3 : 4], yfac = aCA[swapXY ? 4 : 3]; const double xfac = static_cast<double>(aCA[swapXY ? 3 : 4]), yfac = static_cast<double>(aCA[swapXY ? 4 : 3]);
const double commonSum = 1. + rsqr * (aCA[0] + rsqr * (aCA[1] + aCA[2] * rsqr)) + 2. * (yfac * yd + xfac * xd); const double commonSum = 1. + rsqr * (static_cast<double>(aCA[0]) + rsqr * (static_cast<double>(aCA[1]) + static_cast<double>(aCA[2] )* rsqr)) + 2. * (yfac * yd + xfac * xd);
x = (chrom[channel].scale_factor * ( xd * commonSum + xfac * rsqr )) * chrom[channel].fx + chrom[channel].x0; x = (static_cast<double>(chrom[channel].scale_factor) * ( xd * commonSum + xfac * rsqr )) * static_cast<double>(chrom[channel].fx) + static_cast<double>(chrom[channel].x0);
y = (chrom[channel].scale_factor * ( yd * commonSum + yfac * rsqr )) * chrom[channel].fy + chrom[channel].y0; y = (static_cast<double>(chrom[channel].scale_factor) * ( yd * commonSum + yfac * rsqr )) * static_cast<double>(chrom[channel].fy) + static_cast<double>(chrom[channel].y0);
} }
x -= cx; x -= cx;

View File

@@ -54,7 +54,6 @@ public:
LCPModelCommon(); LCPModelCommon();
bool empty() const; // is it empty bool empty() const; // is it empty
void print() const; // printf all values
void merge(const LCPModelCommon& a, const LCPModelCommon& b, float facA); void merge(const LCPModelCommon& a, const LCPModelCommon& b, float facA);
void prepareParams( void prepareParams(
int fullWidth, int fullWidth,
@@ -106,7 +105,6 @@ public:
LCPModelCommon *pCorr3 LCPModelCommon *pCorr3
) const; // Interpolates between the persModels frames ) const; // Interpolates between the persModels frames
void print() const;
//private: //private:
// Common data // Common data

View File

@@ -183,7 +183,7 @@ float MyCurve::getVal(LUTf &curve, int x)
if (size_t(graphW) == curve.getSize()) { if (size_t(graphW) == curve.getSize()) {
return curve[x]; return curve[x];
} else { } else {
return curve.getVal01(float(x) / graphW); return curve.getVal01(x / graphW);
} }
} }

View File

@@ -358,14 +358,14 @@ void MyDiagonalCurve::draw (int handle)
// draw upper and lower bounds // draw upper and lower bounds
if (curve.type == DCT_Parametric && activeParam > 0 && lpoint.getUpperBound() > 1 && upoint.getUpperBound() > 1) { if (curve.type == DCT_Parametric && activeParam > 0 && lpoint.getUpperBound() > 1 && upoint.getUpperBound() > 1) {
cr->set_source_rgba (1.0, 1.0, 1.0, 0.1); cr->set_source_rgba (1.0, 1.0, 1.0, 0.1);
cr->move_to (graphX, getVal(upoint, 0) * -graphH + graphY); cr->move_to (graphX, static_cast<double>(getVal(upoint, 0)) * -graphH + graphY);
for (int i = 1; i < graphW - 2; ++i) { for (int i = 1; i < graphW - 2; ++i) {
cr->line_to ((double)i + graphX, getVal(upoint, i) * -graphH + graphY); cr->line_to ((double)i + graphX, static_cast<double>(getVal(upoint, i)) * -graphH + graphY);
} }
for (int i = graphW - 3; i >= 0; --i) { for (int i = graphW - 3; i >= 0; --i) {
cr->line_to ((double)i + graphX, getVal(lpoint, i) * -graphH + graphY); cr->line_to ((double)i + graphX, static_cast<double>(getVal(lpoint, i)) * -graphH + graphY);
} }
cr->fill (); cr->fill ();
@@ -390,21 +390,21 @@ void MyDiagonalCurve::draw (int handle)
if (n > 1) { if (n > 1) {
if (pipetteR > -1.f) { if (pipetteR > -1.f) {
cr->set_source_rgba (1., 0., 0., 0.5); // WARNING: assuming that red values are stored in pipetteR, which might not be the case! cr->set_source_rgba (1., 0., 0., 0.5); // WARNING: assuming that red values are stored in pipetteR, which might not be the case!
cr->move_to (graphX + graphW*pipetteR, graphY + 1. * s); cr->move_to (graphX + graphW * static_cast<double>(pipetteR), graphY + 1. * s);
cr->rel_line_to (0, -graphH - 1. * s); cr->rel_line_to (0, -graphH - 1. * s);
cr->stroke (); cr->stroke ();
} }
if (pipetteG > -1.f) { if (pipetteG > -1.f) {
cr->set_source_rgba (0., 1., 0., 0.5); // WARNING: assuming that green values are stored in pipetteG, which might not be the case! cr->set_source_rgba (0., 1., 0., 0.5); // WARNING: assuming that green values are stored in pipetteG, which might not be the case!
cr->move_to (graphX + graphW*pipetteG, graphY + 1. * s); cr->move_to (graphX + graphW * static_cast<double>(pipetteG), graphY + 1. * s);
cr->rel_line_to (0, -graphH - 1. * s); cr->rel_line_to (0, -graphH - 1. * s);
cr->stroke (); cr->stroke ();
} }
if (pipetteB > -1.f) { if (pipetteB > -1.f) {
cr->set_source_rgba (0., 0., 1., 0.5); // WARNING: assuming that blue values are stored in pipetteB, which might not be the case! cr->set_source_rgba (0., 0., 1., 0.5); // WARNING: assuming that blue values are stored in pipetteB, which might not be the case!
cr->move_to (graphX + graphW*pipetteB, graphY + 1. * s); cr->move_to (graphX + graphW * static_cast<double>(pipetteB), graphY + 1. * s);
cr->rel_line_to (0, -graphH - 1. * s); cr->rel_line_to (0, -graphH - 1. * s);
cr->stroke (); cr->stroke ();
} }
@@ -414,7 +414,7 @@ void MyDiagonalCurve::draw (int handle)
cr->set_line_width (2. * s); cr->set_line_width (2. * s);
c = style->get_color (state); c = style->get_color (state);
cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue());
cr->move_to (graphX + graphW*pipetteVal, graphY + 1. * s); cr->move_to (graphX + graphW * static_cast<double>(pipetteVal), graphY + 1. * s);
cr->rel_line_to (0, -graphH - 1. * s); cr->rel_line_to (0, -graphH - 1. * s);
cr->stroke (); cr->stroke ();
cr->set_line_width (1. * s); cr->set_line_width (1. * s);
@@ -460,7 +460,7 @@ void MyDiagonalCurve::draw (int handle)
// draw curve // draw curve
cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue());
cr->move_to (graphX, getVal(point, 0) * -graphH + graphY); cr->move_to (graphX, static_cast<double>(getVal(point, 0)) * -graphH + graphY);
for (int i = 1; i < graphW; ++i) { for (int i = 1; i < graphW; ++i) {
cr->line_to ((double)i + graphX, (double)getVal(point, i) * -graphH + graphY); cr->line_to ((double)i + graphX, (double)getVal(point, i) * -graphH + graphY);

View File

@@ -233,21 +233,21 @@ void MyFlatCurve::draw ()
if (n > 1) { if (n > 1) {
if (pipetteR > -1.f) { if (pipetteR > -1.f) {
cr->set_source_rgba (1., 0., 0., 0.5); // WARNING: assuming that red values are stored in pipetteR, which might not be the case! cr->set_source_rgba (1., 0., 0., 0.5); // WARNING: assuming that red values are stored in pipetteR, which might not be the case!
cr->move_to (graphX + graphW*pipetteR, graphY + 1. * s); cr->move_to (graphX + graphW * static_cast<double>(pipetteR), graphY + 1. * s);
cr->rel_line_to (0, -graphH - 1. * s); cr->rel_line_to (0, -graphH - 1. * s);
cr->stroke (); cr->stroke ();
} }
if (pipetteG > -1.f) { if (pipetteG > -1.f) {
cr->set_source_rgba (0., 1., 0., 0.5); // WARNING: assuming that green values are stored in pipetteG, which might not be the case! cr->set_source_rgba (0., 1., 0., 0.5); // WARNING: assuming that green values are stored in pipetteG, which might not be the case!
cr->move_to (graphX + graphW*pipetteG, graphY + 1. * s); cr->move_to (graphX + graphW * static_cast<double>(pipetteG), graphY + 1. * s);
cr->rel_line_to (0, -graphH - 1. * s); cr->rel_line_to (0, -graphH - 1. * s);
cr->stroke (); cr->stroke ();
} }
if (pipetteB > -1.f) { if (pipetteB > -1.f) {
cr->set_source_rgba (0., 0., 1., 0.5); // WARNING: assuming that blue values are stored in pipetteB, which might not be the case! cr->set_source_rgba (0., 0., 1., 0.5); // WARNING: assuming that blue values are stored in pipetteB, which might not be the case!
cr->move_to (graphX + graphW*pipetteB, graphY + 1. * s); cr->move_to (graphX + graphW * static_cast<double>(pipetteB), graphY + 1. * s);
cr->rel_line_to (0, -graphH - 1. * s); cr->rel_line_to (0, -graphH - 1. * s);
cr->stroke (); cr->stroke ();
} }
@@ -257,7 +257,7 @@ void MyFlatCurve::draw ()
cr->set_line_width (2. * s); cr->set_line_width (2. * s);
c = style->get_color (state); c = style->get_color (state);
cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue());
cr->move_to (graphX + graphW*pipetteVal, graphY + 1. * s); cr->move_to (graphX + graphW * static_cast<double>(pipetteVal), graphY + 1. * s);
cr->rel_line_to (0, -graphH - 1. * s); cr->rel_line_to (0, -graphH - 1. * s);
cr->stroke (); cr->stroke ();
cr->set_line_width (1. * s); cr->set_line_width (1. * s);
@@ -437,10 +437,10 @@ void MyFlatCurve::draw ()
// draw curve // draw curve
c = style->get_color(state); c = style->get_color(state);
cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue());
cr->move_to (graphX, getVal(point, 0) * -graphH + graphY); cr->move_to (graphX, static_cast<double>(getVal(point, 0)) * -graphH + graphY);
for (int i = 1; i < graphW; ++i) { for (int i = 1; i < graphW; ++i) {
cr->line_to ((double)i + graphX, (double)getVal(point, i) * -graphH + graphY); cr->line_to ((double)i + graphX, static_cast<double>(getVal(point, i)) * -graphH + graphY);
} }
cr->stroke (); cr->stroke ();

View File

@@ -278,7 +278,7 @@ Retinex::Retinex () : FoldableToolPanel (this, "retinex", M ("TP_RETINEX_LABEL")
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
float R, G, B; float R, G, B;
float x = float (i) * (1.0f / 6.0); float x = i / 6.0;
Color::hsv2rgb01 (x, 0.5f, 0.5f, R, G, B); Color::hsv2rgb01 (x, 0.5f, 0.5f, R, G, B);
milestones.push_back ( GradientMilestone (double (x), double (R), double (G), double (B)) ); milestones.push_back ( GradientMilestone (double (x), double (R), double (G), double (B)) );
} }

View File

@@ -68,7 +68,7 @@ double RTScalable::getDPI ()
double RTScalable::getTweakedDPI () double RTScalable::getTweakedDPI ()
{ {
return dpi * fontScale; return dpi * static_cast<double>(fontScale);
} }
int RTScalable::getScale () int RTScalable::getScale ()

View File

@@ -179,7 +179,7 @@ RTWindow::RTWindow ()
fontScale = options.fontSize / (float)RTScalable::baseFontSize; fontScale = options.fontSize / (float)RTScalable::baseFontSize;
} }
if (rtengine::settings->verbose) { if (rtengine::settings->verbose) {
printf("\"Non-Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", options.fontSize, (int)initialGdkScale, fontScale); printf("\"Non-Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", options.fontSize, (int)initialGdkScale, static_cast<double>(fontScale));
} }
} else { } else {
Glib::RefPtr<Gtk::StyleContext> style = Gtk::StyleContext::create(); Glib::RefPtr<Gtk::StyleContext> style = Gtk::StyleContext::create();
@@ -209,7 +209,7 @@ RTWindow::RTWindow ()
if ((int)initialGdkScale > 1 || pt != RTScalable::baseFontSize) { if ((int)initialGdkScale > 1 || pt != RTScalable::baseFontSize) {
css = Glib::ustring::compose ("* { font-size: %1pt}", pt * (int)initialGdkScale); css = Glib::ustring::compose ("* { font-size: %1pt}", pt * (int)initialGdkScale);
if (rtengine::settings->verbose) { if (rtengine::settings->verbose) {
printf("\"Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", pt, (int)initialGdkScale, fontScale); printf("\"Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", pt, (int)initialGdkScale, static_cast<double>(fontScale));
} }
} }
} }