Commit 17d0f742 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Glow: Fixed the pixel precision.

parent c3ae86ea
...@@ -47,10 +47,10 @@ void FlowPoint::posit(double x1, double y1) ...@@ -47,10 +47,10 @@ void FlowPoint::posit(double x1, double y1)
{ {
x = x1; x = x1;
y = y1; y = y1;
z_x = int(x * ctx->zoom_factor + 0.5); z_x = ROUND(x * ctx->zoom_factor);
z_y = int(y * ctx->zoom_factor + 0.5); z_y = ROUND(y * ctx->zoom_factor);
nav_z_x = int(x * ctx->nav_zoom_factor + 0.5); nav_z_x = ROUND(x * ctx->nav_zoom_factor);
nav_z_y = int(y * ctx->nav_zoom_factor + 0.5); nav_z_y = ROUND(y * ctx->nav_zoom_factor);
} }
void FlowPoint::posit_z(int x1, int y1) void FlowPoint::posit_z(int x1, int y1)
...@@ -59,20 +59,20 @@ void FlowPoint::posit_z(int x1, int y1) ...@@ -59,20 +59,20 @@ void FlowPoint::posit_z(int x1, int y1)
y = 1.0 * y1 / ctx->zoom_factor; y = 1.0 * y1 / ctx->zoom_factor;
z_x = x1; z_x = x1;
z_y = y1; z_y = y1;
nav_z_x = int(x * ctx->nav_zoom_factor); nav_z_x = ROUND(x * ctx->nav_zoom_factor);
nav_z_y = int(y * ctx->nav_zoom_factor); nav_z_y = ROUND(y * ctx->nav_zoom_factor);
} }
void FlowPoint::zoom() void FlowPoint::zoom()
{ {
z_x = int(x * ctx->zoom_factor + 0.5); z_x = ROUND(x * ctx->zoom_factor);
z_y = int(y * ctx->zoom_factor + 0.5); z_y = ROUND(y * ctx->zoom_factor);
} }
void FlowPoint::nav_zoom() void FlowPoint::nav_zoom()
{ {
nav_z_x = int(x * ctx->nav_zoom_factor + 0.5); nav_z_x = ROUND(x * ctx->nav_zoom_factor);
nav_z_y = int(y * ctx->nav_zoom_factor + 0.5); nav_z_y = ROUND(y * ctx->nav_zoom_factor);
} }
void FlowPoint::print_zoom() void FlowPoint::print_zoom()
......
...@@ -630,10 +630,10 @@ void GrowArc::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -630,10 +630,10 @@ void GrowArc::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
} }
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
if (fill) { if (fill) {
int display_shadow int display_shadow
...@@ -681,7 +681,7 @@ void GrowArc::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -681,7 +681,7 @@ void GrowArc::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
angle1 - rot, angle2, fillcolor, f1, f2, grad); angle1 - rot, angle2, fillcolor, f1, f2, grad);
} }
} else { } else {
int ish = int(shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y) + 0.5); int ish = ROUND(shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y));
int drawtype_incr = shadow_contrast; int drawtype_incr = shadow_contrast;
if (relief == glow_eRelief_Down) if (relief == glow_eRelief_Down)
drawtype_incr = -shadow_contrast; drawtype_incr = -shadow_contrast;
...@@ -784,20 +784,20 @@ void GrowArc::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -784,20 +784,20 @@ void GrowArc::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
double y_c = ((p1.y * w->zoom_factor_y - w->offset_y) double y_c = ((p1.y * w->zoom_factor_y - w->offset_y)
+ (p2.y * w->zoom_factor_y - w->offset_y)) / 2; + (p2.y * w->zoom_factor_y - w->offset_y)) / 2;
p1.x = int(-scale * ((ur.x - ll.x) / 2 * w->zoom_factor_x) + x_c + 0.5); p1.x = -scale * ((ur.x - ll.x) / 2 * w->zoom_factor_x) + x_c;
p1.y = int(-scale * ((ur.y - ll.y) / 2 * w->zoom_factor_y) + y_c + 0.5); p1.y = -scale * ((ur.y - ll.y) / 2 * w->zoom_factor_y) + y_c;
p2.x = int(scale * ((ur.x - ll.x) / 2 * w->zoom_factor_x) + x_c + 0.5); p2.x = scale * ((ur.x - ll.x) / 2 * w->zoom_factor_x) + x_c;
p2.y = int(scale * ((ur.y - ll.y) / 2 * w->zoom_factor_y) + y_c + 0.5); p2.y = scale * ((ur.y - ll.y) / 2 * w->zoom_factor_y) + y_c;
} else { } else {
p1.x = int(p1.x * w->zoom_factor_x + 0.5) - w->offset_x; p1.x = p1.x * w->zoom_factor_x - w->offset_x;
p1.y = int(p1.y * w->zoom_factor_y + 0.5) - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = int(p2.x * w->zoom_factor_x + 0.5) - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = int(p2.y * w->zoom_factor_y + 0.5) - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
} }
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
if (border || !fill) if (border || !fill)
ctx->gdraw->arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, angle1 - rot, angle2, ctx->gdraw->arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, angle1 - rot, angle2,
......
...@@ -300,10 +300,10 @@ void GrowAxis::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -300,10 +300,10 @@ void GrowAxis::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360; double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
glow_eDrawType drawtype = ctx->get_drawtype(draw_type, glow_eDrawType_LineHighlight, glow_eDrawType drawtype = ctx->get_drawtype(draw_type, glow_eDrawType_LineHighlight,
highlight, (GrowNode*)colornode, 0); highlight, (GrowNode*)colornode, 0);
...@@ -508,10 +508,10 @@ void GrowAxis::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -508,10 +508,10 @@ void GrowAxis::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)) - hotw; int ll_x = ROUND(MIN(p1.x, p2.x)) - hotw;
int ur_x = int(MAX(p1.x, p2.x)) + hotw; int ur_x = ROUND(MAX(p1.x, p2.x)) + hotw;
int ll_y = int(MIN(p1.y, p2.y)) - hotw; int ll_y = ROUND(MIN(p1.y, p2.y)) - hotw;
int ur_y = int(MAX(p1.y, p2.y)) + hotw; int ur_y = ROUND(MAX(p1.y, p2.y)) + hotw;
ctx->gdraw->rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, ctx->gdraw->rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
glow_eDrawType_LineErase, 1, 0); glow_eDrawType_LineErase, 1, 0);
...@@ -660,7 +660,7 @@ void GrowAxis::set_range(double minval, double maxval, int keep_settings) ...@@ -660,7 +660,7 @@ void GrowAxis::set_range(double minval, double maxval, int keep_settings)
if (d < 5) if (d < 5)
d = 1000 * d; d = 1000 * d;
int di = (int)(d + 0.5); int di = ROUND(d);
while (di >= 25) while (di >= 25)
di /= 10; di /= 10;
......
...@@ -292,10 +292,10 @@ void GrowAxisArc::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -292,10 +292,10 @@ void GrowAxisArc::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360; double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
glow_eDrawType drawtype = ctx->get_drawtype(draw_type, glow_eDrawType_LineHighlight, glow_eDrawType drawtype = ctx->get_drawtype(draw_type, glow_eDrawType_LineHighlight,
highlight, (GrowNode*)colornode, 0); highlight, (GrowNode*)colornode, 0);
...@@ -393,10 +393,10 @@ void GrowAxisArc::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -393,10 +393,10 @@ void GrowAxisArc::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, ctx->gdraw->arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
angle1 - (int)tmp.rotation, angle2, glow_eDrawType_LineErase, 0, idx); angle1 - (int)tmp.rotation, angle2, glow_eDrawType_LineErase, 0, idx);
...@@ -548,7 +548,7 @@ void GrowAxisArc::set_range(double minval, double maxval, int keep_settings) ...@@ -548,7 +548,7 @@ void GrowAxisArc::set_range(double minval, double maxval, int keep_settings)
if (d < 5) if (d < 5)
d = 1000 * d; d = 1000 * d;
int di = (int)(d + 0.5); int di = ROUND(d);
while (di >= 25) while (di >= 25)
di /= 10; di /= 10;
......
...@@ -275,10 +275,10 @@ void GrowBar::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -275,10 +275,10 @@ void GrowBar::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
if (fill) { if (fill) {
drawtype = ctx->get_drawtype(fill_drawtype, glow_eDrawType_FillHighlight, drawtype = ctx->get_drawtype(fill_drawtype, glow_eDrawType_FillHighlight,
...@@ -403,10 +403,10 @@ void GrowBar::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -403,10 +403,10 @@ void GrowBar::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
if (border) if (border)
ctx->gdraw->rect( ctx->gdraw->rect(
...@@ -520,10 +520,10 @@ void GrowBar::export_javabean(GlowTransform* t, void* node, ...@@ -520,10 +520,10 @@ void GrowBar::export_javabean(GlowTransform* t, void* node,
p2.x = p2.x * ctx->mw.zoom_factor_x - ctx->mw.offset_x; p2.x = p2.x * ctx->mw.zoom_factor_x - ctx->mw.offset_x;
p2.y = p2.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y; p2.y = p2.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360; double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
ctx->export_jbean->bar(ll_x, ll_y, ur_x, ur_y, draw_type, fill_drawtype, ctx->export_jbean->bar(ll_x, ll_y, ur_x, ur_y, draw_type, fill_drawtype,
......
...@@ -255,10 +255,10 @@ void GrowBarArc::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -255,10 +255,10 @@ void GrowBarArc::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360; double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
yscale = double(ur_y - ll_y) / (ur_x - ll_x); yscale = double(ur_y - ll_y) / (ur_x - ll_x);
...@@ -378,10 +378,10 @@ void GrowBarArc::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -378,10 +378,10 @@ void GrowBarArc::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
double rotation = tmp.rotation; double rotation = tmp.rotation;
ctx->gdraw->arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, angle1 - (int)rotation, ctx->gdraw->arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, angle1 - (int)rotation,
...@@ -469,10 +469,10 @@ void GrowBarArc::export_javabean(GlowTransform* t, void* node, ...@@ -469,10 +469,10 @@ void GrowBarArc::export_javabean(GlowTransform* t, void* node,
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360; double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
((GrowCtx*)ctx) ((GrowCtx*)ctx)
......
...@@ -329,10 +329,10 @@ void GrowBarChart::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -329,10 +329,10 @@ void GrowBarChart::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
glow_eGradient grad = gradient; glow_eGradient grad = gradient;
if (gradient == glow_eGradient_No if (gradient == glow_eGradient_No
...@@ -588,10 +588,10 @@ void GrowBarChart::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -588,10 +588,10 @@ void GrowBarChart::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
if (border) if (border)
ctx->gdraw->rect( ctx->gdraw->rect(
...@@ -656,10 +656,10 @@ void GrowBarChart::export_javabean(GlowTransform* t, void* node, ...@@ -656,10 +656,10 @@ void GrowBarChart::export_javabean(GlowTransform* t, void* node,
p2.x = p2.x * ctx->mw.zoom_factor_x - ctx->mw.offset_x; p2.x = p2.x * ctx->mw.zoom_factor_x - ctx->mw.offset_x;
p2.y = p2.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y; p2.y = p2.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360; double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
double ish = shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y); double ish = shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y);
......
...@@ -385,12 +385,12 @@ void GrowConGlue::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -385,12 +385,12 @@ void GrowConGlue::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x) + 0.5); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x) + 0.5); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y) + 0.5); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y) + 0.5); int ur_y = ROUND(MAX(p1.y, p2.y));
int m_x = int((p1.x + p2.x) / 2 + 0.5); int m_x = ROUND((p1.x + p2.x) / 2);
int m_y = int((p1.y + p2.y) / 2 + 0.5); int m_y = ROUND((p1.y + p2.y) / 2);
drawtype = ctx->get_drawtype(draw_type, glow_eDrawType_LineHighlight, drawtype = ctx->get_drawtype(draw_type, glow_eDrawType_LineHighlight,
highlight, (GrowNode*)colornode, 0); highlight, (GrowNode*)colornode, 0);
...@@ -1214,10 +1214,10 @@ void GrowConGlue::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -1214,10 +1214,10 @@ void GrowConGlue::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x) + 0.5); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x) + 0.5); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y) + 0.5); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y) + 0.5); int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->rect(ll_x, ll_y, ur_x - ll_x + 1, ur_y - ll_y + 1, ctx->gdraw->rect(ll_x, ll_y, ur_x - ll_x + 1, ur_y - ll_y + 1,
glow_eDrawType_LineErase, 1, 0); glow_eDrawType_LineErase, 1, 0);
...@@ -1287,12 +1287,12 @@ void GrowConGlue::export_javabean(GlowTransform* t, void* node, ...@@ -1287,12 +1287,12 @@ void GrowConGlue::export_javabean(GlowTransform* t, void* node,
p2.x = p2.x * ctx->mw.zoom_factor_x - ctx->mw.offset_x; p2.x = p2.x * ctx->mw.zoom_factor_x - ctx->mw.offset_x;
p2.y = p2.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y; p2.y = p2.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
int ll_x = int(MIN(p1.x, p2.x) + 0.5); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x) + 0.5); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y) + 0.5); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y) + 0.5); int ur_y = ROUND(MAX(p1.y, p2.y));
int m_x = int((p1.x + p2.x) / 2 + 0.5); int m_x = ROUND((p1.x + p2.x) / 2);
int m_y = int((p1.y + p2.y) / 2 + 0.5); int m_y = ROUND((p1.y + p2.y) / 2);
glow_eDrawType drawtype = ctx->get_drawtype( glow_eDrawType drawtype = ctx->get_drawtype(
draw_type, glow_eDrawType_LineHighlight, highlight, 0, 0); draw_type, glow_eDrawType_LineHighlight, highlight, 0, 0);
......
...@@ -632,10 +632,10 @@ void GrowFolder::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -632,10 +632,10 @@ void GrowFolder::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->rect( ctx->gdraw->rect(
ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, glow_eDrawType_LineErase, 0, idx); ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, glow_eDrawType_LineErase, 0, idx);
......
...@@ -172,12 +172,10 @@ int GrowImage::insert_image(const char* imagefile) ...@@ -172,12 +172,10 @@ int GrowImage::insert_image(const char* imagefile)
if (!original_image) if (!original_image)
return 0; return 0;
current_width = int(ctx->mw.zoom_factor_x / ctx->mw.base_zoom_factor current_width = ROUND(ctx->mw.zoom_factor_x / ctx->mw.base_zoom_factor
* ctx->gdraw->image_get_width(image) * ctx->gdraw->image_get_width(image));
+ 0.5); current_height = ROUND(ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor
current_height = int(ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor * ctx->gdraw->image_get_height(image));
* ctx->gdraw->image_get_height(image)
+ 0.5);
current_color_tone = color_tone; current_color_tone = color_tone;
current_color_lightness = color_lightness; current_color_lightness = color_lightness;
current_color_intensity = color_intensity; current_color_intensity = color_intensity;
...@@ -746,8 +744,8 @@ void GrowImage::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -746,8 +744,8 @@ void GrowImage::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
flip_horiz = flip_horizontal; flip_horiz = flip_horizontal;
} }
if (int(ur_x - ll_x + 0.5) != current_width if (ROUND(ur_x - ll_x) != current_width
|| int(ur_y - ll_y + 0.5) != current_height) { || ROUND(ur_y - ll_y) != current_height) {
sts = 1; sts = 1;
} }
...@@ -786,11 +784,11 @@ void GrowImage::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -786,11 +784,11 @@ void GrowImage::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
if (sts) { if (sts) {
int w, h; int w, h;
if (ABS(rotation) % 180 == 90) { if (ABS(rotation) % 180 == 90) {
w = int(ur_y - ll_y + 0.5); w = ROUND(ur_y - ll_y);
h = int(ur_x - ll_x + 0.5); h = ROUND(ur_x - ll_x);
} else { } else {
w = int(ur_x - ll_x + 0.5); w = ROUND(ur_x - ll_x);
h = int(ur_y - ll_y + 0.5); h = ROUND(ur_y - ll_y);
} }
if (colornode) { if (colornode) {
current_color_tone = ((GrowNode*)colornode)->color_tone; current_color_tone = ((GrowNode*)colornode)->color_tone;
...@@ -858,10 +856,10 @@ void GrowImage::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -858,10 +856,10 @@ void GrowImage::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->rect( ctx->gdraw->rect(
ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, glow_eDrawType_LineErase, 1, 0); ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, glow_eDrawType_LineErase, 1, 0);
......
...@@ -289,10 +289,10 @@ void GrowMenu::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -289,10 +289,10 @@ void GrowMenu::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
if (border) if (border)
ctx->gdraw->rect( ctx->gdraw->rect(
......
...@@ -346,10 +346,10 @@ void GrowPie::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -346,10 +346,10 @@ void GrowPie::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
int rot = int(tmp.rotation); int rot = int(tmp.rotation);
int display_shadow int display_shadow
...@@ -381,7 +381,7 @@ void GrowPie::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -381,7 +381,7 @@ void GrowPie::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
a2 = sector_size[i] / (max_value - min_value) * angle2; a2 = sector_size[i] / (max_value - min_value) * angle2;
if (a1 + a2 > angle1 + angle2) if (a1 + a2 > angle1 + angle2)
a2 = angle1 + angle2 - a1; a2 = angle1 + angle2 - a1;
ia2 = a2 + a1 - ia1 + 0.5; ia2 = ROUND(a2 + a1 - ia1);
fillcolor = ctx->get_drawtype(sector_color[i], fillcolor = ctx->get_drawtype(sector_color[i],
glow_eDrawType_FillHighlight, highlight, (GrowNode*)colornode, 1); glow_eDrawType_FillHighlight, highlight, (GrowNode*)colornode, 1);
...@@ -410,7 +410,7 @@ void GrowPie::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -410,7 +410,7 @@ void GrowPie::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
ctx->gdraw->gradient_fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, ctx->gdraw->gradient_fill_arc(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y,
ia1 - rot, ia2, fillcolor, f1, f2, grad); ia1 - rot, ia2, fillcolor, f1, f2, grad);
} else { } else {
int ish = int(shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y) + 0.5); int ish = ROUND(shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y));
int drawtype_incr = shadow_contrast; int drawtype_incr = shadow_contrast;
if (relief == glow_eRelief_Down) if (relief == glow_eRelief_Down)
drawtype_incr = -shadow_contrast; drawtype_incr = -shadow_contrast;
...@@ -478,10 +478,10 @@ void GrowPie::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -478,10 +478,10 @@ void GrowPie::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
int rot = int(tmp.rotation); int rot = int(tmp.rotation);
if (border) if (border)
...@@ -547,10 +547,10 @@ void GrowPie::export_javabean(GlowTransform* t, void* node, ...@@ -547,10 +547,10 @@ void GrowPie::export_javabean(GlowTransform* t, void* node,
p1.y = p1.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y; p1.y = p1.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
p2.x = p2.x * ctx->mw.zoom_factor_x - ctx->mw.offset_x; p2.x = p2.x * ctx->mw.zoom_factor_x - ctx->mw.offset_x;
p2.y = p2.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y; p2.y = p2.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360; double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
double ish = shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y); double ish = shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y);
......
...@@ -266,23 +266,23 @@ void GrowPolyLine::calculate_shadow(glow_sShadowInfo** s, int* num, int ish, ...@@ -266,23 +266,23 @@ void GrowPolyLine::calculate_shadow(glow_sShadowInfo** s, int* num, int ish,
if (fabs(sx0 - sx1) < DBL_EPSILON) { if (fabs(sx0 - sx1) < DBL_EPSILON) {
if (fabs(sx1 - sx2) < DBL_EPSILON) { if (fabs(sx1 - sx2) < DBL_EPSILON) {
x = sx1 + pos01 * ish; x = sx1 + pos01 * ish;
sp[i].x = int(x + 0.5); sp[i].x = ROUND(x);
sp[i].y = int(sy1 + 0.5); sp[i].y = ROUND(sy1);
} else { } else {
k12 = (sy2 - sy1) / (sx2 - sx1); k12 = (sy2 - sy1) / (sx2 - sx1);
m12 = sy1 - sx1 * k12 + pos12 * ish / fabs(cos(atan(k12))); m12 = sy1 - sx1 * k12 + pos12 * ish / fabs(cos(atan(k12)));
x = sx1 + pos01 * ish; x = sx1 + pos01 * ish;
sp[i].x = int(x + 0.5); sp[i].x = ROUND(x);
sp[i].y = int(k12 * x + m12 + 0.5); sp[i].y = ROUND(k12 * x + m12);
} }
} else if (fabs(sx1 - sx2) < DBL_EPSILON) { } else if (fabs(sx1 - sx2) < DBL_EPSILON) {
k01 = (sy1 - sy0) / (sx1 - sx0); k01 = (sy1 - sy0) / (sx1 - sx0);
m01 = sy0 - sx0 * k01 + pos01 * ish / fabs(cos(atan(k01))); m01 = sy0 - sx0 * k01 + pos01 * ish / fabs(cos(atan(k01)));
x = sx1 + pos12 * ish; x = sx1 + pos12 * ish;
sp[i].x = int(x + 0.5); sp[i].x = ROUND(x);
sp[i].y = int(k01 * x + m01 + 0.5); sp[i].y = ROUND(k01 * x + m01);
} else { } else {
k01 = (sy1 - sy0) / (sx1 - sx0); k01 = (sy1 - sy0) / (sx1 - sx0);
k12 = (sy2 - sy1) / (sx2 - sx1); k12 = (sy2 - sy1) / (sx2 - sx1);
...@@ -291,22 +291,22 @@ void GrowPolyLine::calculate_shadow(glow_sShadowInfo** s, int* num, int ish, ...@@ -291,22 +291,22 @@ void GrowPolyLine::calculate_shadow(glow_sShadowInfo** s, int* num, int ish,
if (fabs(k01 - k12) < DBL_EPSILON) { if (fabs(k01 - k12) < DBL_EPSILON) {
// Identical lines // Identical lines
if (fabs(k01) < DBL_EPSILON) { if (fabs(k01) < DBL_EPSILON) {
sp[i].x = int(sx1 + 0.5); sp[i].x = ROUND(sx1);
sp[i].y = int(m01 + 0.5); sp[i].y = ROUND(m01);
} else { } else {
k12 = -k12; k12 = -k12;
m12 = sy2 - k12 * sx2; m12 = sy2 - k12 * sx2;
x = (m12 - m01) / (k01 - k12); x = (m12 - m01) / (k01 - k12);
sp[i].x = int(x + 0.5); sp[i].x = ROUND(x);
sp[i].y = int(k12 * x + m12 + 0.5); sp[i].y = ROUND(k12 * x + m12);
k12 = k01; k12 = k01;
m12 = m01; m12 = m01;
} }
} else { } else {
x = (m12 - m01) / (k01 - k12); x = (m12 - m01) / (k01 - k12);
sp[i].x = int(x + 0.5); sp[i].x = ROUND(x);
sp[i].y = int(k12 * x + m12 + 0.5); sp[i].y = ROUND(k12 * x + m12);
} }
} }
if (pos12 == 1) if (pos12 == 1)
...@@ -443,9 +443,9 @@ void GrowPolyLine::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -443,9 +443,9 @@ void GrowPolyLine::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
glow_sShadowInfo* sp; glow_sShadowInfo* sp;
int p_num; int p_num;
int ish = int(shadow_width / 100 * tmp.vertical_scale() * int ish = ROUND(shadow_width / 100 * tmp.vertical_scale() *
MIN((x_right - x_left) * w->zoom_factor_x, MIN((x_right - x_left) * w->zoom_factor_x,
(y_high - y_low) * w->zoom_factor_y) + 0.5); (y_high - y_low) * w->zoom_factor_y));
if (ish >= 1) { if (ish >= 1) {
calculate_shadow(&sp, &p_num, ish, highlight, colornode, 0, chot); calculate_shadow(&sp, &p_num, ish, highlight, colornode, 0, chot);
......
...@@ -647,12 +647,12 @@ void GrowRect::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -647,12 +647,12 @@ void GrowRect::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
int ish = int(shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y) + 0.5); int ish = ROUND(shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y));
int display_shadow int display_shadow
= ((node && ((GrowNode*)node)->shadow) || shadow) && !disable_shadow; = ((node && ((GrowNode*)node)->shadow) || shadow) && !disable_shadow;
glow_eDrawType fillcolor; glow_eDrawType fillcolor;
...@@ -827,10 +827,10 @@ void GrowRect::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -827,10 +827,10 @@ void GrowRect::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
int display_shadow int display_shadow
= ((node && ((GrowNode*)node)->shadow) || shadow) && !disable_shadow; = ((node && ((GrowNode*)node)->shadow) || shadow) && !disable_shadow;
......
...@@ -619,14 +619,14 @@ void GrowRectRounded::draw(GlowWind* w, GlowTransform* t, int highlight, ...@@ -619,14 +619,14 @@ void GrowRectRounded::draw(GlowWind* w, GlowTransform* t, int highlight,
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
int amount = int(round_amount / 100 * MIN(ur_x - ll_x, ur_y - ll_y) + 0.5); int amount = ROUND(round_amount / 100 * MIN(ur_x - ll_x, ur_y - ll_y));
if (fill) { if (fill) {
int ish = int(shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y) + 0.5); int ish = ROUND(shadow_width / 100 * MIN(ur_x - ll_x, ur_y - ll_y));
int display_shadow int display_shadow
= ((node && ((GrowNode*)node)->shadow) || shadow) && !disable_shadow; = ((node && ((GrowNode*)node)->shadow) || shadow) && !disable_shadow;
glow_eDrawType fillcolor = ctx->get_drawtype(fill_drawtype, glow_eDrawType fillcolor = ctx->get_drawtype(fill_drawtype,
...@@ -814,12 +814,12 @@ void GrowRectRounded::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -814,12 +814,12 @@ void GrowRectRounded::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
int amount = int(round_amount / 100 * MIN(ur_x - ll_x, ur_y - ll_y) + 0.5); int amount = ROUND(round_amount / 100 * MIN(ur_x - ll_x, ur_y - ll_y));
if (border || !fill) { if (border || !fill) {
ctx->gdraw->line(ll_x + amount, ll_y, ur_x - amount, ll_y, ctx->gdraw->line(ll_x + amount, ll_y, ur_x - amount, ll_y,
glow_eDrawType_LineErase, idx); glow_eDrawType_LineErase, idx);
......
...@@ -97,10 +97,10 @@ void GrowScrollBar::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -97,10 +97,10 @@ void GrowScrollBar::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
glow_eDrawType fdrawtype = ctx->get_drawtype(fill_drawtype, glow_eDrawType fdrawtype = ctx->get_drawtype(fill_drawtype,
glow_eDrawType_FillHighlight, highlight, (GrowNode*)colornode, 1); glow_eDrawType_FillHighlight, highlight, (GrowNode*)colornode, 1);
...@@ -184,10 +184,10 @@ void GrowScrollBar::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -184,10 +184,10 @@ void GrowScrollBar::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->rect( ctx->gdraw->rect(
ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, glow_eDrawType_LineErase, 0, idx); ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, glow_eDrawType_LineErase, 0, idx);
......
...@@ -894,10 +894,10 @@ void GrowTable::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -894,10 +894,10 @@ void GrowTable::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->rect( ctx->gdraw->rect(
ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, glow_eDrawType_LineErase, 0, idx); ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, glow_eDrawType_LineErase, 0, idx);
...@@ -925,10 +925,10 @@ void GrowTable::draw_brief(GlowWind* w, GlowTransform* t, int highlight, ...@@ -925,10 +925,10 @@ void GrowTable::draw_brief(GlowWind* w, GlowTransform* t, int highlight,
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
if (fill) if (fill)
ctx->gdraw->rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fill_drawtype, 1, 0); ctx->gdraw->rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fill_drawtype, 1, 0);
......
...@@ -527,10 +527,10 @@ void GrowTrend::draw(GlowWind* w, GlowTransform* t, int highlight, int hot, ...@@ -527,10 +527,10 @@ void GrowTrend::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
if (fill) { if (fill) {
glow_eGradient grad = gradient; glow_eGradient grad = gradient;
...@@ -724,10 +724,10 @@ void GrowTrend::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -724,10 +724,10 @@ void GrowTrend::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
if (border) if (border)
ctx->gdraw->rect( ctx->gdraw->rect(
......
...@@ -352,10 +352,10 @@ void GrowWindow::erase(GlowWind* w, GlowTransform* t, int hot, void* node) ...@@ -352,10 +352,10 @@ void GrowWindow::erase(GlowWind* w, GlowTransform* t, int hot, void* node)
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->rect( ctx->gdraw->rect(
ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, glow_eDrawType_LineErase, 0, idx); ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, glow_eDrawType_LineErase, 0, idx);
...@@ -380,10 +380,10 @@ void GrowWindow::draw_brief(GlowWind* w, GlowTransform* t, int highlight, ...@@ -380,10 +380,10 @@ void GrowWindow::draw_brief(GlowWind* w, GlowTransform* t, int highlight,
p1.y = p1.y * w->zoom_factor_y - w->offset_y; p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x; p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y; p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)); int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x)); int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y)); int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y)); int ur_y = ROUND(MAX(p1.y, p2.y));
if (window_ctx && fill) if (window_ctx && fill)
ctx->gdraw->rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fill_drawtype, 1, 0); ctx->gdraw->rect(ll_x, ll_y, ur_x - ll_x, ur_y - ll_y, fill_drawtype, 1, 0);
......
...@@ -50,10 +50,10 @@ void GlowPoint::posit(double x1, double y1) ...@@ -50,10 +50,10 @@ void GlowPoint::posit(double x1, double y1)
{ {
x = x1; x = x1;
y = y1; y = y1;
z_x = int(x * ctx->mw.zoom_factor_x + 0.5); z_x = ROUND(x * ctx->mw.zoom_factor_x);
z_y = int(y * ctx->mw.zoom_factor_y + 0.5); z_y = ROUND(y * ctx->mw.zoom_factor_y);
nav_z_x = int(x * ctx->navw.zoom_factor_x + 0.5); nav_z_x = ROUND(x * ctx->navw.zoom_factor_x);
nav_z_y = int(y * ctx->navw.zoom_factor_y + 0.5); nav_z_y = ROUND(y * ctx->navw.zoom_factor_y);
} }
void GlowPoint::posit_z(int x1, int y1) void GlowPoint::posit_z(int x1, int y1)
...@@ -62,21 +62,21 @@ void GlowPoint::posit_z(int x1, int y1) ...@@ -62,21 +62,21 @@ void GlowPoint::posit_z(int x1, int y1)
y = 1.0 * y1 / ctx->mw.zoom_factor_y; y = 1.0 * y1 / ctx->mw.zoom_factor_y;
z_x = x1; z_x = x1;
z_y = y1; z_y = y1;
nav_z_x = int(x * ctx->navw.zoom_factor_x); nav_z_x = ROUND(x * ctx->navw.zoom_factor_x);
nav_z_y = int(y * ctx->navw.zoom_factor_y); nav_z_y = ROUND(y * ctx->navw.zoom_factor_y);
} }
void GlowPoint::zoom() void GlowPoint::zoom()
{ {
z_x = int(x * ctx->mw.zoom_factor_x + 0.5); z_x = ROUND(x * ctx->mw.zoom_factor_x);
z_y = int(y * ctx->mw.zoom_factor_y + 0.5); z_y = ROUND(y * ctx->mw.zoom_factor_y);
current_zoom_factor = ctx->mw.zoom_factor_x; current_zoom_factor = ctx->mw.zoom_factor_x;
} }
void GlowPoint::nav_zoom() void GlowPoint::nav_zoom()
{ {
nav_z_x = int(x * ctx->navw.zoom_factor_x + 0.5); nav_z_x = ROUND(x * ctx->navw.zoom_factor_x);
nav_z_y = int(y * ctx->navw.zoom_factor_y + 0.5); nav_z_y = ROUND(y * ctx->navw.zoom_factor_y);
} }
void GlowPoint::print_zoom() void GlowPoint::print_zoom()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment