mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-29 19:49:58 +02:00
[apps] In curve view, correct programming style
Change-Id: Idff43411da499ed17ced6d18475f11eff01051d2
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user