From 1c9c303df886c073970982b78b2308f180f9cb9d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 19 Apr 2015 22:58:13 +0100 Subject: rationalise atari plotters header usage. --- atari/bitmap.c | 3 +- atari/font.c | 5 +- atari/gui.h | 4 ++ atari/plot/font_freetype.c | 8 ++- atari/plot/font_internal.c | 7 ++- atari/plot/fontplot.c | 7 +++ atari/plot/fontplot.h | 16 ------ atari/plot/plot.c | 5 +- atari/plot/plot.h | 135 ++++++++++++++++++++------------------------- atari/rootwin.c | 1 + atari/settings.c | 2 + 11 files changed, 95 insertions(+), 98 deletions(-) diff --git a/atari/bitmap.c b/atari/bitmap.c index 52e515faf..72e5a20e5 100755 --- a/atari/bitmap.c +++ b/atari/bitmap.c @@ -19,7 +19,8 @@ #include #include #include -#include "assert.h" +#include +#include #include "utils/nsoption.h" #include "utils/log.h" diff --git a/atari/font.c b/atari/font.c index ff1c3e7dd..6b3cc6f77 100755 --- a/atari/font.c +++ b/atari/font.c @@ -46,11 +46,10 @@ #include "desktop/plotters.h" #include "atari/gui.h" -#include "atari/font.h" +#include "atari/plot/fontplot.h" #include "atari/plot/plot.h" #include "atari/findfile.h" -#include "atari/gui.h" -#include "atari/plot/plot.h" +#include "atari/font.h" extern FONT_PLOTTER fplotter; diff --git a/atari/gui.h b/atari/gui.h index 4c224298d..ed76adc0e 100755 --- a/atari/gui.h +++ b/atari/gui.h @@ -25,6 +25,10 @@ #include "atari/redrawslots.h" #include "atari/gemtk/gemtk.h" +#ifndef PATH_MAX +#define PATH_MAX 1024 +#endif + #define CARET_STATE_VISIBLE 0x01 #define CARET_STATE_ENABLED 0x02 diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c index c4d774831..6b22ba81d 100755 --- a/atari/plot/font_freetype.c +++ b/atari/plot/font_freetype.c @@ -18,16 +18,22 @@ */ #ifdef WITH_FREETYPE_FONT_DRIVER - +#include #include #include FT_CACHE_H +#include "utils/log.h" #include "utils/nsoption.h" #include "desktop/mouse.h" +#include "desktop/plot_style.h" +#include "atari/gui.h" +#include "atari/bitmap.h" #include "atari/plot/plot.h" +#include "atari/plot/fontplot.h" #include "atari/plot/font_freetype.h" #include "atari/findfile.h" +#include "atari/gemtk/gemtk.h" /* -------------------------------------------------------------------------- */ /* Font Loading & Mapping scheme */ diff --git a/atari/plot/font_internal.c b/atari/plot/font_internal.c index 427444d2b..bfe0def8c 100644 --- a/atari/plot/font_internal.c +++ b/atari/plot/font_internal.c @@ -21,10 +21,13 @@ #include -#include "utils/utf8.h" -#include "utils/log.h" +#include "utils/utf8.h" +#include "utils/log.h" #include "desktop/mouse.h" +#include "desktop/plot_style.h" +#include "atari/gui.h" +#include "atari/bitmap.h" #include "atari/plot/plot.h" #include "atari/plot/fontplot.h" #include "atari/plot/font_internal.h" diff --git a/atari/plot/fontplot.c b/atari/plot/fontplot.c index 97f3503cb..9f0edd9a4 100644 --- a/atari/plot/fontplot.c +++ b/atari/plot/fontplot.c @@ -16,8 +16,15 @@ * along with this program. If not, see . */ +#include +#include +#include +#include + #include "desktop/mouse.h" +#include "desktop/plot_style.h" +#include "atari/bitmap.h" #include "atari/plot/fontplot.h" const struct s_font_driver_table_entry font_driver_table[] = diff --git a/atari/plot/fontplot.h b/atari/plot/fontplot.h index eab35cba7..27524fded 100644 --- a/atari/plot/fontplot.h +++ b/atari/plot/fontplot.h @@ -1,22 +1,6 @@ #ifndef FONT_PLOT_H #define FONT_PLOT_H -#include -#include -#include -#include -#include -#include - -#include "desktop/plot_style.h" -#include "image/bitmap.h" -#include "utils/log.h" -#include "atari/bitmap.h" -#include "atari/plot/eddi.h" -#include "atari/gui.h" -#include "atari/misc.h" -#include "atari/osspec.h" - typedef struct s_font_plotter * FONT_PLOTTER; struct s_font_driver_table_entry diff --git a/atari/plot/plot.c b/atari/plot/plot.c index 523ce4445..583429ace 100755 --- a/atari/plot/plot.c +++ b/atari/plot/plot.c @@ -22,8 +22,8 @@ #include #include #include - #include +#include #include "image/bitmap.h" #include "utils/log.h" @@ -32,9 +32,12 @@ #include "desktop/plotters.h" #include "desktop/mouse.h" +#include "atari/osspec.h" #include "atari/misc.h" #include "atari/bitmap.h" #include "utils/nsoption.h" +#include "atari/plot/eddi.h" +#include "atari/plot/fontplot.h" #include "atari/plot/plot.h" void vq_scrninfo(VdiHdl handle, short *work_out); diff --git a/atari/plot/plot.h b/atari/plot/plot.h index 00546e879..22f8781c2 100755 --- a/atari/plot/plot.h +++ b/atari/plot/plot.h @@ -19,40 +19,23 @@ #ifndef NS_ATARI_PLOT_H #define NS_ATARI_PLOT_H -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "desktop/plotters.h" -#include "desktop/plot_style.h" -#include "image/bitmap.h" - -#include "atari/bitmap.h" -#include "atari/plot/eddi.h" -#include "atari/plot/fontplot.h" - -/* how much memory should be kept allocated for temp. conversion bitmaps: */ +/** how much memory should be kept allocated for temp. conversion bitmaps: */ #define CONV_KEEP_LIMIT 512000 -/* how much memory to allocate if some is needed: */ + +/** how much memory to allocate if some is needed: */ #define CONV_BLOCK_SIZE 32000 /* Plotter Option Flags: */ -#define PLOT_FLAG_DITHER 0x04 /* true if the plotter shall dither images */ -#define PLOT_FLAG_TRANS 0x08 /* true if the plotter supports transparent operations */ +#define PLOT_FLAG_DITHER 0x04 /**< set if the plotter shall dither images */ +#define PLOT_FLAG_TRANS 0x08 /**< set if the plotter supports transparent operations */ /* Plotter "feature" flags */ -#define PLOT_FLAG_HAS_DITHER 0x0400 -#define PLOT_FLAG_HAS_ALPHA 0x0800 -#define PLOT_FLAG_OFFSCREEN 0x1000 /* offsreen plotter should set this flag */ +#define PLOT_FLAG_HAS_DITHER 0x0400 +#define PLOT_FLAG_HAS_ALPHA 0x0800 +#define PLOT_FLAG_OFFSCREEN 0x1000 /**< offscreen plotter should set this flag */ /* Plotter "internal" flags */ -#define PLOT_FLAG_LOCKED 0x08000 /* plotter should set this flag during screen updates */ +#define PLOT_FLAG_LOCKED 0x08000 /**< plotter should set this flag during screen updates */ /* Font Plotter flags: */ #define FONTPLOT_FLAG_MONOGLYPH 0x01 @@ -63,35 +46,35 @@ #define MFDB_FLAG_NOALLOC 0x04 /* Flags for blit functions: */ -#define BITMAPF_MONOGLYPH 4096 /* The bitmap is an character bitmap */ -#define BITMAPF_BUFFER_NATIVE 8192 /* Bitmap shall be kept converted */ +#define BITMAPF_MONOGLYPH 4096 /**< The bitmap is an character bitmap */ +#define BITMAPF_BUFFER_NATIVE 8192 /**< Bitmap shall be kept converted */ /* 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 */ +#define ERR_NO_MEM 2 /* Not enough memory for requested operation */ +#define ERR_PLOTTER_NOT_AVAILABLE 3 /* invalid plotter driver name passed */ struct s_vdi_sysinfo { - short vdi_handle; /* vdi handle */ - short scr_w; /* resolution horz. */ - short scr_h; /* resolution vert. */ - short scr_bpp; /* bits per pixel */ - int colors; /* 0=hiclor, 2=mono */ - unsigned long hicolors; /* if colors = 0 */ - short pixelsize; /* bytes per pixel */ - unsigned short pitch; /* row pitch */ - unsigned short vdiformat; /* pixel format */ - unsigned short clut; /* type of clut support */ - void * screen; /* pointer to screen, or NULL */ - unsigned long screensize; /* size of screen (in bytes) */ - unsigned long mask_r; /* color masks */ - unsigned long mask_g; - unsigned long mask_b; - unsigned long mask_a; - short maxintin; /* maximum pxy items */ - short maxpolycoords; /* max coords for p_line etc. */ - unsigned long EdDiVersion; /* EdDi Version or 0 */ - bool rasterscale; /* raster scaling support */ + short vdi_handle; /**< vdi handle */ + short scr_w; /**< resolution horz. */ + short scr_h; /**< resolution vert. */ + short scr_bpp; /**< bits per pixel */ + int colors; /**< 0=hiclor, 2=mono */ + unsigned long hicolors; /**< if colors = 0 */ + short pixelsize; /**< bytes per pixel */ + unsigned short pitch; /**< row pitch */ + unsigned short vdiformat; /**< pixel format */ + unsigned short clut; /**< type of clut support */ + void *screen; /**< pointer to screen, or NULL */ + unsigned long screensize; /**< size of screen (in bytes) */ + unsigned long mask_r; /**< red color mask */ + unsigned long mask_g; /**< green color mask */ + unsigned long mask_b; /**< blue color mask */ + unsigned long mask_a; /**< alpha color mask */ + short maxintin; /* maximum pxy items */ + short maxpolycoords; /* max coords for p_line etc. */ + unsigned long EdDiVersion; /* EdDi Version or 0 */ + bool rasterscale; /* raster scaling support */ }; struct rect; @@ -100,7 +83,10 @@ extern const struct plotter_table atari_plotters; int plot_init(char *); int plot_finalise(void); -/* translate an error number */ + +/** + * translate an error number + */ const char* plot_err_str(int i) ; bool plot_lock(void); @@ -122,8 +108,7 @@ bool plot_rectangle( int x0, int y0, int x1, int y1,const plot_style_t *style ); bool plot_line( int x0, int y0, int x1, int y1, const plot_style_t *style ); bool plot_blit_bitmap(struct bitmap * bmp, int x, int y, unsigned long bg, unsigned long flags); -bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor, - uint32_t flags); +bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, short fgcolor, uint32_t flags); bool plot_copy_rect(GRECT src, GRECT dst); /* convert an vdi color to bgra */ @@ -135,23 +120,22 @@ void rgb_to_vdi1000( unsigned char * in, RGB1000 *out); /* convert an rgb color to an index into the web palette */ short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b); -/* assign vdi line style to dst ( netsurf type ) */ -#define NSLT2VDI(dst, src) \ - dst = 0;\ - switch( src->stroke_type ) {\ - case PLOT_OP_TYPE_DOT: \ - dst = (0xAAAA00 | 7);\ - break;\ - case PLOT_OP_TYPE_DASH:\ - dst = 3; \ - break;\ - case PLOT_OP_TYPE_SOLID:\ - case PLOT_OP_TYPE_NONE:\ - default:\ - dst = 1;\ - break;\ - }\ - +/* assign vdi line style to dst ( netsurf type ) */ +#define NSLT2VDI(dst, src) \ + dst = 0; \ + switch( src->stroke_type ) { \ + case PLOT_OP_TYPE_DOT: \ + dst = (0xAAAA00 | 7); \ + break; \ + case PLOT_OP_TYPE_DASH: \ + dst = 3; \ + break; \ + case PLOT_OP_TYPE_SOLID: \ + case PLOT_OP_TYPE_NONE: \ + default: \ + dst = 1; \ + break; \ + } #ifdef WITH_8BPP_SUPPORT @@ -161,11 +145,14 @@ short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b); #define OFFSET_WEB_PAL 16 #define OFFSET_CUST_PAL 232 #define RGB_TO_VDI(c) rgb_to_666_index( (c&0xFF),(c&0xFF00)>>8,(c&0xFF0000)>>16)+OFFSET_WEB_PAL -#endif +#endif /* WITH_8BPP_SUPPORT*/ + +/* the name of this macro is crap - it should be named bgr_to_rgba ... or so */ +#define ABGR_TO_RGB(c) ( ((c&0xFF)<<16) | (c&0xFF00) | ((c&0xFF0000)>>16) ) << 8 -/* the name of this macro is crap - it should be named bgr_to_rgba ... or so */ -#define ABGR_TO_RGB(c) ( ((c&0xFF)<<16) | (c&0xFF00) | ((c&0xFF0000)>>16) ) << 8 -/* this index into the palette is used by the TC renderer to set current draw color: */ +/* this index into the palette is used by the TC renderer to set + * current draw color. + */ #define OFFSET_CUSTOM_COLOR 255 #endif diff --git a/atari/rootwin.c b/atari/rootwin.c index 66785aaae..7b4cd0361 100755 --- a/atari/rootwin.c +++ b/atari/rootwin.c @@ -60,6 +60,7 @@ #include "atari/redrawslots.h" #include "atari/toolbar.h" #include "atari/findfile.h" +#include "atari/bitmap.h" extern struct gui_window *input_window; extern EVMULT_OUT aes_event_out; diff --git a/atari/settings.c b/atari/settings.c index 037869955..fe42f2ab2 100644 --- a/atari/settings.c +++ b/atari/settings.c @@ -11,7 +11,9 @@ #include #include "utils/nsoption.h" +#include "utils/log.h" #include "desktop/plot_style.h" + #include "atari/res/netsurf.rsh" #include "atari/settings.h" #include "atari/deskmenu.h" -- cgit v1.2.3