[apps] In curve view, correct programming style

Change-Id: Idff43411da499ed17ced6d18475f11eff01051d2
This commit is contained in:
Émilie Feral
2017-01-09 15:50:13 +01:00
parent e9e171935c
commit a827558b64

View File

@@ -286,19 +286,20 @@ void CurveView::drawHistogram(KDContext * ctx, KDRect rect, Model * model, float
float rectMaxUpperBound = firstBarAbscissa + (rectMaxBinNumber+1)*barWidth + barWidth;
for (float x = rectMinLowerBound; x < rectMaxUpperBound; x += barWidth) {
float y = evaluateModelWithParameter(model, x+barWidth/2.0f);
if (!isnan(y)) {
float pxf = floatToPixel(Axis::Horizontal, x);
float pyf = floatToPixel(Axis::Vertical, y);
KDRect binRect(pxf, roundf(pyf), pixelBarWidth+1 , floatToPixel(Axis::Vertical, 0.0f) - roundf(pyf));
if (floatToPixel(Axis::Vertical, 0.0f) < roundf(pyf)) {
binRect = KDRect(pxf, floatToPixel(Axis::Vertical, 0.0f), pixelBarWidth+1, roundf(pyf) - floatToPixel(Axis::Vertical, 0.0f));
}
KDColor binColor = defaultColor;
if (x + barWidth/2.0f >= highlightLowerBound && x + barWidth/2.0f <= highlightUpperBound) {
binColor = highlightColor;
}
ctx->fillRect(binRect, binColor);
if (isnan(y)) {
continue;
}
float pxf = floatToPixel(Axis::Horizontal, x);
float pyf = floatToPixel(Axis::Vertical, y);
KDRect binRect(pxf, roundf(pyf), pixelBarWidth+1 , floatToPixel(Axis::Vertical, 0.0f) - roundf(pyf));
if (floatToPixel(Axis::Vertical, 0.0f) < roundf(pyf)) {
binRect = KDRect(pxf, floatToPixel(Axis::Vertical, 0.0f), pixelBarWidth+1, roundf(pyf) - floatToPixel(Axis::Vertical, 0.0f));
}
KDColor binColor = defaultColor;
if (x + barWidth/2.0f >= highlightLowerBound && x + barWidth/2.0f <= highlightUpperBound) {
binColor = highlightColor;
}
ctx->fillRect(binRect, binColor);
}
}