Plotter refactor: removed one plotter abraction layer.

This commit is contained in:
Ole Loots 2012-07-13 22:19:04 +02:00
parent bc9d29f00a
commit 37b8c5d83d
21 changed files with 2671 additions and 186 deletions

View File

@ -48,11 +48,8 @@ LDFLAGS += -lxml2 -lz -liconv -lcares -lHermes -lwindom -lgem -lm
S_ATARI := gui.c findfile.c filetype.c misc.c bitmap.c schedule.c \
download.c thumbnail.c login.c verify_ssl.c treeview.c hotlist.c history.c\
search.c font.c \
plot.c plot/plotter.c \
plot/plotter_vdi.c \
plot/plotter_gd.c \
plot/font_vdi.c plot/font_freetype.c plot/font_internal.c \
plot/eddi.s \
plot/plot.c plot/fontplot.c plot/eddi.s \
plot/font_freetype.c plot/font_internal.c \
redrawslots.c encoding.c \
browser_win.c toolbar.c statusbar.c browser.c \
global_evnt.c osspec.c dragdrop.c system_colour.c \

View File

@ -23,11 +23,43 @@
#include "assert.h"
#include "desktop/options.h"
#include "image/bitmap.h"
#include "atari/bitmap.h"
#include "atari/plot.h"
#include "atari/plot/plot.h"
#include "utils/log.h"
/*
bpp: bits per pixel,
*/
int init_mfdb(int bpp, int w, int h, uint32_t flags, MFDB * out )
{
int dststride;
dststride = MFDB_STRIDE( w );
int size = MFDB_SIZE( bpp, dststride, h );
if( bpp > 0 ) {
if( (flags & MFDB_FLAG_NOALLOC) == 0 ) {
out->fd_addr = malloc( size );
if( out->fd_addr == NULL ){
return( 0 );
}
if( (flags & MFDB_FLAG_ZEROMEM) ){
memset( out->fd_addr, 0, size );
}
}
out->fd_stand = (flags & MFDB_FLAG_STAND) ? 1 : 0;
out->fd_nplanes = (short)bpp;
out->fd_r1 = out->fd_r2 = out->fd_r3 = 0;
} else {
memset( out, 0, sizeof(MFDB) );
}
out->fd_w = dststride;
out->fd_h = h;
out->fd_wdwidth = dststride >> 4;
return( size );
}
/**
@ -327,7 +359,7 @@ bool bitmap_test_opaque(void *bitmap)
LOG(("NULL bitmap!"));
return false;
}
if( nsoption_int(atari_transparency) == 0 ){
return( true );
}

View File

@ -19,10 +19,35 @@
#ifndef NS_ATARI_BITMAP_H
#define NS_ATARI_BITMAP_H
#include <gem.h>
/* Flags for init_mfdb function: */
#define MFDB_FLAG_STAND 0x01
#define MFDB_FLAG_ZEROMEM 0x02
#define MFDB_FLAG_NOALLOC 0x04
#define BITMAP_SHRINK 0
#define BITMAP_GROW 1024 /* Don't realloc when bitmap size shrinks */
#define BITMAP_CLEAR 2048 /* Zero bitmap memory */
/*
calculates MFDB compatible rowstride (in number of bits)
*/
#define MFDB_STRIDE( w ) (((w & 15) != 0) ? (w | 15)+1 : w)
/*
Calculate size of an mfdb,
params:
bpp: Bits per pixel,
stride: Word aligned rowstride (width) as returned by MFDB_STRIDE,
h: Height in pixels
*/
#define MFDB_SIZE( bpp, stride, h ) ( ((stride >> 3) * h) * bpp )
struct bitmap {
int width;
int height;
@ -41,5 +66,14 @@ void * bitmap_create_ex( int w, int h, short bpp, int rowstride, unsigned int st
void bitmap_to_mfdb(void * bitmap, MFDB * out);
void * bitmap_realloc( int w, int h, short bpp, int rowstride, unsigned int state, void * bmp );
size_t bitmap_buffer_size( void * bitmap ) ;
/*
setup an MFDB struct and allocate memory for it when it is needed.
If bpp == 0, this function assumes that the MFDB shall point to the screen
and will not allocate any memory (mfdb.fd_addr == 0).
The function will return 0 when the memory allocation fails
( out of memory), otherwise it returns the size of the mfdb.fd_addr
as number of bytes.
*/
int init_mfdb(int bpp, int w, int h, uint32_t flags, MFDB * out );
#endif

View File

@ -52,14 +52,16 @@
#include "atari/res/netsurf.rsh"
#include "atari/redrawslots.h"
#include "atari/browser.h"
#include "atari/plot/plotter.h"
#include "atari/plot.h"
#include "atari/plot/plot.h"
#include "atari/plot/plot.h"
#include "atari/encoding.h"
#include "atari/ctxmenu.h"
#include "cflib.h"
extern GEM_PLOTTER plotter;
extern struct gui_window *input_window;
extern struct gui_window *input_window;
extern long atari_plot_flags;
extern int atari_plot_vdi_handle;
static void browser_process_scroll( struct gui_window * gw, LGRECT bwrect );
static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff,
@ -431,7 +433,7 @@ static void browser_process_scroll( struct gui_window * gw, LGRECT bwrect )
dst.g_y = h;
dst.g_w = src.g_w;
dst.g_h = src.g_h;
plotter->copy_rect( plotter, src, dst );
plot_copy_rect(src, dst);
b->scroll.current.y += b->scroll.requested.y;
browser_schedule_redraw( gw, 0, 0, bwrect.g_w, h );
}
@ -446,7 +448,7 @@ static void browser_process_scroll( struct gui_window * gw, LGRECT bwrect )
dst.g_y = 0;
dst.g_w = bwrect.g_w;
dst.g_h = bwrect.g_h - h;
plotter->copy_rect( plotter, src, dst );
plot_copy_rect(src, dst );
b->scroll.current.y += b->scroll.requested.y;
browser_schedule_redraw( gw, 0, bwrect.g_h - h, bwrect.g_w, bwrect.g_h );
}
@ -461,7 +463,7 @@ static void browser_process_scroll( struct gui_window * gw, LGRECT bwrect )
dst.g_y = 0;
dst.g_w = bwrect.g_w - w;
dst.g_h = bwrect.g_h;
plotter->copy_rect( plotter, src, dst );
plot_copy_rect(src, dst );
b->scroll.current.x += b->scroll.requested.x;
browser_schedule_redraw( gw, 0, 0, w, bwrect.g_h );
}
@ -476,7 +478,7 @@ static void browser_process_scroll( struct gui_window * gw, LGRECT bwrect )
dst.g_y = 0;
dst.g_w = bwrect.g_w - w;
dst.g_h = bwrect.g_h;
plotter->copy_rect( plotter, src, dst );
plot_copy_rect(src, dst );
b->scroll.current.x += b->scroll.requested.x;
browser_schedule_redraw( gw, bwrect.g_w - w, 0, bwrect.g_w, bwrect.g_h );
}
@ -746,15 +748,14 @@ void browser_redraw( struct gui_window * gw )
}
browser_get_rect(gw, BR_CONTENT, &bwrect);
plotter->resize(plotter, bwrect.g_w, bwrect.g_h);
plotter->move(plotter, bwrect.g_x, bwrect.g_y );
plot_set_dimensions(bwrect.g_x, bwrect.g_y, bwrect.g_w, bwrect.g_h);
clip.x0 = 0;
clip.y0 = 0;
clip.x1 = bwrect.g_w;
clip.y1 = bwrect.g_h;
plotter->set_clip( plotter, &clip );
if( plotter->lock(plotter) == 0 )
plot_clip(&clip);
if (plot_lock() == false)
return;
if( b->scroll.required == true && b->bw->current_content != NULL) {
@ -763,7 +764,7 @@ void browser_redraw( struct gui_window * gw )
}
if ((b->redraw.areas_used > 0) && b->bw->current_content != NULL ) {
if( (plotter->flags & PLOT_FLAG_OFFSCREEN) == 0 ) {
if( (atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0 ) {
int i;
GRECT area;
@ -773,7 +774,7 @@ void browser_redraw( struct gui_window * gw )
todo[1] = bwrect.g_y;
todo[2] = todo[0] + bwrect.g_w-1;
todo[3] = todo[1] + bwrect.g_h-1;
vs_clip(plotter->vdi_handle, 1, (short*)&todo[0]);
vs_clip(atari_plot_vdi_handle, 1, (short*)&todo[0]);
wind_get( 0, WF_TOP, &wf_top[0], &wf_top[1],
&wf_top[2], &wf_top[3] );
@ -859,9 +860,7 @@ void browser_redraw( struct gui_window * gw )
}
}
}
vs_clip(plotter->vdi_handle, 0, (short*)&todo);
vs_clip(atari_plot_vdi_handle, 0, (short*)&todo);
} else {
/* its save to do a complete redraw without knowledge about GEM windows :) */
@ -881,7 +880,7 @@ void browser_redraw( struct gui_window * gw )
area.g_y = bwrect.g_y;
area.g_w = bwrect.g_w;
area.g_h = bwrect.g_h;
//plotter->blit( plotter, &area );
//plot_blit( plotter, &area );
}
b->redraw.areas_used = 0;
}
@ -895,12 +894,12 @@ void browser_redraw( struct gui_window * gw )
area.g_y = bwrect.g_y;
area.g_w = bwrect.g_w;
area.g_h = bwrect.g_h;
vs_clip(plotter->vdi_handle, 1, (short*)&todo[0]);
vs_clip(atari_plot_vdi_handle, 1, (short*)&todo[0]);
browser_redraw_caret( gw, &area );
vs_clip(plotter->vdi_handle, 0, (short*)&todo[0]);
vs_clip(atari_plot_vdi_handle, 0, (short*)&todo[0]);
b->caret.redraw = false;
}
plotter->unlock(plotter);
plot_unlock();
/* TODO: if we use offscreen bitmap, trigger content redraw here */
}

