From c0c423fbcab22476ec90be202d8ad887cd441148 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Sat, 22 Jan 2011 16:43:51 +0000 Subject: Improved compatibility with classic TOS systems. svn path=/trunk/netsurf/; revision=11450 --- atari/plot/font_vdi.c | 26 +++++++++++++++++++------- atari/plot/plotter.c | 8 ++++++-- atari/plot/plotter_vdi.c | 15 ++++++++++++--- 3 files changed, 37 insertions(+), 12 deletions(-) (limited to 'atari/plot') diff --git a/atari/plot/font_vdi.c b/atari/plot/font_vdi.c index 04a94734e..7d6a3f494 100644 --- a/atari/plot/font_vdi.c +++ b/atari/plot/font_vdi.c @@ -42,7 +42,11 @@ static int pixel_position( FONT_PLOTTER self, const plot_font_style_t *fstyle,co static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle ); static bool init = false; -static int vdih; +static int vdih; + +extern struct s_vdi_sysinfo vdi_sysinfo; +extern unsigned short gdosversion; + int ctor_font_plotter_vdi( FONT_PLOTTER self ) { self->dtor = dtor; @@ -202,14 +206,22 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng pass it as arg, to reduce netsurf dependency */ pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); } - vst_effects( self->vdi_handle, fx ); - vst_alignment(vdih, 0, 4, &cw, &ch ); - vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); - vswr_mode( self->vdi_handle, MD_TRANS ); - vst_color( self->vdi_handle, RGB_TO_VDI(fstyle->foreground) ); x += CURFB(self->plotter).x; y += CURFB(self->plotter).y; - v_ftext( self->vdi_handle, x, y, (char*)&textcpy ); + vst_effects( self->vdi_handle, fx ); + vst_alignment(vdih, 0, 4, &cw, &ch ); + vst_height( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh); + vswr_mode( self->vdi_handle, MD_TRANS ); + if( vdi_sysinfo.scr_bpp >= 4 ){ + vst_color( self->vdi_handle, RGB_TO_VDI(fstyle->foreground) ); + } else { + vst_color( self->vdi_handle, BLACK ); + } + if( gdosversion > 0x03000 ){ + v_ftext( self->vdi_handle, x, y, (char*)&textcpy ); + } else { + v_gtext( self->vdi_handle, x, y, (char*)&textcpy ); + } free( lstr ); return( 0 ); } diff --git a/atari/plot/plotter.c b/atari/plot/plotter.c index d21b46540..a54c15f6d 100644 --- a/atari/plot/plotter.c +++ b/atari/plot/plotter.c @@ -34,7 +34,11 @@ #include "atari/plot/plotter_vdi.h" #include "atari/plot/font_vdi.h" #include "atari/plot/font_freetype.h" +#include "atari/gui.h" #include "utils/log.h" +#include "atari/misc.h" + +extern unsigned short gdosversion; unsigned char rgb_web_pal[216][3] = { @@ -141,7 +145,7 @@ struct s_vdi_sysinfo * read_vdi_sysinfo( short vdih, struct s_vdi_sysinfo * info memset( info, 0, sizeof(struct s_vdi_sysinfo) ); info->vdi_handle = vdih; - if ( Getcookie(C_EdDI, &cookie_EdDI) == C_NOTFOUND ) { + if ( tos_getcookie(C_EdDI, &cookie_EdDI) == C_NOTFOUND ) { info->EdDiVersion = 0; } else { info->EdDiVersion = EdDI_version( (void *)cookie_EdDI ); @@ -187,7 +191,7 @@ struct s_vdi_sysinfo * read_vdi_sysinfo( short vdih, struct s_vdi_sysinfo * info info->pixelsize=8; break; default: - info->pixelsize=0; + info->pixelsize=1; break; } diff --git a/atari/plot/plotter_vdi.c b/atari/plot/plotter_vdi.c index e825d92d3..60153f64c 100644 --- a/atari/plot/plotter_vdi.c +++ b/atari/plot/plotter_vdi.c @@ -124,8 +124,9 @@ int ctor_plotter_vdi(GEM_PLOTTER self ) DUMMY_PRIV(self)->bufops = C2P; self->bpp_virt = 8; } - if( FIRSTFB(self).w > vdi_sysinfo.scr_w || FIRSTFB(self).h > vdi_sysinfo.scr_h ) + if( FIRSTFB(self).w > vdi_sysinfo.scr_w || FIRSTFB(self).h > vdi_sysinfo.scr_h ){ return( 0-ERR_BUFFERSIZE_EXCEEDS_SCREEN ); + } FIRSTFB(self).size = calc_chunked_buffer_size( FIRSTFB(self).w, FIRSTFB(self).h, FIRSTFB(self).w, self->bpp_virt ); /* offscreen: FIRSTFB(self).mem = malloc( FIRSTFB(self).size ); */ @@ -280,6 +281,7 @@ static void * lock( GEM_PLOTTER self ) self->flags |= PLOT_FLAG_LOCKED; wind_update(BEG_UPDATE); wind_update(BEG_MCTRL); + graf_mouse(M_OFF, NULL); return( NULL ); } @@ -289,6 +291,7 @@ static int unlock( GEM_PLOTTER self ) self->flags &= ~PLOT_FLAG_LOCKED; wind_update(END_MCTRL); wind_update(END_UPDATE); + graf_mouse(M_ON, NULL); return( 1 ); } @@ -502,7 +505,10 @@ static int line(GEM_PLOTTER self,int x0, int y0, int x1, int y1, const plot_styl NSLT2VDI(lt, pstyle) vsl_type( self->vdi_handle, lt ); vsl_width( self->vdi_handle, (short)sw ); - vsl_color( self->vdi_handle, RGB_TO_VDI(pstyle->stroke_colour) ); + if( vdi_sysinfo.scr_bpp > 4) + vsl_color( self->vdi_handle, RGB_TO_VDI(pstyle->stroke_colour) ); + else + vsl_color( self->vdi_handle, BLACK ); v_pline(self->vdi_handle, 2, (short *)&pxy ); /* plotter_vdi_clip( self, 0); */ return ( 1 ); @@ -533,7 +539,10 @@ static int rectangle(GEM_PLOTTER self,int x0, int y0, int x1, int y1, const plo if( !rc_intersect( &rclip, &r ) ) { return( 1 ); } - vsf_color( self->vdi_handle, RGB_TO_VDI(pstyle->fill_colour) ); + if( vdi_sysinfo.scr_bpp > 4) + vsf_color( self->vdi_handle, RGB_TO_VDI(pstyle->fill_colour) ); + else + vsf_color( self->vdi_handle, WHITE ); vsf_perimeter( self->vdi_handle, 0); vsf_interior( self->vdi_handle, FIS_SOLID ); -- cgit v1.2.3