Fixed header, made different font plotters optional.

svn path=/trunk/netsurf/; revision=13230
This commit is contained in:
Ole Loots 2011-12-04 12:53:03 +00:00
parent 905b3c2641
commit 7d4a0be284
8 changed files with 137 additions and 110 deletions

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef WITH_FREETYPE_FONT_DRIVER
#include <ft2build.h>
#include FT_CACHE_H
@ -46,15 +46,15 @@ static struct bitmap * fontbmp;
static ftc_faceid_t *font_faces[FONT_FACE_COUNT];
static int dtor( FONT_PLOTTER self );
static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle,
static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle,
const char * str, size_t length, int * width );
static int str_split( FONT_PLOTTER self, const plot_font_style_t *fstyle,
const char *string, size_t length,int x,
const char *string, size_t length,int x,
size_t *char_offset, int *actual_x );
static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *fstyle,
const char *string, size_t length,int x,
const char *string, size_t length,int x,
size_t *char_offset, int *actual_x );
static int text( FONT_PLOTTER self, int x, int y, const char *text,
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;
@ -96,7 +96,6 @@ ft_new_face(const char *option, const char *resname, const char *fontfile)
FT_Error error;
FT_Face aface;
char buf[PATH_MAX];
char resname2[PATH_MAX];
newf = calloc(1, sizeof(ftc_faceid_t));
if (option != NULL) {
@ -217,7 +216,7 @@ static bool ft_font_init(void)
error = FTC_ImageCache_New(ft_cmanager, &ft_image_cache);
font_faces[FONT_FACE_SANS_SERIF] = NULL;
font_faces[FONT_FACE_SANS_SERIF] = ft_new_face(
font_faces[FONT_FACE_SANS_SERIF] = ft_new_face(
option_atari_face_sans_serif,
"fonts/ss.ttf",
DEJAVU_PATH"DejaVuSans.ttf"
@ -274,7 +273,7 @@ static bool ft_font_init(void)
"fonts/fantasy.ttf",
DEJAVU_PATH"DejaVuSerifCondensed-Bold.ttf");
/* set the default render mode */
/* set the default render mode */
if (option_atari_font_monochrom == true)
ft_load_type = FT_LOAD_MONOCHROME;
else
@ -382,7 +381,7 @@ static void draw_glyph8(FONT_PLOTTER self, GRECT * loc, uint8_t * pixdata, int p
x = loc->g_x;
y = loc->g_y;
w = loc->g_w;
h = loc->g_h;
h = loc->g_h;
clip.g_x = self->plotter->clipping.x0;
clip.g_y = self->plotter->clipping.y0;
@ -391,7 +390,7 @@ static void draw_glyph8(FONT_PLOTTER self, GRECT * loc, uint8_t * pixdata, int p
if( !rc_intersect( &clip, loc ) ){
return;
}
}
assert( loc->g_w > 0 );
assert( loc->g_h > 0 );
@ -409,28 +408,29 @@ static void draw_glyph8(FONT_PLOTTER self, GRECT * loc, uint8_t * pixdata, int p
assert( fontbmp );
assert( fontbmp->pixdata );
bmpstride = bitmap_get_rowstride(fontbmp);
for( yloop = 0; yloop < h; yloop++) {
for( yloop = 0; yloop < h; yloop++) {
linebuf = (uint32_t *)(fontbmp->pixdata + (bmpstride * yloop));
for(xloop = 0; xloop < w; xloop++){
fontpix = (uint32_t)(pixdata[(( yoff + yloop ) * pitch) + xloop + xoff]);
linebuf[xloop] = (uint32_t)(colour | fontpix);
}
}
}
self->plotter->bitmap( self->plotter, fontbmp, loc->g_x, loc->g_y, 0, 0);
}
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length,
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length,
const plot_font_style_t *fstyle )
{
uint32_t ucs4;
size_t nxtchr = 0;
FT_Glyph glyph;
FT_BitmapGlyph bglyph;
GRECT loc, clip;
GRECT loc;
uint32_t c = fstyle->foreground ;
/* in -> BGR */
/* out -> ARGB */
c = ABGR_TO_RGB(c);
c = ABGR_TO_RGB(c);
while (nxtchr < length) {
ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr);
nxtchr = utf8_next(text, length, nxtchr);
@ -444,16 +444,16 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
loc.g_x = x + bglyph->left;
loc.g_y = y - bglyph->top;
loc.g_w = bglyph->bitmap.width;
loc.g_h = bglyph->bitmap.rows;
loc.g_h = bglyph->bitmap.rows;
if (bglyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) {
assert( 1 == 0 );
} else {
if( loc.g_w > 0) {
draw_glyph8( self,
&loc,
bglyph->bitmap.buffer,
bglyph->bitmap.pitch,
draw_glyph8( self,
&loc,
bglyph->bitmap.buffer,
bglyph->bitmap.pitch,
c
);
}
@ -482,12 +482,14 @@ int ctor_font_plotter_freetype( FONT_PLOTTER self )
}
return( 1 );
}
}
static int dtor( FONT_PLOTTER self )
{
ft_font_finalise();
if( fontbmp == NULL )
if( fontbmp == NULL )
bitmap_destroy( fontbmp );
return( 1 );
}
}
#endif

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef WITH_INTERNAL_FONT_DRIVER
#include "atari/plot/plotter.h"
#include "atari/plot/font_internal.h"
@ -31,7 +31,7 @@ static int dtor( FONT_PLOTTER self );
static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const char * str, size_t length, int * width );
static int str_split( FONT_PLOTTER self, const plot_font_style_t *fstyle,const char *string,
size_t length,int x, size_t *char_offset, int *actual_x );
static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *fstyle,const char *string,
static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *fstyle,const char *string,
size_t length,int x, size_t *char_offset, int *actual_x );
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle );
@ -94,17 +94,17 @@ int ctor_font_plotter_internal( FONT_PLOTTER self )
}
init = true;
return( 1 );
}
}
static int dtor( FONT_PLOTTER self )
{
if( tmp.fd_addr != NULL ){
free( tmp.fd_addr );
free( tmp.fd_addr );
}
return( 1 );
}
static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const char * str,
static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const char * str,
size_t length, int * width )
{
const struct fb_font_desc* fb_font = fb_get_font(fstyle);
@ -112,7 +112,7 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const c
return( 1 );
}
static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const char *string,
static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const char *string,
size_t length,int x, size_t *char_offset, int *actual_x )
{
const struct fb_font_desc* fb_font = fb_get_font(fstyle);
@ -130,7 +130,7 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
return( 1 );
}
static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const char *string,
static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const char *string,
size_t length,int x, size_t *char_offset, int *actual_x )
{
const struct fb_font_desc* fb_font = fb_get_font(fstyle);
@ -149,11 +149,11 @@ static void draw_glyph1(FONT_PLOTTER self, GRECT *inloc, uint8_t *chrp, int pitc
int xloop,yloop;
int stride = pitch / 8;
uint32_t * linebuf;
GRECT loc = *inloc;
GRECT loc = *inloc;
fontbmp = bitmap_realloc( loc.g_w, loc.g_h, fontbmp->bpp, loc.g_w * fontbmp->bpp, BITMAP_GROW, fontbmp );
bmpstride = bitmap_get_rowstride(fontbmp);
for( yloop = 0; yloop < loc.g_h; yloop++) {
for( yloop = 0; yloop < loc.g_h; yloop++) {
uint32_t pixmask = 1 ;
linebuf = (uint32_t *)(fontbmp->pixdata + (bmpstride * yloop));
fontdata = (uint32_t*)(chrp + (stride*yloop));
@ -165,7 +165,7 @@ static void draw_glyph1(FONT_PLOTTER self, GRECT *inloc, uint8_t *chrp, int pitc
self->plotter->bitmap( self->plotter, fontbmp, loc.g_x, loc.g_y, 0, BITMAP_MONOGLYPH );
}
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length,
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length,
const plot_font_style_t *fstyle )
{
const struct fb_font_desc* fb_font = fb_get_font(fstyle);
@ -191,11 +191,11 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
if ( blen < 1 ) {
return( 1 );
}
if( self->plotter->flags & PLOT_FLAG_OFFSCREEN ){
/* when the plotter is an offscreen plotter the call to
bitmap() isn't that expensive. Draw an 8 bit bitmap into the
offscreen buffer.
/* when the plotter is an offscreen plotter the call to
bitmap() isn't that expensive. Draw an 8 bit bitmap into the
offscreen buffer.
*/
c = fstyle->foreground;
/* in -> BGR */
@ -228,14 +228,14 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
tmp.fd_addr = buf;
memset( tmp.fd_addr, 0, size );
}
int ypos;
short ypos;
int rowsize = tmp.fd_wdwidth << 1;
char * d;
uint32_t * pp;
for (chr = 0; chr < blen; chr++) {
pp = (uint32_t*)fb_font->data + ((unsigned char)buffer[chr] * fb_font->height);
d = ((uint8_t*)tmp.fd_addr) + chr;
for( ypos=0; (unsigned int)ypos<loc.g_h; ypos++){
for( ypos=0; ypos<loc.g_h; ypos++){
*d = (unsigned char)*pp++;
d += rowsize;
}
@ -243,7 +243,7 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
unsigned short out[4];
rgb_to_vdi1000( (unsigned char*)&fstyle->foreground, (unsigned short*)&out );
vs_color( self->plotter->vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0] );
self->plotter->plot_mfdb( self->plotter, &loc, &tmp, PLOT_FLAG_TRANS );
self->plotter->plot_mfdb( self->plotter, &loc, &tmp, PLOT_FLAG_TRANS );
}
free(buffer);
@ -2348,3 +2348,4 @@ const struct fb_font_desc font_regular = {
.encoding = "CP1252",
.data = fontdata_regular,
};
#endif

View File

@ -15,7 +15,8 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#ifdef WITH_INTERNAL_FONT_DRIVER
#ifndef FONT_PLOTTER_INTERNAL
#define FONT_PLOTTER_INTERNAL
@ -29,4 +30,5 @@ struct fb_font_desc {
};
#endif
#endif
#endif

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef WITH_VDI_FONT_DRIVER
#include "atari/plot/plotter.h"
#include "atari/plot/font_vdi.h"
@ -31,7 +31,7 @@ static int dtor( FONT_PLOTTER self );
static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const char * str, size_t length, int * width );
static int str_split( FONT_PLOTTER self, const plot_font_style_t *fstyle,const char *string,
size_t length,int x, size_t *char_offset, int *actual_x );
static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *fstyle,const char *string,
static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t *fstyle,const char *string,
size_t length,int x, size_t *char_offset, int *actual_x );
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle );
@ -53,18 +53,18 @@ int ctor_font_plotter_vdi( FONT_PLOTTER self )
}
init = true;
return( 1 );
}
}
static int dtor( FONT_PLOTTER self )
{
return( 1 );
}
static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const char * str,
static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const char * str,
size_t length, int * width )
{
short cw, ch, cellw, cellh;
short pxsize;
short pxsize;
short fx=0;
lstr = (char*)str;
utf8_to_enc(str, "ATARIST", length, &lstr );
@ -76,7 +76,7 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const c
if( fstyle->flags & FONTF_OBLIQUE )
fx |= 16;
if( fstyle->weight > 450 )
fx |= 1;
fx |= 1;
vst_effects( self->vdi_handle, fx );
/* TODO: replace 90 with global dpi setting */
pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
@ -87,11 +87,11 @@ static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const c
return( 0 );
}
static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const char *string,
static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const char *string,
size_t length,int x, size_t *char_offset, int *actual_x )
{
short cw, ch, cellw, cellh;
short pxsize;
short pxsize;
short fx=0;
int i;
lstr = (char*)string;
@ -106,9 +106,9 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
if( fstyle->flags & FONTF_OBLIQUE )
fx |= 16;
fx |= 16;
if( fstyle->weight > 450 )
fx |= 1;
fx |= 1;
vst_effects( self->vdi_handle, fx );
pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh);
@ -119,11 +119,11 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
if( lstr[i] == ' ' ) {
last_space_x = *actual_x;
last_space_idx = cpos;
}
}
if( *actual_x > x ) {
*actual_x = last_space_x;
*char_offset = last_space_idx;
return true;
return true;
}
*actual_x += cellw;
cpos++;
@ -134,13 +134,13 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
return( 0 );
}
static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const char *string,
static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const char *string,
size_t length,int x, size_t *char_offset, int *actual_x )
{
short cw, ch, cellw, cellh;
short pxsize=0;
short pxsize=0;
short fx=0;
lstr = (char*)string;
int i=0;
int curpx=0;
@ -150,7 +150,7 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
if( fstyle->flags & FONTF_OBLIQUE )
fx |= 16;
fx |= 16;
if( fstyle->weight > 450 )
fx |= 1;
vst_effects( self->vdi_handle, fx );
@ -163,7 +163,7 @@ static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const
if( *actual_x > x) {
*actual_x -= cellw;
*char_offset = i;
break;
break;
}
}
free( (void*)lstr );
@ -175,7 +175,7 @@ static inline void vst_rgbcolor( short vdih, uint32_t cin )
{
if( vdi_sysinfo.scr_bpp > 8 ) {
unsigned short c[4];
rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c );
rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c );
vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c[0] );
vst_color( vdih, OFFSET_CUSTOM_COLOR );
} else {
@ -186,12 +186,12 @@ static inline void vst_rgbcolor( short vdih, uint32_t cin )
}
}
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length,
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length,
const plot_font_style_t *fstyle )
{
/* todo: either limit the string to max 80 chars, or use v_ftext instead of v_gtext */
short cw, ch, cellw, cellh;
short pxsize=8;
short pxsize=8;
short fx=0;
lstr = (char*)text;
utf8_to_enc(text, "ATARIST", length, &lstr );
@ -206,12 +206,12 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
if( fstyle->flags & FONTF_ITALIC )
fx |= 4;
if( fstyle->flags & FONTF_OBLIQUE )
fx |= 4;
fx |= 4;
if( fstyle->weight > 450 )
fx |= 1;
fx |= 1;
/* TODO: netsurf uses 90 as default dpi ( somewhere defined in libcss), use that value
pass it as arg, to reduce netsurf dependency */
/* TODO: netsurf uses 90 as default dpi ( somewhere defined in libcss),
use that value or pass it as arg, to reduce netsurf dependency */
pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
}
x += CURFB(self->plotter).x;
@ -230,4 +230,5 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
free( lstr );
return( 0 );
}
#endif