View File

@ -47,13 +47,12 @@
#include "atari/browser_win.h"
#include "atari/browser.h"
#include "atari/misc.h"
#include "atari/plot.h"
#include "atari/plot/plot.h"
#include "atari/global_evnt.h"
#include "atari/res/netsurf.rsh"
#include "atari/browser.h"
#include "atari/toolbar.h"
#include "atari/statusbar.h"
#include "atari/plot/plotter.h"
#include "atari/dragdrop.h"
#include "atari/search.h"
#include "atari/osspec.h"
@ -62,7 +61,6 @@
extern void * h_gem_rsrc;
extern struct gui_window *input_window;
extern GEM_PLOTTER plotter;
void __CDECL std_szd( WINDOW * win, short buff[8], void * );
void __CDECL std_mvd( WINDOW * win, short buff[8], void * );
@ -229,9 +227,8 @@ void window_open( struct gui_window * gw, GRECT pos )
/* recompute the nested component sizes and positions: */
browser_update_rects( gw );
mt_WindGetGrect( &app, gw->root->handle, WF_CURRXYWH, (GRECT*)&gw->root->loc);
browser_get_rect( gw, BR_CONTENT, &br );
plotter->move( plotter, br.g_x, br.g_y );
plotter->resize( plotter, br.g_w, br.g_h );
browser_get_rect( gw, BR_CONTENT, &br );
plot_set_dimensions(br.g_x, br.g_y, br.g_w, br.g_h);
gw->browser->attached = true;
if( gw->root->statusbar != NULL ){
gw->root->statusbar->attached = true;
@ -504,13 +501,10 @@ static void __CDECL evnt_window_icondraw( WINDOW *win, short buff[8], void * dat
} else {
struct rect clip = { 0,0,w,h };
plot_set_dimensions( x,y,w,h );
plotter->set_clip(plotter, &clip );
plotter->bitmap_resize( plotter, gw->icon, w, h );
plotter->bitmap(
plotter,
( gw->icon->resized ) ? gw->icon->resized : gw->icon,
0, 0, 0xffffff, BITMAPF_NONE
);
plot_clip(&clip);
plot_resize_bitmap(gw->icon, w, h);
plot_blit_bitmap(( gw->icon->resized ) ? gw->icon->resized : gw->icon,
0, 0, 0xffffff, BITMAPF_NONE);
}
}

