Commit b1020a09 authored by claes's avatar claes

Grid draw improved

parent fcc540de
/*
* Proview $Id: glow_draw_gtk.cpp,v 1.6 2007-07-17 12:43:42 claes Exp $
* Proview $Id: glow_draw_gtk.cpp,v 1.7 2007-08-20 08:23:16 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -2295,6 +2295,10 @@ int GlowDrawGtk::draw_points( GlowWind *wind, glow_sPointX *points, int point_nu
gdk_draw_points( w->window,
get_gc( this, gc_type, 0),
gpoints, point_num);
if ( w->double_buffer_on)
gdk_draw_points( w->buffer,
get_gc( this, gc_type, 0),
gpoints, point_num);
free( gpoints);
if ( w->clip_on)
......@@ -2504,7 +2508,7 @@ int GlowDrawGtk::print( char *filename, double x0, double x1, int end)
if ( new_file) {
ps->fp <<
"%!PS-Adobe-2.0 EPSF-1.2" << endl <<
"%%Creator: Proview $Id: glow_draw_gtk.cpp,v 1.6 2007-07-17 12:43:42 claes Exp $ Glow" << endl <<
"%%Creator: Proview $Id: glow_draw_gtk.cpp,v 1.7 2007-08-20 08:23:16 claes Exp $ Glow" << endl <<
"%%EndComments" << endl << endl;
}
else
......
/*
* Proview $Id: glow_draw_xlib.cpp,v 1.6 2007-07-17 12:53:31 claes Exp $
* Proview $Id: glow_draw_xlib.cpp,v 1.7 2007-08-20 08:23:16 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -2480,6 +2480,10 @@ int GlowDrawXLib::draw_points( GlowWind *wind, glow_sPointX *points, int point_n
XDrawPoints( display, w->window,
get_gc( this, gc_type, 0),
(XPoint *) points, point_num, CoordModeOrigin);
if ( w->double_buffer_on)
XDrawPoints( display, w->buffer,
get_gc( this, gc_type, 0),
(XPoint *) points, point_num, CoordModeOrigin);
if ( w->clip_on)
reset_clip( w, get_gc( this, gc_type, 0));
......@@ -2716,7 +2720,7 @@ int GlowDrawXLib::print( char *filename, double x0, double x1, int end)
if ( new_file) {
ps->fp <<
"%!PS-Adobe-2.0 EPSF-1.2" << endl <<
"%%Creator: Proview $Id: glow_draw_xlib.cpp,v 1.6 2007-07-17 12:53:31 claes Exp $ Glow" << endl <<
"%%Creator: Proview $Id: glow_draw_xlib.cpp,v 1.7 2007-08-20 08:23:16 claes Exp $ Glow" << endl <<
"%%EndComments" << endl << endl;
}
else
......
/*
* Proview $Id: glow_ctx.cpp,v 1.17 2007-07-18 13:16:58 claes Exp $
* Proview $Id: glow_ctx.cpp,v 1.18 2007-08-20 08:23:16 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -2061,7 +2061,7 @@ void GlowCtx::scroll( int delta_x, int delta_y)
void GlowCtx::draw_grid( GlowWind *w, int ll_x, int ll_y, int ur_x, int ur_y)
{
int x, y, x0, x1, y0, y1, i, j;
int x0, x1, y0, y1, i, j;
int point_num;
x0 = int( (ll_x + mw.offset_x) / mw.zoom_factor_x / grid_size_x);
......@@ -2078,13 +2078,17 @@ void GlowCtx::draw_grid( GlowWind *w, int ll_x, int ll_y, int ur_x, int ur_y)
if ( point_num <= 0 || point_num >= 250000)
return;
glow_sPointX *p = (glow_sPointX *)calloc( point_num, sizeof(glow_sPointX));
int idx = 0;
for ( i = x0; i <= x1; i++) {
for ( j = y0; j <= y1; j++) {
x = int( grid_size_x * i * mw.zoom_factor_x) - mw.offset_x;
y = int( grid_size_y * j * mw.zoom_factor_y) - mw.offset_y;
gdraw->draw_point( &mw, x, y, glow_eDrawType_Line);
p[idx].x = int( grid_size_x * i * mw.zoom_factor_x) - mw.offset_x;
p[idx].y = int( grid_size_y * j * mw.zoom_factor_y) - mw.offset_y;
idx++;
}
}
gdraw->draw_points( &mw, p, point_num, glow_eDrawType_Line);
free( p);
}
void GlowCtx::set_show_grid( int show)
......
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