update atari plotters to new API

This commit is contained in:
Vincent Sanders 2017-02-12 18:01:46 +00:00
parent a3a7cbf06a
commit 4361bfeace
6 changed files with 1304 additions and 1012 deletions

View File

@ -39,6 +39,7 @@
#include "netsurf/content.h"
#include "netsurf/cookie_db.h"
#include "netsurf/url_db.h"
#include "netsurf/plotters.h"
#include "content/backing_store.h"
#include "atari/gemtk/gemtk.h"
@ -1019,7 +1020,12 @@ static void gui_init(int argc, char** argv)
nkc_init();
LOG("Initializing plotters...");
plot_init(nsoption_charp(atari_font_driver));
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &atari_plotters
};
plot_init(&ctx, nsoption_charp(atari_font_driver));
aes_event_in.emi_m1leave = MO_LEAVE;
aes_event_in.emi_m1.g_w = 1;

File diff suppressed because it is too large Load Diff

View File

@ -55,6 +55,7 @@
#define ERR_PLOTTER_NOT_AVAILABLE 3 /* invalid plotter driver name passed */
struct plot_style_s;
struct redraw_context;
struct s_vdi_sysinfo {
short vdi_handle; /**< vdi handle */
@ -83,7 +84,15 @@ struct rect;
extern const struct plotter_table atari_plotters;
int plot_init(char *);
/**
* Init screen and font driver objects.
*
* \param fdrvrname font driver name.
* \return value > 1 when the objects could be succesfully created or
* <= 0 to indicate an error.
*/
int plot_init(const struct redraw_context *ctx, char *fdrvrname);
int plot_finalise(void);
/**
@ -93,7 +102,15 @@ 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 );
/**
* Set plot origin and canvas size
* \param x the x origin
* \param y the y origin
* \param w the width of the plot area
* \param h the height of the plot area
*/
bool plot_set_dimensions(const struct redraw_context *ctx, int x, int y, int w, int h );
bool plot_get_dimensions(GRECT *dst);
float plot_get_scale(void);
float plot_set_scale(float);
@ -101,13 +118,10 @@ void plot_set_abs_clipping(const GRECT *area);
void plot_get_abs_clipping(struct rect *dst);
void plot_get_abs_clipping_grect(GRECT *dst);
bool plot_get_clip(struct rect * out);
/* Get clipping for current framebuffer as GRECT */
/** Get clipping for current framebuffer as GRECT */
void plot_get_clip_grect(GRECT * out);
bool plot_clip(const struct rect *clip);
VdiHdl plot_get_vdi_handle(void);
long plot_get_flags(void);
bool plot_rectangle( int x0, int y0, int x1, int y1,const struct plot_style_s *style );
bool plot_line( int x0, int y0, int x1, int y1, const struct plot_style_s *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);

View File

@ -758,8 +758,11 @@ void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip_ro)
xoff = ((work.g_w-work.g_h)/2);
work.g_w = work.g_h;
}
plot_set_dimensions( work.g_x+xoff, work.g_y, work.g_w,
work.g_h);
plot_set_dimensions(&rootwin_rdrw_ctx,
work.g_x+xoff,
work.g_y,
work.g_w,
work.g_h);
wind_get_grect(rootwin->aes_handle, WF_FIRSTXYWH, &visible);
while (visible.g_h > 0 && visible.g_w > 0) {
@ -776,8 +779,14 @@ void window_redraw_favicon(ROOTWIN *rootwin, GRECT *clip_ro)
vs_clip(plot_vdi_handle, 1, (short*)&pxy);
//dbg_pxy("vdi clip", (short*)&pxy);
atari_plotters.bitmap(0, 0, work.g_w, work.g_h,
rootwin->icon, 0xffffff, 0);
rootwin_rdrw_ctx.plot->bitmap(&rootwin_rdrw_ctx,
rootwin->icon,
0,
0,
work.g_w,
work.g_h,
0xffffff,
0);
} else {
//dbg_grect("redraw vis area outside", &visible);
}
@ -822,7 +831,8 @@ static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area,
//dbg_grect("browser redraw, content area", content_area);
//dbg_grect("browser redraw, content clip", clip);
plot_set_dimensions(content_area->g_x, content_area->g_y,
plot_set_dimensions(&rootwin_rdrw_ctx,
content_area->g_x, content_area->g_y,
content_area->g_w, content_area->g_h);
oldscale = plot_set_scale(browser_window_get_scale(rootwin->active_gui_window->browser->bw));
@ -849,7 +859,7 @@ static void window_redraw_content(ROOTWIN *rootwin, GRECT *content_area,
redraw_area.x1 = content_area_rel.g_x + content_area_rel.g_w;
redraw_area.y1 = content_area_rel.g_y + content_area_rel.g_h;
plot_clip(&redraw_area);
rootwin_rdrw_ctx.plot->clip(&rootwin_rdrw_ctx, &redraw_area);
//dbg_rect("rdrw area", &redraw_area);

View File

@ -435,7 +435,7 @@ void toolbar_redraw(struct s_toolbar *tb, GRECT *clip)
if (rc_intersect(clip, &area)) {
float old_scale;
plot_set_dimensions(area_ro.g_x, area_ro.g_y, area_ro.g_w, area_ro.g_h);
plot_set_dimensions(&toolbar_rdrw_ctx, area_ro.g_x, area_ro.g_y, area_ro.g_w, area_ro.g_h);
struct rect r = {
.x0 = MAX(0,area.g_x - area_ro.g_x),
.y0 = MAX(0,area.g_y - area_ro.g_y),

View File

@ -223,7 +223,11 @@ void atari_treeview_redraw(struct core_window *cw)
.background_images = true,
.plot = &atari_plotters
};
plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
plot_set_dimensions(&ctx,
work.g_x,
work.g_y,
work.g_w,
work.g_h);
if (plot_lock() == false)
return;