View File

@ -149,8 +149,8 @@ void context_popup( struct gui_window * gw, short x, short y )
char * data;
FILE * fp_tmpfile;
char * tempfile;
int err = 0;
char * editor;
int err = 0;
char * editor;
char cmdline[128];
pop = get_tree( POP_CTX );
@ -177,7 +177,7 @@ void context_popup( struct gui_window * gw, short x, short y )
if( ctx->flags & CNT_HREF ){
SET_BIT(pop[ POP_CTX_COPY_LINK ].ob_state, DISABLED, 0);
SET_BIT(pop[ POP_CTX_OPEN_NEW ].ob_state, DISABLED, 0);
SET_BIT(pop[ POP_CTX_OPEN_NEW ].ob_state, DISABLED, 0);
SET_BIT(pop[ POP_CTX_SAVE_LINK_AS ].ob_state, DISABLED, 0);
}
@ -210,24 +210,24 @@ void context_popup( struct gui_window * gw, short x, short y )
browser_window_key_press( gw->browser->bw, KEY_SELECT_ALL );
break;
case POP_CTX_SAVE_AS:
if( ctx->ccdata.object != NULL ) {
case POP_CTX_SAVE_AS:
if( ctx->ccdata.object != NULL ) {
if( hlcache_handle_get_url(ctx->ccdata.object) != NULL ) {
browser_window_download(
gw->browser->bw,
nsurl_access(hlcache_handle_get_url(ctx->ccdata.object)),
nsurl_access(hlcache_handle_get_url(gw->browser->bw->current_content))
);
}
}
case POP_CTX_SAVE_LINK_AS:
if( ctx->ccdata.link_url != NULL ) {
}
}
case POP_CTX_SAVE_LINK_AS:
if( ctx->ccdata.link_url != NULL ) {
browser_window_download(
gw->browser->bw,
nsurl_access((const char*)ctx->ccdata.link_url),
nsurl_access(/*(const char*)*/ctx->ccdata.link_url),
nsurl_access(hlcache_handle_get_url(gw->browser->bw->current_content))
);
);
}
break;
@ -257,7 +257,7 @@ void context_popup( struct gui_window * gw, short x, short y )
}
break;
case POP_CTX_VIEW_SOURCE:
case POP_CTX_VIEW_SOURCE:
editor = nsoption_charp(atari_editor);
if( editor != NULL && strlen(editor)>0 ) {
data = content_get_source_data( gw->browser->bw->current_content, &size );
@ -266,24 +266,24 @@ void context_popup( struct gui_window * gw, short x, short y )
fp_tmpfile = fopen( tempfile, "w" );
if( fp_tmpfile ){
fwrite( data, size, 1, fp_tmpfile );
fclose( fp_tmpfile );
// TODO: check if app is runnin, if not, use pexec or such.
/*
sprintf((char*)&cmdline, "%s \"%s\"", nsoption_charp(atari_editor), tempfile );
system( (char*)&cmdline );
*/
err = ShelWrite( editor, tempfile , editor, 1, 0);
LOG(("Launched: %s %s (%d)\n", editor, tempfile, err ));
} else {
printf("Could not open temp file: %s!\n", tempfile );
}
fclose( fp_tmpfile );
} else {
LOG(("Invalid content!"));
// TODO: check if app is runnin, if not, use pexec or such.
/*
sprintf((char*)&cmdline, "%s \"%s\"", nsoption_charp(atari_editor), tempfile );
system( (char*)&cmdline );
*/
err = ShelWrite( editor, tempfile , editor, 1, 0);
LOG(("Launched: %s %s (%d)\n", editor, tempfile, err ));
} else {
printf("Could not open temp file: %s!\n", tempfile );
}
} else {
LOG(("Invalid content!"));
}
} else {
form_alert(0, "[1][Set option \"option_atari_editor\".][OK]");
} else {
form_alert(0, "[1][Set option \"option_atari_editor\".][OK]");
}
break;

View File

@ -31,13 +31,12 @@
#include "atari/gui.h"
#include "atari/font.h"
#include "atari/plot.h"
#include "atari/plot/plot.h"
#include "atari/findfile.h"
#include "atari/gui.h"
#include "atari/plot.h"
#include "atari/plot/plotter.h"
#include "atari/plot/plot.h"
extern GEM_FONT_PLOTTER fplotter;
extern FONT_PLOTTER fplotter;
static bool atari_font_position_in_string(const plot_font_style_t * fstyle,const char *string,
size_t length,int x, size_t *char_offset, int *actual_x )

View File

@ -71,7 +71,7 @@
#include "atari/global_evnt.h"
#include "atari/encoding.h"
#include "atari/res/netsurf.rsh"
#include "atari/plot.h"
#include "atari/plot/plot.h"
#include "atari/clipboard.h"
#include "atari/osspec.h"
#include "atari/search.h"
@ -85,7 +85,6 @@ struct gui_window *window_list = NULL;
void * h_gem_rsrc;
OBJECT * h_gem_menu;
OBJECT **rsc_trindex;
short vdih;
short rsc_ntree;
long next_poll;
bool rendering = false;
@ -972,7 +971,7 @@ static void gui_init(int argc, char** argv)
die("unable to process command line.\n");
nkc_init();
atari_plotter_init( nsoption_charp(atari_screen_driver), nsoption_charp(atari_font_driver) );
atari_plotter_init(nsoption_charp(atari_font_driver));
}
static char *theapp = (char*)"NetSurf";

View File

@ -25,7 +25,6 @@
#define NSOPTION_EXTRA_DEFINE \
char *atari_screen_driver; \
char *atari_font_driver; \
int atari_font_monochrom; \
int atari_dither; \
@ -50,7 +49,6 @@
char *tree_icons_path
#define NSOPTION_EXTRA_DEFAULTS \
.atari_screen_driver = (char*)"vdi", \
.atari_font_driver = (char*)"vdi", \
.atari_font_monochrom = 0, \
.atari_dither = 1, \
@ -75,7 +73,6 @@
.tree_icons_path = (char*)"./res/icons"
#define NSOPTION_EXTRA_TABLE \
{ "atari_screen_driver", OPTION_STRING, &nsoptions.atari_screen_driver },\
{ "atari_font_driver", OPTION_STRING, &nsoptions.atari_font_driver },\
{ "atari_font_monochrom", OPTION_INTEGER, &nsoptions.atari_font_monochrom },\
{ "atari_image_toolbar", OPTION_INTEGER, &nsoptions.atari_image_toolbar },\

