From eb2ec532e8cd058903de319ab90646693d52e53f Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Mon, 23 Jul 2012 02:30:11 +0200 Subject: renmaed plot functions (use plot_ prefix). --- atari/plot/plot.c | 62 ++++++++++++++++++++++++++++++++++++++----------------- atari/plot/plot.h | 34 +++--------------------------- 2 files changed, 46 insertions(+), 50 deletions(-) (limited to 'atari/plot') diff --git a/atari/plot/plot.c b/atari/plot/plot.c index d221efa95..8983d15b4 100755 --- a/atari/plot/plot.c +++ b/atari/plot/plot.c @@ -48,6 +48,33 @@ struct s_view { struct rect clipping; /* clipping rectangle */ }; +/* +* Capture the screen at x,y location +* param self instance +* param x absolute screen coords +* param y absolute screen coords +* param w width +* param h height +* +* This creates an snapshot in RGBA format (NetSurf's native format) +* +*/ +static struct bitmap * snapshot_create(int x, int y, int w, int h); + +/* Garbage collection of the snapshot routine */ +/* this should be called after you are done with the data returned by snapshot_create */ +/* don't access the screenshot after you called this function */ +static void snapshot_suspend(void); + +/* destroy memory used by screenshot */ +static void snapshot_destroy(void); + +/* convert an bgra color to vdi1000 color */ +void rgb_to_vdi1000( unsigned char * in, unsigned short * 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); + #ifdef WITH_8BPP_SUPPORT static unsigned short sys_pal[256][3]; /*RGB*/ @@ -291,7 +318,7 @@ inline static bool fbrect_to_screen(GRECT box, GRECT * ret) } /* convert framebuffer clipping to vdi clipping and activates it */ -inline static void plotter_vdi_clip(bool set) +inline static void plot_vdi_clip(bool set) { // TODO : check this return; @@ -639,7 +666,7 @@ inline short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b) #endif -static void dump_vdi_info( short vdih ) +static void dump_vdi_info(short vdih) { struct s_vdi_sysinfo temp; read_vdi_sysinfo( vdih, &temp ); @@ -1065,11 +1092,8 @@ static bool bitmap_convert_8(struct bitmap * img, int x, if( buf_planar == NULL ) buf_planar =(void*)malloc( blocks * CONV_BLOCK_SIZE ); else - buf_planar =(void*)realloc( - buf_planar, - blocks * CONV_BLOCK_SIZE - ); - assert( buf_planar ); + buf_planar =(void*)realloc(buf_planar, blocks * CONV_BLOCK_SIZE); + assert(buf_planar); if( buf_planar == NULL ) { return( 0-ERR_NO_MEM ); } @@ -1428,7 +1452,7 @@ bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor, short c[2] = {fgcolor, WHITE}; GRECT off; - plotter_get_clip_grect(&off); + plot_get_clip_grect(&off); if( rc_intersect(loc, &off) == 0 ){ return( 1 ); } @@ -1482,7 +1506,7 @@ Returns non-zero value > -1 when the objects could be succesfully created. Returns value < 0 to indicate an error */ -int atari_plotter_init(char * fdrvrname) +int plot_init(char * fdrvrname) { GRECT loc_pos= {0,0,360,400}; @@ -1608,7 +1632,7 @@ int atari_plotter_init(char * fdrvrname) return( err ); } -int atari_plotter_finalise( void ) +int plot_finalise( void ) { int i=0; @@ -1775,7 +1799,7 @@ bool plot_line(int x0, int y0, int x1, int y1, pxy[2] = view.x + x1; pxy[3] = view.y + y1; - plotter_vdi_clip(true); + plot_vdi_clip(true); if( sw == 0) sw = 1; NSLT2VDI(lt, pstyle) @@ -1787,7 +1811,7 @@ bool plot_line(int x0, int y0, int x1, int y1, vsl_width(atari_plot_vdi_handle, (short)sw); vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour); v_pline(atari_plot_vdi_handle, 2, (short *)&pxy ); - plotter_vdi_clip(false); + plot_vdi_clip(false); return ( true ); } @@ -1799,7 +1823,7 @@ static bool plot_polygon(const int *p, unsigned int n, short d[4]; if (vdi_sysinfo.maxpolycoords > 0) assert( (signed int)n < vdi_sysinfo.maxpolycoords); - plotter_vdi_clip(true); + plot_vdi_clip(true); vsf_interior(atari_plot_vdi_handle, FIS_SOLID); vsf_style(atari_plot_vdi_handle, 1); for (i = 0; istroke_colour); v_pline(atari_plot_vdi_handle, n+1, (short *)&pxy); } - plotter_vdi_clip(false); + plot_vdi_clip(false); return ( true ); } @@ -1859,7 +1883,7 @@ bool plot_get_clip(struct rect * out) return( true ); } -void plotter_get_clip_grect(GRECT * out) +void plot_get_clip_grect(GRECT * out) { struct rect clip={0,0,0,0}; plot_get_clip(&clip); @@ -1877,7 +1901,7 @@ static bool plot_text(int x, int y, const char *text, size_t length, const plot_ static bool plot_disc(int x, int y, int radius, const plot_style_t *pstyle) { - plotter_vdi_clip(true); + plot_vdi_clip(true); if (pstyle->fill_type != PLOT_OP_TYPE_SOLID) { vsf_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour); vsf_perimeter(atari_plot_vdi_handle, 1); @@ -1889,14 +1913,14 @@ static bool plot_disc(int x, int y, int radius, const plot_style_t *pstyle) vsf_interior(atari_plot_vdi_handle, FIS_SOLID); v_circle(atari_plot_vdi_handle, view.x + x, view.y + y, radius); } - plotter_vdi_clip(false); + plot_vdi_clip(false); return ( true ); } static bool plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *pstyle) { - //plotter_vdi_clip(true); + //plot_vdi_clip(true); vswr_mode(atari_plot_vdi_handle, MD_REPLACE ); if (pstyle->fill_type == PLOT_OP_TYPE_NONE) return(true); @@ -1911,7 +1935,7 @@ static bool plot_arc(int x, int y, int radius, int angle1, int angle2, vsf_perimeter(atari_plot_vdi_handle, 1); v_arc(atari_plot_vdi_handle, view.x + x, view.y + y, radius, angle1*10, angle2*10); } - //plotter_vdi_clip(true); + //plot_vdi_clip(true); return (true); } diff --git a/atari/plot/plot.h b/atari/plot/plot.h index c90d2aefc..a5c76836a 100755 --- a/atari/plot/plot.h +++ b/atari/plot/plot.h @@ -99,8 +99,8 @@ struct rect; extern const struct plotter_table atari_plotters; -int atari_plotter_init(char *); -int atari_plotter_finalise(void); +int plot_init(char *); +int plot_finalise(void); /* translate an error number */ const char* plot_err_str(int i) ; @@ -109,7 +109,7 @@ bool plot_unlock(void); bool plot_set_dimensions( int x, int y, int w, int h ); bool plot_get_clip(struct rect * out); /* Get clipping for current framebuffer as GRECT */ -void plotter_get_clip_grect(GRECT * out); +void plot_get_clip_grect(GRECT * out); bool plot_clip(const struct rect *clip); 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 ); @@ -118,36 +118,10 @@ bool plot_blit_bitmap(struct bitmap * bmp, int x, int y, bool plot_blit_mfdb(GRECT * loc, MFDB * insrc, unsigned char fgcolor, uint32_t flags); bool plot_copy_rect(GRECT src, GRECT dst); -/* -* Capture the screen at x,y location -* param self instance -* param x absolute screen coords -* param y absolute screen coords -* param w width -* param h height -* -* This creates an snapshot in RGBA format (NetSurf's native format) -* -*/ -static struct bitmap * snapshot_create(int x, int y, int w, int h); - -/* Garbage collection of the snapshot routine */ -/* this should be called after you are done with the data returned by snapshot_create */ -/* don't access the screenshot after you called this function */ -static void snapshot_suspend(void); - -/* destroy memory used by screenshot */ -static void snapshot_destroy(void); /* convert an vdi color to bgra */ void vdi1000_to_rgb( unsigned short * in, unsigned char * out ); -/* convert an bgra color to vdi1000 color */ -void rgb_to_vdi1000( unsigned char * in, unsigned short * 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;\ @@ -166,8 +140,6 @@ short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b); }\ -#define PLOTTER_IS_LOCKED() ( atari_plot_flags & PLOTTER_FLAG_LOCKED ) - #ifdef WITH_8BPP_SUPPORT /* some Well known indexes into the VDI palette */ -- cgit v1.2.3