From 11d0b4b98641254dda34a4e8898fd425656ac614 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Sat, 12 Feb 2011 19:56:18 +0000 Subject: Added the framebuffer "internal" font decoder/plotter, fixed ablend method, introduced flag for monochrom bitmap drawing. svn path=/trunk/netsurf/; revision=11661 --- atari/plot/plotter.c | 2 ++ atari/plot/plotter_vdi.c | 35 +++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/atari/plot/plotter.c b/atari/plot/plotter.c index 6f9ba750e..f645af483 100755 --- a/atari/plot/plotter.c +++ b/atari/plot/plotter.c @@ -33,6 +33,7 @@ #include "atari/plot/plotter.h" #include "atari/plot/plotter_vdi.h" #include "atari/plot/font_vdi.h" +#include "atari/plot/font_internal.h" #include "atari/plot/font_freetype.h" #include "atari/gui.h" #include "utils/log.h" @@ -134,6 +135,7 @@ const struct s_font_driver_table_entry font_driver_table[] = { {(char*)"vdi", ctor_font_plotter_vdi, 0}, {(char*)"freetype", ctor_font_plotter_freetype, 0}, + {(char*)"internal", ctor_font_plotter_internal, 0}, {(char*)NULL, NULL, 0} }; diff --git a/atari/plot/plotter_vdi.c b/atari/plot/plotter_vdi.c index 90128fdcb..ab16c7838 100755 --- a/atari/plot/plotter_vdi.c +++ b/atari/plot/plotter_vdi.c @@ -638,13 +638,14 @@ static inline uint32_t ablend(uint32_t pixel, uint32_t scrpixel) int opacity = pixel & 0xFF; int transp = 0x100 - opacity; uint32_t rb, g; - - rb = ((pixel & 0xFF00FF00UL) * opacity + - (scrpixel & 0xFF00FF00UL) * transp) >> 8; - g = ((pixel & 0x00FF0000UL) * opacity + - (scrpixel & 0x00FF0000UL) * transp) >> 8; - - return (rb & 0xFF00FF00) | (g & 0x00FF0000); + pixel >>= 8; + scrpixel >>= 8; + rb = ((pixel & 0xFF00FF) * opacity + + (scrpixel & 0xFF00FF) * transp) >> 8; + g = ((pixel & 0x00FF00) * opacity + + (scrpixel & 0x00FF00) * transp) >> 8; + + return ((rb & 0xFF00FF) | (g & 0xFF00)) << 8; } static int bitmap_resize( GEM_PLOTTER self, struct bitmap * img, int nw, int nh ) @@ -666,6 +667,7 @@ static int bitmap_resize( GEM_PLOTTER self, struct bitmap * img, int nw, int nh /* allocate the mem for resized bitmap */ img->resized = bitmap_create_ex( nw, nh, bpp, nw*bpp, 0, NULL ); if( img->resized == NULL ) { + printf("W: %d, H: %d, bpp: %d\n", nw, nh, bpp); assert( img->resized ); return ( -ERR_NO_MEM ); } @@ -859,6 +861,7 @@ static int convert_bitmap( GEM_PLOTTER self, int y, GRECT * clip, uint32_t bg, + uint32_t flags, MFDB *out ) { short vpxsize = self->bpp_virt >> 3; /* / 8 */ @@ -878,8 +881,12 @@ static int convert_bitmap( GEM_PLOTTER self, /* rem. if eddi xy is installed, we could directly access the screen! */ /* apply transparency to the image: */ if( (img->opaque == false) - && ((self->flags & PLOT_FLAG_TRANS) != 0) - && (vdi_sysinfo.vdiformat == VDI_FORMAT_PACK ) ) { + && ( (self->flags & PLOT_FLAG_TRANS) != 0) + && ( + (vdi_sysinfo.vdiformat == VDI_FORMAT_PACK ) + || + ( (flags & BITMAP_MONOGLYPH) != 0) + ) ) { uint32_t * imgpixel; uint32_t * screenpixel; int img_x, img_y; /* points into old bitmap */ @@ -894,12 +901,12 @@ static int convert_bitmap( GEM_PLOTTER self, imgpixel = (uint32_t *)(bm->pixdata + (img_stride * img_y)); screenpixel = (uint32_t *)(scrbuf->pixdata + (screen_stride * screen_y)); for( img_x = clip->g_x, screen_x = 0; screen_x < clip->g_w; screen_x++, img_x++ ) { - if( (imgpixel[img_x] & 0xFF) != 0xFF ) { + if( (imgpixel[img_x] & 0xFF) == 0xFF ) { + screenpixel[screen_x] = imgpixel[img_x]; + } else { if( (imgpixel[img_x] & 0x0FF) != 0 ) { screenpixel[screen_x] = ablend( imgpixel[img_x], screenpixel[screen_x]); - } - } else { - screenpixel[screen_x] = imgpixel[img_x]; + } } } } @@ -1020,7 +1027,7 @@ static int bitmap( GEM_PLOTTER self, struct bitmap * bmp, int x, int y, pxy[5] = CURFB(self).y + loc.g_y; pxy[6] = CURFB(self).x + loc.g_x + off.g_w-1; pxy[7] = CURFB(self).y + loc.g_y + off.g_h-1; - if( convert_bitmap( self, bmp, pxy[4], pxy[5], &off, bg, &src_mf) != 0 ) { + if( convert_bitmap( self, bmp, pxy[4], pxy[5], &off, bg, flags, &src_mf) != 0 ) { return( true ); } vro_cpyfm( self->vdi_handle, S_ONLY, (short*)&pxy, &src_mf, &scrmf); -- cgit v1.2.3