View File

@ -20,12 +20,16 @@
#ifdef WITH_FREETYPE_FONT_DRIVER
#include <ft2build.h>
#include FT_CACHE_H
#include "atari/plot/plotter.h"
#include "desktop/options.h"
#include "atari/plot/plot.h"
#include "atari/plot/font_freetype.h"
#define DEJAVU_PATH "/usr/share/fonts/truetype/ttf-dejavu/"
extern unsigned long atari_plot_flags;
extern int atari_plot_vdi_handle;
static FT_Library library;
static FTC_Manager ft_cmanager;
@ -395,7 +399,7 @@ static void draw_glyph8(FONT_PLOTTER self, GRECT * clip, GRECT * loc, uint8_t *
h = loc->g_h;
w = loc->g_w;
assert( h <= fontbmp_allocated_height );
assert( w <= fontbmp_allocated_width );
@ -408,7 +412,7 @@ static void draw_glyph8(FONT_PLOTTER self, GRECT * clip, GRECT * loc, uint8_t *
linebuf[xloop] = (uint32_t)(colour | fontpix);
}
}
self->plotter->bitmap( self->plotter, fontbmp, loc->g_x, loc->g_y, 0, BITMAPF_MONOGLYPH);
plot_blit_bitmap(fontbmp, loc->g_x, loc->g_y, 0, BITMAPF_MONOGLYPH);
}
static void draw_glyph1(FONT_PLOTTER self, GRECT * clip, GRECT * loc, uint8_t * pixdata, int pitch, uint32_t colour)
@ -464,10 +468,10 @@ static void draw_glyph1(FONT_PLOTTER self, GRECT * clip, GRECT * loc, uint8_t *
#ifdef WITH_8BPP_SUPPORT
if( app.nplanes > 8 ){
#endif
self->plotter->plot_mfdb( self->plotter, loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS );
plot_blit_mfdb(loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS );
#ifdef WITH_8BPP_SUPPORT
} else {
self->plotter->plot_mfdb( self->plotter, loc, &tmp, colour, PLOT_FLAG_TRANS );
plot_blit_mfdb(loc, &tmp, colour, PLOT_FLAG_TRANS );
}
#endif
@ -493,7 +497,7 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
#endif
unsigned short out[4];
rgb_to_vdi1000( (unsigned char*)&c, (unsigned short*)&out );
vs_color( self->plotter->vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0] );
vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0]);
#ifdef WITH_8BPP_SUPPORT
} else {
c = RGB_TO_VDI(c);
@ -501,7 +505,7 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
#endif
}
self->plotter->get_clip( self->plotter, &clipping );
plot_get_clip(&clipping);
clip.g_x = clipping.x0;
clip.g_y = clipping.y0;
clip.g_w = (clipping.x1 - clipping.x0)+1;

View File

@ -17,15 +17,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef WITH_INTERNAL_FONT_DRIVER
#include "atari/plot/plotter.h"
#ifdef WITH_INTERNAL_FONT_DRIVER
#include "atari/plot/plot.h"
#include "atari/plot/fontplot.h"
#include "atari/plot/font_internal.h"
#include "utils/utf8.h"
#include "utils/log.h"
#include <windom.h>
extern unsigned long atari_plot_flags;
extern int atari_plot_vdi_handle;
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 );
@ -162,7 +166,7 @@ static void draw_glyph1(FONT_PLOTTER self, GRECT *inloc, uint8_t *chrp, int pitc
pixmask = (pixmask << 1);
}
}
self->plotter->bitmap( self->plotter, fontbmp, loc.g_x, loc.g_y, 0, BITMAPF_MONOGLYPH );
plot_blit_bitmap(fontbmp, loc.g_x, loc.g_y, 0, BITMAPF_MONOGLYPH );
}
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length,
@ -192,7 +196,7 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
return( 1 );
}
if( self->plotter->flags & PLOT_FLAG_OFFSCREEN ){
if(atari_plot_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.
@ -245,12 +249,12 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
#endif
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, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS );
vs_color(atari_plot_vdi_handle, OFFSET_CUSTOM_COLOR, (unsigned short*)&out[0] );
plot_blit_mfdb(&loc, &tmp, OFFSET_CUSTOM_COLOR, PLOT_FLAG_TRANS );
#ifdef WITH_8BPP_SUPPORT
} else {
unsigned char c = RGB_TO_VDI(fstyle->foreground);
self->plotter->plot_mfdb( self->plotter, &loc, &tmp, c, PLOT_FLAG_TRANS );
plot_blit_mfdb(&loc, &tmp, c, PLOT_FLAG_TRANS );
}
#endif
}

View File

@ -18,7 +18,9 @@
*/
#ifdef WITH_INTERNAL_FONT_DRIVER
#ifndef FONT_PLOTTER_INTERNAL
#define FONT_PLOTTER_INTERNAL
#define FONT_PLOTTER_INTERNAL
#include "atari/plot/plot.h"
int ctor_font_plotter_internal( FONT_PLOTTER self );

View File

@ -17,7 +17,7 @@
*/
#ifdef WITH_VDI_FONT_DRIVER
#include "atari/plot/plotter.h"
#include "atari/plot/plot.h"
#include "atari/plot/font_vdi.h"
#include "utils/utf8.h"

88
atari/plot/fontplot.c Normal file
View File