View File

@ -15,9 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef WITH_VDI_FONT_DRIVER
#ifndef FONT_PLOTTER_VDI
#define FONT_PLOTTER_VDI
int ctor_font_plotter_vdi( FONT_PLOTTER self );
#endif
#endif
#endif

View File

@ -30,17 +30,36 @@
#include "atari/bitmap.h"
#include "image/bitmap.h"
#include "atari/plot/eddi.h"
#include "atari/plot/plotter.h"
#include "atari/plot/plotter.h"
#include "atari/plot/plotter_vdi.h"
#include "atari/plot/plotter_nvdi.h"
#include "atari/plot/font_vdi.h"
#include "atari/plot/font_internal.h"
#include "atari/plot/font_freetype.h"
#ifdef WITH_VDI_FONT_DRIVER
#include "atari/plot/font_vdi.h"
#endif
#ifdef WITH_INTERNAL_FONT_DRIVER
#include "atari/plot/font_internal.h"
#endif
#ifdef WITH_FREETYPE_FONT_DRIVER
#include "atari/plot/font_freetype.h"
#endif
#include "atari/gui.h"
#include "utils/log.h"
#include "atari/misc.h"
#include "atari/osspec.h"
#include "atari/osspec.h"
/* get index to driver in driver list by name */
static int drvrname_idx( char * name );
/* Error code translations: */
static const char * plot_error_codes[] =
{
"None",
"ERR_BUFFERSIZE_EXCEEDS_SCREEN",
"ERR_NO_MEM",
"ERR_PLOTTER_NOT_AVAILABLE"
};
#ifdef WITH_8BPP_SUPPORT
unsigned short vdi_web_pal[216][3] = {
{0x000,0x000,0x000}, {0x0c8,0x000,0x000}, {0x190,0x000,0x000}, {0x258,0x000,0x000}, {0x320,0x000,0x000}, {0x3e8,0x000,0x000},
{0x000,0x0c8,0x000}, {0x0c8,0x0c8,0x000}, {0x190,0x0c8,0x000}, {0x258,0x0c8,0x000}, {0x320,0x0c8,0x000}, {0x3e8,0x0c8,0x000},
@ -78,7 +97,8 @@ unsigned short vdi_web_pal[216][3] = {
{0x000,0x258,0x3e8}, {0x0c8,0x258,0x3e8}, {0x190,0x258,0x3e8}, {0x258,0x258,0x3e8}, {0x320,0x258,0x3e8}, {0x3e8,0x258,0x3e8},
{0x000,0x320,0x3e8}, {0x0c8,0x320,0x3e8}, {0x190,0x320,0x3e8}, {0x258,0x320,0x3e8}, {0x320,0x320,0x3e8}, {0x3e8,0x320,0x3e8},
{0x000,0x3e8,0x3e8}, {0x0c8,0x3e8,0x3e8}, {0x190,0x3e8,0x3e8}, {0x258,0x3e8,0x3e8}, {0x320,0x3e8,0x3e8}, {0x3e8,0x3e8,0x3e8}
};
};
#endif
static short prev_vdi_clip[4];
struct s_vdi_sysinfo vdi_sysinfo;
@ -86,15 +106,20 @@ struct s_vdi_sysinfo vdi_sysinfo;
struct s_driver_table_entry screen_driver_table[] =
{
{(char*)"vdi", ctor_plotter_vdi, 0, 32},
/* {(char*)"nvdi", ctor_plotter_vdi, PLOT_FLAG_OFFSCREEN, 32},*/
{(char*)NULL, NULL, 0, 0 }
};
const struct s_font_driver_table_entry font_driver_table[] =
{
{
#ifdef WITH_VDI_FONT_DRIVER
{(char*)"vdi", ctor_font_plotter_vdi, 0},
{(char*)"freetype", ctor_font_plotter_freetype, 0},
{(char*)"internal", ctor_font_plotter_internal, 0},
#endif
#ifdef WITH_FREETYPE_FONT_DRIVER
{(char*)"freetype", ctor_font_plotter_freetype, 0},
#endif
#ifdef WITH_INTERNAL_FONT_DRIVER
{(char*)"internal", ctor_font_plotter_internal, 0},
#endif
{(char*)NULL, NULL, 0}
};

View File

@ -64,17 +64,8 @@
/* Error codes: */
#define ERR_BUFFERSIZE_EXCEEDS_SCREEN 1 /* The buffer allocated is larger than the screen */
#define ERR_NO_MEM 2 /* Not enough memory for requested operation */
#define ERR_PLOTTER_NOT_AVAILABLE 3 /* invalid plotter driver name passed */
/* Error code translations: */
static const char * plot_error_codes[] =
{
"None",
"ERR_BUFFERSIZE_EXCEEDS_SCREEN",
"ERR_NO_MEM",
"ERR_PLOTTER_NOT_AVAILABLE"
};
#define ERR_NO_MEM 2 /* Not enough memory for requested operation */
#define ERR_PLOTTER_NOT_AVAILABLE 3 /* invalid plotter driver name passed */
/* Grapics & Font Plotter "Objects": */
typedef struct s_font_plotter * FONT_PLOTTER;
@ -247,9 +238,6 @@ struct s_font_driver_table_entry
typedef struct s_driver_table_entry * PLOTTER_INFO;
typedef struct s_font_driver_table_entry * FONT_PLOTTER_INFO;
/* get index to driver in driver list by name */
static int drvrname_idx( char * name );
/* get s_driver_table_entry from driver table */
struct s_driver_table_entry * get_screen_driver_entry(char * name);

View File

@ -27,7 +27,6 @@
#include "atari/plot/eddi.h"
#include "atari/plot/plotter.h"
#include "atari/plot/plotter_vdi.h"
#include "atari/plot/font_vdi.h"
/* assign vdi line style to dst ( netsurf type ) */
#define NSLT2VDI(dst, src) \
@ -67,18 +66,20 @@ static int bitmap( GEM_PLOTTER self, struct bitmap * bmp, int x, int y,
unsigned long bg, unsigned long flags );
static int plot_mfdb( GEM_PLOTTER self, GRECT * where, MFDB * mfdb, uint32_t flags);
static int text(GEM_PLOTTER self, int x, int y, const char *text,size_t length, const plot_font_style_t *fstyle);
#ifdef WITH_8BPP_SUPPORT
static unsigned short sys_pal[256][3]; /*RGB*/
static unsigned short pal[256][3]; /*RGB*/
extern unsigned char rgb_web_pal[126][3];
extern unsigned short vdi_web_pal[126][3];
extern unsigned char rgb_web_pal[126][3];
extern unsigned short vdi_web_pal[126][3];
int32 * hermes_pal_p;
#endif
extern struct s_vdi_sysinfo vdi_sysinfo;
static HermesHandle hermes_pal_h; /* hermes palette handle */
static HermesHandle hermes_cnv_h; /* hermes converter instance handle */
static HermesHandle hermes_res_h;
int32 * hermes_pal_p;
static inline void vsl_rgbcolor( short vdih, uint32_t cin )
{
@ -168,7 +169,8 @@ int ctor_plotter_vdi(GEM_PLOTTER self )
clip.x1 = FIRSTFB(self).w;
clip.y1 = FIRSTFB(self).h;
self->clip( self, &clip );
/* store system palette & setup the new (web) palette: */
/* store system palette & setup the new (web) palette: */
#ifdef WITH_8BPP_SUPPORT
i = 0;
if( app.nplanes <= 8 ){
for( i=0; i<=255; i++ ) {
@ -191,7 +193,8 @@ int ctor_plotter_vdi(GEM_PLOTTER self )
}
} else {
/* no need to change the palette - its application specific */
}
}
#endif
unsigned char * col;
assert( Hermes_Init() );
@ -252,17 +255,21 @@ static int dtor( GEM_PLOTTER self )
if( self->fbuf[i].mem != NULL )
free( self->fbuf[i].mem );
}
/* close Hermes stuff: */
Hermes_ConverterReturn( hermes_cnv_h );
#ifdef WITH_8BPP_SUPPORT
if( app.nplanes <= 8 ){
/* restore system palette */
for( i=0; i<=255; i++ ) {
vs_color( self->vdi_handle, i, &sys_pal[i][0] );
}
}
}
Hermes_PaletteReturn( hermes_pal_h );
#endif
/* close Hermes stuff: */
Hermes_ConverterReturn( hermes_cnv_h );
/* Hermes_PaletteReturn( hermes_pal_h ); */
Hermes_Done();
if( self->priv_data != NULL ){
@ -279,9 +286,9 @@ static int resize( GEM_PLOTTER self, int w, int h )
{
if( w == CURFB(self).w && h == CURFB(self).h )
return( 1 );
int newsize = calc_chunked_buffer_size( w, h, w, self->bpp_virt );
LOG(("%s: %s, oldsize: %d\n", (char*)__FILE__, __FUNCTION__, CURFB(self).size ));
/* todo: needed when using offscreen buffers...
int newsize = calc_chunked_buffer_size( w, h, w, self->bpp_virt );
LOG(("%s: %s, oldsize: %d\n", (char*)__FILE__, __FUNCTION__, CURFB(self).size ));
if( newsize > self->screen_buffer_size ) {
self->screen_buffer_size = newsize;
self->screen_buffer =realloc( self->screen_buffer , self->screen_buffer_size );
@ -1064,7 +1071,6 @@ static int plot_mfdb (GEM_PLOTTER self, GRECT * loc, MFDB * insrc, uint32_t flag
MFDB screen, tran;
MFDB * src;
short pxy[8];
short pxyclip[4];
short c[2] = {OFFSET_CUSTOM_COLOR, WHITE};
GRECT off;