Improved compatibility with classic TOS systems.

svn path=/trunk/netsurf/; revision=11450
This commit is contained in:
Ole Loots 2011-01-22 16:43:51 +00:00
parent b8f40265f4
commit c0c423fbca
3 changed files with 37 additions and 12 deletions

View File

@ -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 );
}

View File

@ -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;
}

View File

@ -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 );