@ -0,0 +1,88 @@
#include "atari/plot/fontplot.h"
const struct s_font_driver_table_entry font_driver_table[] =
{
#ifdef WITH_VDI_FONT_DRIVER
{"vdi", ctor_font_plotter_vdi, 0},
#endif
#ifdef WITH_FREETYPE_FONT_DRIVER
{"freetype", ctor_font_plotter_freetype, 0},
#endif
#ifdef WITH_INTERNAL_FONT_DRIVER
{"internal", ctor_font_plotter_internal, 0},
#endif
{(char*)NULL, NULL, 0}
};
void dump_font_drivers(void)
{
int i = 0;
while( font_driver_table[i].name != NULL ) {
printf("%s -> flags: %d\n",
font_driver_table[i].name,
font_driver_table[i].flags
);
i++;
}
}
/*
Create an new text plotter object
*/
FONT_PLOTTER new_font_plotter( int vdihandle, char * name, unsigned long flags,
int * error)
{
int i=0;
int res = 0-ERR_PLOTTER_NOT_AVAILABLE;
FONT_PLOTTER fplotter = (FONT_PLOTTER)malloc( sizeof(struct s_font_plotter) );
if( fplotter == NULL ) {
*error = 0-ERR_NO_MEM;
return( NULL );
}
memset( fplotter, 0, sizeof(FONT_PLOTTER));
fplotter->vdi_handle = vdihandle;
fplotter->name = name;
fplotter->flags = 0;
fplotter->flags |= flags;
for( i = 0; ; i++) {
if( font_driver_table[i].name == NULL ) {
res = 0-ERR_PLOTTER_NOT_AVAILABLE;
break;
} else {
if( strcmp(name, font_driver_table[i].name) == 0 ) {
if( font_driver_table[i].ctor ) {
res = font_driver_table[i].ctor( fplotter );
*error = 0;
} else {
res = 0-ERR_PLOTTER_NOT_AVAILABLE;
*error = res;
return (NULL);
}
break;
}
}
}
if( res < 0 ) {
free( fplotter );
*error = res;
return( NULL );
}
return( fplotter );
}
/*
Free an font plotter
*/
int delete_font_plotter(FONT_PLOTTER p)
{
if( p ) {
p->dtor(p);
free( p );
p = NULL;
}
else
return( -1 );
return( 0 );
}

79
atari/plot/fontplot.h Normal file
View File

@ -0,0 +1,79 @@
#ifndef FONT_PLOT_H
#define FONT_PLOT_H
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#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
{
const char * name;
int (*ctor)( FONT_PLOTTER self );
int flags;
};
/* declaration of font plotter member functions: (_fpmf_ prefix) */
typedef int (*_fpmf_str_width)( FONT_PLOTTER self, const plot_font_style_t *fstyle,
const char * str, size_t length, int * width);
typedef int (*_fpmf_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);
typedef int (*_fpmf_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);
typedef int (*_fpmf_text)( FONT_PLOTTER self, int x, int y, const char *text,
size_t length, const plot_font_style_t *fstyle);
typedef void (*_fpmf_draw_glyph)(FONT_PLOTTER self, GRECT * clip, GRECT * loc,
uint8_t * pixdata, int pitch, uint32_t colour);
typedef int (*_fpmf_dtor)( FONT_PLOTTER self );
/* prototype of the font plotter "object" */
struct s_font_plotter
{
char * name;
int flags;
int vdi_handle;
void * priv_data;
_fpmf_str_width str_width;
_fpmf_str_split str_split;
_fpmf_pixel_pos pixel_pos;
_fpmf_text text;
_fpmf_draw_glyph draw_glyph;
_fpmf_dtor dtor;
};
void dump_font_drivers(void);
FONT_PLOTTER new_font_plotter( int vdihandle, char * name, unsigned long flags,
int * error);
int delete_font_plotter( FONT_PLOTTER p );
#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
#endif

2068
atari/plot/plot.c Executable file

File diff suppressed because it is too large Load Diff

187
atari/plot/plot.h Executable file
View File

@ -0,0 +1,187 @@
/*
* Copyright 2010 Ole Loots <ole@monochrom.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NS_ATARI_PLOT_H
#define NS_ATARI_PLOT_H
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <windom.h>
#include <assert.h>
#include <mint/osbind.h>
#include <mint/cookie.h>
#include <Hermes/Hermes.h>
#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: */
#define CONV_KEEP_LIMIT 512000
/* 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 */
/* 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 */
/* Plotter "internal" flags */
#define PLOT_FLAG_LOCKED 0x08000 /* plotter should set this flag during screen updates */
/* Font Plotter flags: */
#define FONTPLOT_FLAG_MONOGLYPH 0x01
/* Flags for init_mfdb function: */
#define MFDB_FLAG_STAND 0x01
#define MFDB_FLAG_ZEROMEM 0x02
#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 */
/* 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 */
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 */
};
struct rect;
extern const struct plotter_table atari_plotters;
int atari_plotter_init(char *);
int atari_plotter_finalise(void);
/* translate an error number */
const char* plot_err_str(int i) ;
bool plot_lock(void);
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);
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 );
bool plot_resize_bitmap(struct bitmap * img, int nw, int nh);
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, 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;\
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;\
}\
#define PLOTTER_IS_LOCKED() ( atari_plot_flags & PLOTTER_FLAG_LOCKED )
#ifdef WITH_8BPP_SUPPORT
/* some Well known indexes into the VDI palette */
/* common indexes into the VDI palette */
/* (only used when running with 256 colors or less ) */
#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
/* 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: */
#define OFFSET_CUSTOM_COLOR 255
#endif

View File

