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)
{
x = x1;
y = y1;
z_x = int(x * ctx->zoom_factor + 0.5);
z_y = int(y * ctx->zoom_factor + 0.5);
nav_z_x = int(x * ctx->nav_zoom_factor + 0.5);
nav_z_y = int(y * ctx->nav_zoom_factor + 0.5);
z_x = ROUND(x * ctx->zoom_factor);
z_y = ROUND(y * ctx->zoom_factor);
nav_z_x = ROUND(x * ctx->nav_zoom_factor);
nav_z_y = ROUND(y * ctx->nav_zoom_factor);
}
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;
z_x = x1;
z_y = y1;
nav_z_x = int(x * ctx->nav_zoom_factor);
nav_z_y = int(y * ctx->nav_zoom_factor);
nav_z_x = ROUND(x * ctx->nav_zoom_factor);
nav_z_y = ROUND(y * ctx->nav_zoom_factor);
}
void FlowPoint::zoom()
{
z_x = int(x * ctx->zoom_factor + 0.5);
z_y = int(y * ctx->zoom_factor + 0.5);
z_x = ROUND(x * ctx->zoom_factor);
z_y = ROUND(y * ctx->zoom_factor);
}
void FlowPoint::nav_zoom()
{
nav_z_x = int(x * ctx->nav_zoom_factor + 0.5);
nav_z_y = int(y * ctx->nav_zoom_factor + 0.5);
nav_z_x = ROUND(x * ctx->nav_zoom_factor);
nav_z_y = ROUND(y * ctx->nav_zoom_factor);
}
void FlowPoint::print_zoom()
......
......@@ -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;
}
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
if (fill) {
int display_shadow
......@@ -681,7 +681,7 @@ void GrowArc::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
angle1 - rot, angle2, fillcolor, f1, f2, grad);
}
} 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;
if (relief == glow_eRelief_Down)
drawtype_incr = -shadow_contrast;
......@@ -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)
+ (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.y = int(-scale * ((ur.y - ll.y) / 2 * w->zoom_factor_y) + y_c + 0.5);
p2.x = int(scale * ((ur.x - ll.x) / 2 * w->zoom_factor_x) + x_c + 0.5);
p2.y = int(scale * ((ur.y - ll.y) / 2 * w->zoom_factor_y) + y_c + 0.5);
p1.x = -scale * ((ur.x - ll.x) / 2 * w->zoom_factor_x) + x_c;
p1.y = -scale * ((ur.y - ll.y) / 2 * w->zoom_factor_y) + y_c;
p2.x = scale * ((ur.x - ll.x) / 2 * w->zoom_factor_x) + x_c;
p2.y = scale * ((ur.y - ll.y) / 2 * w->zoom_factor_y) + y_c;
} else {
p1.x = int(p1.x * w->zoom_factor_x + 0.5) - w->offset_x;
p1.y = int(p1.y * w->zoom_factor_y + 0.5) - w->offset_y;
p2.x = int(p2.x * w->zoom_factor_x + 0.5) - w->offset_x;
p2.y = int(p2.y * w->zoom_factor_y + 0.5) - w->offset_y;
}
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
p1.x = p1.x * w->zoom_factor_x - w->offset_x;
p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
}
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
if (border || !fill)
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,
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
glow_eDrawType drawtype = ctx->get_drawtype(draw_type, glow_eDrawType_LineHighlight,
highlight, (GrowNode*)colornode, 0);
......@@ -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.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x)) - hotw;
int ur_x = int(MAX(p1.x, p2.x)) + hotw;
int ll_y = int(MIN(p1.y, p2.y)) - hotw;
int ur_y = int(MAX(p1.y, p2.y)) + hotw;
int ll_x = ROUND(MIN(p1.x, p2.x)) - hotw;
int ur_x = ROUND(MAX(p1.x, p2.x)) + hotw;
int ll_y = ROUND(MIN(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,
glow_eDrawType_LineErase, 1, 0);
......@@ -660,7 +660,7 @@ void GrowAxis::set_range(double minval, double maxval, int keep_settings)
if (d < 5)
d = 1000 * d;
int di = (int)(d + 0.5);
int di = ROUND(d);
while (di >= 25)
di /= 10;
......
......@@ -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;
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
glow_eDrawType drawtype = ctx->get_drawtype(draw_type, glow_eDrawType_LineHighlight,
highlight, (GrowNode*)colornode, 0);
......@@ -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.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(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,
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)
if (d < 5)
d = 1000 * d;
int di = (int)(d + 0.5);
int di = ROUND(d);
while (di >= 25)
di /= 10;
......
......@@ -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.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
if (fill) {
drawtype = ctx->get_drawtype(fill_drawtype, glow_eDrawType_FillHighlight,
......@@ -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.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
if (border)
ctx->gdraw->rect(
......@@ -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.y = p2.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
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,
......
......@@ -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.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
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)
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
double rotation = tmp.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,
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
((GrowCtx*)ctx)
......
......@@ -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.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
glow_eGradient grad = gradient;
if (gradient == glow_eGradient_No
......@@ -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.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
if (border)
ctx->gdraw->rect(
......@@ -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.y = p2.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
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,
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x) + 0.5);
int ur_x = int(MAX(p1.x, p2.x) + 0.5);
int ll_y = int(MIN(p1.y, p2.y) + 0.5);
int ur_y = int(MAX(p1.y, p2.y) + 0.5);
int m_x = int((p1.x + p2.x) / 2 + 0.5);
int m_y = int((p1.y + p2.y) / 2 + 0.5);
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
int m_x = ROUND((p1.x + p2.x) / 2);
int m_y = ROUND((p1.y + p2.y) / 2);
drawtype = ctx->get_drawtype(draw_type, glow_eDrawType_LineHighlight,
highlight, (GrowNode*)colornode, 0);
......@@ -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.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x) + 0.5);
int ur_x = int(MAX(p1.x, p2.x) + 0.5);
int ll_y = int(MIN(p1.y, p2.y) + 0.5);
int ur_y = int(MAX(p1.y, p2.y) + 0.5);
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
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,
glow_eDrawType_LineErase, 1, 0);
......@@ -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.y = p2.y * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
int ll_x = int(MIN(p1.x, p2.x) + 0.5);
int ur_x = int(MAX(p1.x, p2.x) + 0.5);
int ll_y = int(MIN(p1.y, p2.y) + 0.5);
int ur_y = int(MAX(p1.y, p2.y) + 0.5);
int m_x = int((p1.x + p2.x) / 2 + 0.5);
int m_y = int((p1.y + p2.y) / 2 + 0.5);
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
int m_x = ROUND((p1.x + p2.x) / 2);
int m_y = ROUND((p1.y + p2.y) / 2);
glow_eDrawType drawtype = ctx->get_drawtype(
draw_type, glow_eDrawType_LineHighlight, highlight, 0, 0);
......
......@@ -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;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->rect(
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)
if (!original_image)
return 0;
current_width = int(ctx->mw.zoom_factor_x / ctx->mw.base_zoom_factor
* ctx->gdraw->image_get_width(image)
+ 0.5);
current_height = int(ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor
* ctx->gdraw->image_get_height(image)
+ 0.5);
current_width = ROUND(ctx->mw.zoom_factor_x / ctx->mw.base_zoom_factor
* ctx->gdraw->image_get_width(image));
current_height = ROUND(ctx->mw.zoom_factor_y / ctx->mw.base_zoom_factor
* ctx->gdraw->image_get_height(image));
current_color_tone = color_tone;
current_color_lightness = color_lightness;
current_color_intensity = color_intensity;
......@@ -746,8 +744,8 @@ void GrowImage::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
flip_horiz = flip_horizontal;
}
if (int(ur_x - ll_x + 0.5) != current_width
|| int(ur_y - ll_y + 0.5) != current_height) {
if (ROUND(ur_x - ll_x) != current_width
|| ROUND(ur_y - ll_y) != current_height) {
sts = 1;
}
......@@ -786,11 +784,11 @@ void GrowImage::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
if (sts) {
int w, h;
if (ABS(rotation) % 180 == 90) {
w = int(ur_y - ll_y + 0.5);
h = int(ur_x - ll_x + 0.5);
w = ROUND(ur_y - ll_y);
h = ROUND(ur_x - ll_x);
} else {
w = int(ur_x - ll_x + 0.5);
h = int(ur_y - ll_y + 0.5);
w = ROUND(ur_x - ll_x);
h = ROUND(ur_y - ll_y);
}
if (colornode) {
current_color_tone = ((GrowNode*)colornode)->color_tone;
......@@ -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;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->rect(
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)
p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
if (border)
ctx->gdraw->rect(
......
......@@ -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;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
int rot = int(tmp.rotation);
int display_shadow
......@@ -381,7 +381,7 @@ void GrowPie::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
a2 = sector_size[i] / (max_value - min_value) * angle2;
if (a1 + a2 > angle1 + angle2)
a2 = angle1 + angle2 - a1;
ia2 = a2 + a1 - ia1 + 0.5;
ia2 = ROUND(a2 + a1 - ia1);
fillcolor = ctx->get_drawtype(sector_color[i],
glow_eDrawType_FillHighlight, highlight, (GrowNode*)colornode, 1);
......@@ -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,
ia1 - rot, ia2, fillcolor, f1, f2, grad);
} 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;
if (relief == glow_eRelief_Down)
drawtype_incr = -shadow_contrast;
......@@ -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;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
int rot = int(tmp.rotation);
if (border)
......@@ -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;
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;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
double rotation = (tmp.rotation / 360 - floor(tmp.rotation / 360)) * 360;
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,
if (fabs(sx0 - sx1) < DBL_EPSILON) {
if (fabs(sx1 - sx2) < DBL_EPSILON) {
x = sx1 + pos01 * ish;
sp[i].x = int(x + 0.5);
sp[i].y = int(sy1 + 0.5);
sp[i].x = ROUND(x);
sp[i].y = ROUND(sy1);
} else {
k12 = (sy2 - sy1) / (sx2 - sx1);
m12 = sy1 - sx1 * k12 + pos12 * ish / fabs(cos(atan(k12)));
x = sx1 + pos01 * ish;
sp[i].x = int(x + 0.5);
sp[i].y = int(k12 * x + m12 + 0.5);
sp[i].x = ROUND(x);
sp[i].y = ROUND(k12 * x + m12);
}
} else if (fabs(sx1 - sx2) < DBL_EPSILON) {
k01 = (sy1 - sy0) / (sx1 - sx0);
m01 = sy0 - sx0 * k01 + pos01 * ish / fabs(cos(atan(k01)));
x = sx1 + pos12 * ish;
sp[i].x = int(x + 0.5);
sp[i].y = int(k01 * x + m01 + 0.5);
sp[i].x = ROUND(x);
sp[i].y = ROUND(k01 * x + m01);
} else {
k01 = (sy1 - sy0) / (sx1 - sx0);
k12 = (sy2 - sy1) / (sx2 - sx1);
......@@ -291,22 +291,22 @@ void GrowPolyLine::calculate_shadow(glow_sShadowInfo** s, int* num, int ish,
if (fabs(k01 - k12) < DBL_EPSILON) {
// Identical lines
if (fabs(k01) < DBL_EPSILON) {
sp[i].x = int(sx1 + 0.5);
sp[i].y = int(m01 + 0.5);
sp[i].x = ROUND(sx1);
sp[i].y = ROUND(m01);
} else {
k12 = -k12;
m12 = sy2 - k12 * sx2;
x = (m12 - m01) / (k01 - k12);
sp[i].x = int(x + 0.5);
sp[i].y = int(k12 * x + m12 + 0.5);
sp[i].x = ROUND(x);
sp[i].y = ROUND(k12 * x + m12);
k12 = k01;
m12 = m01;
}
} else {
x = (m12 - m01) / (k01 - k12);
sp[i].x = int(x + 0.5);
sp[i].y = int(k12 * x + m12 + 0.5);
sp[i].x = ROUND(x);
sp[i].y = ROUND(k12 * x + m12);
}
}
if (pos12 == 1)
......@@ -443,9 +443,9 @@ void GrowPolyLine::draw(GlowWind* w, GlowTransform* t, int highlight, int hot,
glow_sShadowInfo* sp;
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,
(y_high - y_low) * w->zoom_factor_y) + 0.5);
(y_high - y_low) * w->zoom_factor_y));
if (ish >= 1) {
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,
p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(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
= ((node && ((GrowNode*)node)->shadow) || shadow) && !disable_shadow;
glow_eDrawType fillcolor;
......@@ -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;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
int display_shadow
= ((node && ((GrowNode*)node)->shadow) || shadow) && !disable_shadow;
......
......@@ -619,14 +619,14 @@ void GrowRectRounded::draw(GlowWind* w, GlowTransform* t, int highlight,
p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(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) {
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
= ((node && ((GrowNode*)node)->shadow) || shadow) && !disable_shadow;
glow_eDrawType fillcolor = ctx->get_drawtype(fill_drawtype,
......@@ -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;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(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) {
ctx->gdraw->line(ll_x + amount, ll_y, ur_x - amount, ll_y,
glow_eDrawType_LineErase, idx);
......
......@@ -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;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
glow_eDrawType fdrawtype = ctx->get_drawtype(fill_drawtype,
glow_eDrawType_FillHighlight, highlight, (GrowNode*)colornode, 1);
......@@ -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;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->rect(
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)
p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->rect(
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,
p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
if (fill)
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,
p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
if (fill) {
glow_eGradient grad = gradient;
......@@ -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;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
if (border)
ctx->gdraw->rect(
......
......@@ -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;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
ctx->gdraw->rect(
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,
p1.y = p1.y * w->zoom_factor_y - w->offset_y;
p2.x = p2.x * w->zoom_factor_x - w->offset_x;
p2.y = p2.y * w->zoom_factor_y - w->offset_y;
int ll_x = int(MIN(p1.x, p2.x));
int ur_x = int(MAX(p1.x, p2.x));
int ll_y = int(MIN(p1.y, p2.y));
int ur_y = int(MAX(p1.y, p2.y));
int ll_x = ROUND(MIN(p1.x, p2.x));
int ur_x = ROUND(MAX(p1.x, p2.x));
int ll_y = ROUND(MIN(p1.y, p2.y));
int ur_y = ROUND(MAX(p1.y, p2.y));
if (window_ctx && fill)
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)
{
x = x1;
y = y1;
z_x = int(x * ctx->mw.zoom_factor_x + 0.5);
z_y = int(y * ctx->mw.zoom_factor_y + 0.5);
nav_z_x = int(x * ctx->navw.zoom_factor_x + 0.5);
nav_z_y = int(y * ctx->navw.zoom_factor_y + 0.5);
z_x = ROUND(x * ctx->mw.zoom_factor_x);
z_y = ROUND(y * ctx->mw.zoom_factor_y);
nav_z_x = ROUND(x * ctx->navw.zoom_factor_x);
nav_z_y = ROUND(y * ctx->navw.zoom_factor_y);
}
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;
z_x = x1;
z_y = y1;
nav_z_x = int(x * ctx->navw.zoom_factor_x);
nav_z_y = int(y * ctx->navw.zoom_factor_y);
nav_z_x = ROUND(x * ctx->navw.zoom_factor_x);
nav_z_y = ROUND(y * ctx->navw.zoom_factor_y);
}
void GlowPoint::zoom()
{
z_x = int(x * ctx->mw.zoom_factor_x + 0.5);
z_y = int(y * ctx->mw.zoom_factor_y + 0.5);
z_x = ROUND(x * ctx->mw.zoom_factor_x);
z_y = ROUND(y * ctx->mw.zoom_factor_y);
current_zoom_factor = ctx->mw.zoom_factor_x;
}
void GlowPoint::nav_zoom()
{
nav_z_x = int(x * ctx->navw.zoom_factor_x + 0.5);
nav_z_y = int(y * ctx->navw.zoom_factor_y + 0.5);
nav_z_x = ROUND(x * ctx->navw.zoom_factor_x);
nav_z_y = ROUND(y * ctx->navw.zoom_factor_y);
}
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