@ -42,10 +42,10 @@
#include "atari/misc.h"
#include "atari/global_evnt.h"
#include "atari/res/netsurf.rsh"
#include "atari/plot/plotter.h"
#include "atari/plot/plot.h"
#include "atari/osspec.h"
extern short vdih;
extern int atari_plot_vdi_handle;
static
void __CDECL evnt_sb_redraw( COMPONENT *c, long buff[8] )
@ -69,42 +69,43 @@ void __CDECL evnt_sb_redraw( COMPONENT *c, long buff[8] )
if ( !rc_lintersect( (LGRECT*)&buff[4], &lclip ) ) {
return;
}
vsf_interior( vdih, FIS_SOLID );
vsl_color( vdih, BLACK );
vsl_type( vdih, 1);
vsl_width( vdih, 1 );
vst_color(vdih, BLACK);
vsf_interior(atari_plot_vdi_handle, FIS_SOLID );
vsl_color(atari_plot_vdi_handle, BLACK );
vsl_type(atari_plot_vdi_handle, 1);
vsl_width(atari_plot_vdi_handle, 1 );
vst_color(atari_plot_vdi_handle, BLACK);
vst_height( vdih, atari_sysinfo.medium_sfont_pxh, &pxy[0], &pxy[1], &pxy[2], &pxy[3] );
vst_alignment(vdih, 0, 5, &d, &d );
vst_effects( vdih, 0 );
vst_height(atari_plot_vdi_handle, atari_sysinfo.medium_sfont_pxh, &pxy[0], &pxy[1], &pxy[2], &pxy[3] );
vst_alignment(atari_plot_vdi_handle, 0, 5, &d, &d );
vst_effects(atari_plot_vdi_handle, 0 );
pxyclip[0] = lclip.g_x;
pxyclip[1] = lclip.g_y;
pxyclip[2] = lclip.g_x + lclip.g_w-1;
pxyclip[3] = lclip.g_y + lclip.g_h-1;
vs_clip(vdih, 1, (short*)&pxyclip );
vswr_mode( vdih, MD_REPLACE );
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxyclip );
vswr_mode(atari_plot_vdi_handle, MD_REPLACE );
if( lclip.g_y <= work.g_y ) {
pxy[0] = work.g_x;
pxy[1] = work.g_y;
pxy[2] = MIN( work.g_x + work.g_w, lclip.g_x + lclip.g_w );
pxy[3] = work.g_y;
v_pline( vdih, 2, (short*)&pxy );
v_pline(atari_plot_vdi_handle, 2, (short*)&pxy );
}
if(app.nplanes > 2) {
vsf_color( vdih, LWHITE);
vsf_color(atari_plot_vdi_handle, LWHITE);
} else {
vsf_color( vdih, WHITE );
vsf_color(atari_plot_vdi_handle, WHITE );
}
pxy[0] = work.g_x;
pxy[1] = work.g_y+1;
pxy[2] = work.g_x + work.g_w-1;
pxy[3] = work.g_y + work.g_h-1;
v_bar( vdih, pxy );
v_bar(atari_plot_vdi_handle, pxy );
if( sb->textlen > 0 ) {
short curx;
@ -114,32 +115,32 @@ void __CDECL evnt_sb_redraw( COMPONENT *c, long buff[8] )
t[1]=0;
if( atari_sysinfo.sfont_monospaced ) {
t[0]='A';
int r = vqt_width( vdih, t[0], &vqw[0], &vqw[1], &vqw[2] );
int r = vqt_width(atari_plot_vdi_handle, t[0], &vqw[0], &vqw[1], &vqw[2] );
cw = vqw[0];
}
vswr_mode( vdih, MD_TRANS );
vswr_mode(atari_plot_vdi_handle, MD_TRANS );
for( curx = work.g_x + 2, i=0 ; (curx+cw < work.g_x+work.g_w ) && i < sb->textlen; i++ ){
t[0] = sb->text[i];
if( !atari_sysinfo.sfont_monospaced ) {
vqt_width( vdih, t[0], &vqw[0], &vqw[1], &vqw[2] );
vqt_width(atari_plot_vdi_handle, t[0], &vqw[0], &vqw[1], &vqw[2] );
cw = vqw[0];
}
if( curx >= lclip.g_x - cw ) {
v_gtext( vdih, curx, work.g_y + 5, (char*)&t );
v_gtext(atari_plot_vdi_handle, curx, work.g_y + 5, (char*)&t );
}
curx += cw;
if( curx >= lclip.g_x + lclip.g_w )
break;
}
}
vswr_mode( vdih, MD_REPLACE );
vswr_mode(atari_plot_vdi_handle, MD_REPLACE );
pxy[0] = work.g_x + work.g_w;
pxy[1] = work.g_y + work.g_h;
pxy[2] = work.g_x + work.g_w;
pxy[3] = work.g_y + work.g_h-work.g_h;
v_pline( vdih, 2, (short*)&pxy );
v_pline(atari_plot_vdi_handle, 2, (short*)&pxy );
vs_clip(vdih, 0, (short*)&pxyclip );
vs_clip(atari_plot_vdi_handle, 0, (short*)&pxyclip );
return;
}

View File

@ -37,6 +37,7 @@
#include "desktop/plot_style.h"
#include "desktop/plotters.h"
#include "desktop/tree.h"
#include "desktop/options.h"
#include "utils/utf8.h"
#include "atari/clipboard.h"
#include "atari/gui.h"
@ -46,17 +47,16 @@
#include "atari/clipboard.h"
#include "atari/misc.h"
#include "atari/global_evnt.h"
#include "atari/plot.h"
#include "atari/plot/plot.h"
#include "cflib.h"
#include "atari/res/netsurf.rsh"
#include "atari/plot/plotter.h"
extern char * cfg_homepage_url;
extern short vdih;
extern void * h_gem_rsrc;
extern GEM_PLOTTER plotter;
extern struct gui_window * input_window;
extern long atari_plot_flags;
extern int atari_plot_vdi_handle;
static OBJECT * toolbar_buttons = NULL;
static OBJECT * throbber_form = NULL;
@ -187,7 +187,7 @@ void toolbar_init( void )
for( i=0; i<n; i++ ){
toolbar_styles[i].bgcolor = toolbar_bg_color;
if( img_toolbar ){
vq_color( vdih, toolbar_bg_color, 0, vdicolor );
vq_color(atari_plot_vdi_handle, toolbar_bg_color, 0, vdicolor );
vdi1000_to_rgb( vdicolor, (unsigned char*)&rgbcolor );
toolbar_styles[i].icon_bgcolor = rgbcolor;
}
@ -291,9 +291,9 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
}
/* Setup draw mode: */
vsf_interior( vdih , 1 );
vsf_color( vdih, toolbar_styles[tb->style].bgcolor );
vswr_mode( vdih, MD_REPLACE);
vsf_interior(atari_plot_vdi_handle , 1 );
vsf_color(atari_plot_vdi_handle, toolbar_styles[tb->style].bgcolor );
vswr_mode(atari_plot_vdi_handle, MD_REPLACE);
/* go through the rectangle list, using classic AES methods. */
/* Windom ComGetLGrect is buggy for WF_FIRST/NEXTXYWH */
@ -310,8 +310,8 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
pxy[1] = todo.g_y;
pxy[2] = todo.g_w + todo.g_x-1;
pxy[3] = todo.g_h + todo.g_y-1;
vs_clip( vdih, 1, (short*)&pxy );
v_bar( vdih, (short*)&pxy );
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
v_bar(atari_plot_vdi_handle, (short*)&pxy );
if( img_toolbar == true ){
atari_plotters.bitmap( bmpx, bmpy, bmpw, bmph, icon,
@ -320,7 +320,7 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
} else {
objc_draw( tree, 0, 0, todo.g_x, todo.g_y, todo.g_w, todo.g_h );
}
vs_clip( vdih, 0, (short*)&clip );
vs_clip(atari_plot_vdi_handle, 0, (short*)&clip );
}
wind_get(gw->root->handle->handle, WF_NEXTXYWH,
&todo.g_x, &todo.g_y, &todo.g_w, &todo.g_h );
@ -389,17 +389,17 @@ void __CDECL evnt_throbber_redraw( COMPONENT *c, long buff[8])
clip = work;
if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
vsf_interior( vdih , 1 );
vsf_interior(atari_plot_vdi_handle , 1 );
if(app.nplanes > 2 )
vsf_color( vdih, toolbar_styles[tb->style].bgcolor );
vsf_color(atari_plot_vdi_handle, toolbar_styles[tb->style].bgcolor );
else
vsf_color( vdih, WHITE );
vsf_color(atari_plot_vdi_handle, WHITE );
pxy[0] = (short)buff[4];
pxy[1] = (short)buff[5];
pxy[2] = (short)buff[4] + buff[6]-1;
pxy[3] = (short)buff[5] + buff[7]-2;
v_bar( vdih, (short*)&pxy );
vs_clip( vdih, 1, (short*)&pxy );
v_bar(atari_plot_vdi_handle, (short*)&pxy );
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
if( img_toolbar ){
@ -492,41 +492,41 @@ void __CDECL evnt_url_redraw( COMPONENT *c, long buff[8] )
pxy[1] = clip.g_y;
pxy[2] = clip.g_w + clip.g_x-1;
pxy[3] = clip.g_h + clip.g_y-1;
vs_clip( vdih, 1, (short*)&pxy );
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
vsf_perimeter( vdih, 0 );
vsf_interior( vdih , 1 );
vsf_color( vdih, toolbar_styles[tb->style].bgcolor );
vsf_perimeter(atari_plot_vdi_handle, 0 );
vsf_interior(atari_plot_vdi_handle , 1 );
vsf_color(atari_plot_vdi_handle, toolbar_styles[tb->style].bgcolor );
//left margin:
pxy[0] = work.g_x;
pxy[1] = work.g_y;
pxy[2] = work.g_x + TOOLBAR_URL_MARGIN_LEFT-1;
pxy[3] = work.g_y + work.g_h-1;
v_bar( vdih, pxy );
v_bar(atari_plot_vdi_handle, pxy );
// right margin:
pxy[0] = work.g_x+work.g_w-TOOLBAR_URL_MARGIN_RIGHT;
pxy[1] = work.g_y;
pxy[2] = work.g_x+work.g_w-1;
pxy[3] = work.g_y+work.g_h-1;
v_bar( vdih, pxy );
v_bar(atari_plot_vdi_handle, pxy );
// top margin:
pxy[0] = work.g_x;
pxy[1] = work.g_y;
pxy[2] = work.g_x+work.g_w-1;
pxy[3] = work.g_y+TOOLBAR_URL_MARGIN_TOP-1;
v_bar( vdih, pxy );
v_bar(atari_plot_vdi_handle, pxy );
// bottom margin:
pxy[0] = work.g_x;
pxy[1] = work.g_y+work.g_h-TOOLBAR_URL_MARGIN_BOTTOM;
pxy[2] = work.g_x+work.g_w-1;
pxy[3] = work.g_y+work.g_h-1;
v_bar( vdih, pxy );
v_bar(atari_plot_vdi_handle, pxy );
vs_clip( vdih, 0, (short*)&pxy );
vs_clip(atari_plot_vdi_handle, 0, (short*)&pxy );
// TBD: request redraw of textarea for specific region.
clip.g_x -= work.g_x+TOOLBAR_URL_MARGIN_LEFT;
@ -619,14 +619,14 @@ static void __CDECL evnt_toolbar_redraw( COMPONENT *c, long buff[8], void *data
if( work.g_y + work.g_h != clip.g_y + clip.g_h ) return;
vswr_mode( vdih, MD_REPLACE );
vsl_color( vdih, BLACK );
vsl_type( vdih, 1 );
vsl_width( vdih, 1 );
vswr_mode(atari_plot_vdi_handle, MD_REPLACE );
vsl_color(atari_plot_vdi_handle, BLACK );
vsl_type(atari_plot_vdi_handle, 1 );
vsl_width(atari_plot_vdi_handle, 1 );
pxy[0] = clip.g_x;
pxy[1] = pxy[3] = work.g_y + work.g_h-1 ;
pxy[2] = clip.g_x + clip.g_w;
v_pline( vdih, 2, (short*)&pxy );
v_pline(atari_plot_vdi_handle, 2, (short*)&pxy );
}
@ -659,10 +659,11 @@ static void tb_txt_request_redraw(void *data, int x, int y, int w, int h)
}
void tb_url_redraw( struct gui_window * gw )
{
{
CMP_TOOLBAR t = gw->root->toolbar;
if (t != NULL) {
if( t->url.redraw && ((plotter->flags & PLOT_FLAG_OFFSCREEN) == 0) ) {
if( t->url.redraw && ((atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0) ) {
const struct redraw_context ctx = {
.interactive = true,
@ -679,14 +680,14 @@ void tb_url_redraw( struct gui_window * gw )
work.g_h -= TOOLBAR_URL_MARGIN_BOTTOM;
plot_set_dimensions( work.g_x, work.g_y, work.g_w, work.g_h );
if( plotter->lock( plotter ) == 0 )
if(plot_lock() == false)
return;
todo[0] = work.g_x;
todo[1] = work.g_y;
todo[2] = todo[0] + work.g_w-1;
todo[3] = todo[1] + work.g_h-1;
vs_clip(plotter->vdi_handle, 1, (short*)&todo );
vs_clip(atari_plot_vdi_handle, 1, (short*)&todo );
if( wind_get(gw->root->handle->handle, WF_FIRSTXYWH,
&todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
@ -719,11 +720,11 @@ void tb_url_redraw( struct gui_window * gw )
}
}
} else {
plotter->unlock( plotter );
plot_unlock();
return;
}
plotter->unlock( plotter );
vs_clip(plotter->vdi_handle, 0, (short*)&todo);
plot_unlock();
vs_clip(atari_plot_vdi_handle, 0, (short*)&todo);
t->url.redraw = false;
t->url.rdw_area.g_x = 65000;
t->url.rdw_area.g_y = 65000;

View File

@ -35,7 +35,7 @@
#include "utils/utils.h"
#include "atari/gui.h"
#include "atari/treeview.h"
#include "atari/plot.h"
#include "atari/plot/plot.h"
#include "atari/misc.h"
#include "cflib.h"
@ -43,7 +43,8 @@ extern int mouse_hold_start[3];
extern browser_mouse_state bmstate;
extern short last_drag_x;
extern short last_drag_y;
extern GEM_PLOTTER plotter;
extern long atari_plot_flags;
extern int atari_plot_vdi_handle;
static void atari_treeview_resized(struct tree *tree,int w,int h,void *pw);
static void atari_treeview_scroll_visible(int y, int h, void *pw);
@ -265,9 +266,10 @@ bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y
void atari_treeview_redraw( NSTREEVIEW tv)
{
{
if (tv != NULL) {
if( tv->redraw && ((plotter->flags & PLOT_FLAG_OFFSCREEN) == 0) ) {
if( tv->redraw && ((atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0) ) {
short todo[4];
GRECT work;
WindGetGrect( tv->window, WF_WORKXYWH, &work );
@ -277,17 +279,15 @@ void atari_treeview_redraw( NSTREEVIEW tv)
.background_images = true,
.plot = &atari_plotters
};
plotter->resize(plotter, work.g_w, work.g_h);
plotter->move(plotter, work.g_x, work.g_y );
if( plotter->lock( plotter ) == 0 )
plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
if (plot_lock() == false)
return;
todo[0] = work.g_x;
todo[1] = work.g_y;
todo[2] = todo[0] + work.g_w-1;
todo[3] = todo[1] + work.g_h-1;
vs_clip(plotter->vdi_handle, 1, (short*)&todo );
vs_clip(atari_plot_vdi_handle, 1, (short*)&todo );
if( wind_get(tv->window->handle, WF_FIRSTXYWH,
&todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
@ -316,11 +316,11 @@ void atari_treeview_redraw( NSTREEVIEW tv)
}
}
} else {
plotter->unlock( plotter );
plot_unlock();
return;
}
plotter->unlock( plotter );
vs_clip(plotter->vdi_handle, 0, (short*)&todo);
plot_unlock();
vs_clip(atari_plot_vdi_handle, 0, (short*)&todo);
tv->redraw = false;
tv->rdw_area.g_x = 65000;
tv->rdw_area.g_y = 65000;

View File

@ -33,12 +33,12 @@
#include "atari/verify_ssl.h"
/*
todo: this file need to use the treeview api - complete rework,
current implementation is not used in any way.
todo: this file need to use the treeview api - complete rework,
current implementation is not used in any way.
*/
extern void * h_gem_rsrc;
extern short vdih;
extern short atari_plot_vdi_handle;
#define CERT_INF_LINES 8
@ -95,15 +95,15 @@ static void __CDECL cert_info_draw( WINDOW * win, short buf[8], void * data)
work.g_h = 176;
maxchars = (work.g_w / 8)+1;
vs_clip( vdih, 1,(short*) &pxy );
vswr_mode( vdih, MD_REPLACE );
vsf_interior( vdih, 1 );
vsf_color( vdih, LWHITE );
v_bar( vdih, (short*)&pxy );
vst_height( vdih, 16, &d, &d, &cbw, &cbh );
vst_alignment(vdih, 0, 5, &d, &d );
vst_color( vdih, BLACK );
vst_effects( vdih, 0 );
vs_clip( atari_plot_vdi_handle, 1,(short*) &pxy );
vswr_mode( atari_plot_vdi_handle, MD_REPLACE );
vsf_interior( atari_plot_vdi_handle, 1 );
vsf_color( atari_plot_vdi_handle, LWHITE );
v_bar( atari_plot_vdi_handle, (short*)&pxy );
vst_height( atari_plot_vdi_handle, 16, &d, &d, &cbw, &cbh );
vst_alignment(atari_plot_vdi_handle, 0, 5, &d, &d );
vst_color( atari_plot_vdi_handle, BLACK );
vst_effects( atari_plot_vdi_handle, 0 );
px_ypos = px_xpos = 0;
for(i=0; i<CERT_INF_LINES; i++ ) {
switch( i ) {
@ -145,12 +145,12 @@ static void __CDECL cert_info_draw( WINDOW * win, short buf[8], void * data)
if( (int)strlen(line) > dp->scrollx ) {
if( dp->scrollx + maxchars < 511 && ( (signed int)strlen(line) - dp->scrollx) > maxchars )
line[dp->scrollx + maxchars] = 0;
v_gtext(vdih, work.g_x + 1, work.g_y + px_ypos, &line[dp->scrollx]);
v_gtext(atari_plot_vdi_handle, work.g_x + 1, work.g_y + px_ypos, &line[dp->scrollx]);
}
px_ypos += cbh;
}
vst_alignment(vdih, 0, 0, &d, &d );
vs_clip( vdih, 0, (short*)&pxy );
vst_alignment(atari_plot_vdi_handle, 0, 0, &d, &d );
vs_clip( atari_plot_vdi_handle, 0, (short*)&pxy );
free( line );
}