From 76d1758d7f51d071be9c09b55e50c6ee82ed8afc Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 13 Feb 2017 18:27:37 +0000 Subject: Make gui_globals less... global --- frontends/amiga/corewindow.c | 1 + frontends/amiga/gui.c | 3 +++ frontends/amiga/history_local.c | 2 +- frontends/amiga/plotters.c | 25 +++++++++++++++++++++++++ frontends/amiga/plotters.h | 29 ++++++++--------------------- frontends/amiga/print.c | 6 ++---- 6 files changed, 40 insertions(+), 26 deletions(-) (limited to 'frontends') diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c index 5fc5c3736..84861e073 100644 --- a/frontends/amiga/corewindow.c +++ b/frontends/amiga/corewindow.c @@ -47,6 +47,7 @@ #include "netsurf/plot_style.h" #include +#include #include #include #include diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index a8a1265d9..a82482c9f 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -4911,6 +4911,8 @@ static void ami_do_redraw(struct gui_window_2 *gwin) } else { +#if 0 +/**FIXME: this is broken, only exists for debugging */ ami_plot_ra_set_pen_list(browserglob, gwin->shared_pens); temprp = browserglob->rp; browserglob->rp = gwin->win->RPort; @@ -4928,6 +4930,7 @@ static void ami_do_redraw(struct gui_window_2 *gwin) } ami_reset_pointer(gwin); +#endif } /* Tell NetSurf not to bother with the next queued box redraw, as we've redrawn everything. */ ami_gui_window_update_box_deferred(gwin->gw, false); diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c index 34d6b03c4..368557dd6 100755 --- a/frontends/amiga/history_local.c +++ b/frontends/amiga/history_local.c @@ -109,7 +109,7 @@ static void ami_history_redraw(struct history_window *hw) ami_clearclipreg(hw->gg); ami_history_update_extent(hw); - BltBitMapRastPort(hw->gg->bm, 0, 0, hw->win->RPort, + BltBitMapRastPort(ami_plot_ra_get_bitmap(hw->gg), 0, 0, hw->win->RPort, bbox->Left, bbox->Top, bbox->Width, bbox->Height, 0x0C0); ami_gui_free_space_box(bbox); diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c index 0f00bc415..cc48fc442 100644 --- a/frontends/amiga/plotters.c +++ b/frontends/amiga/plotters.c @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include @@ -82,6 +84,24 @@ struct bez_point { float y; }; +struct gui_globals { + struct BitMap *bm; + struct RastPort *rp; + struct Layer_Info *layerinfo; + APTR areabuf; + APTR tmprasbuf; + struct Rectangle rect; + struct MinList *shared_pens; + bool managed_pen_list; + bool palette_mapped; + ULONG apen; + ULONG open; + LONG apen_num; + LONG open_num; + int width; /* size of bm and */ + int height; /* associated memory */ +}; + static int init_layers_count = 0; static APTR pool_pens = NULL; static bool palette_mapped = true; /* palette-mapped state for the screen */ @@ -260,6 +280,11 @@ void ami_plot_ra_free(struct gui_globals *gg) free(gg); } +struct RastPort *ami_plot_ra_get_rastport(struct gui_globals *gg) +{ + return gg->rp; +} + struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg) { return gg->bm; diff --git a/frontends/amiga/plotters.h b/frontends/amiga/plotters.h index ed89916e7..94259234b 100644 --- a/frontends/amiga/plotters.h +++ b/frontends/amiga/plotters.h @@ -20,29 +20,9 @@ #define AMIGA_PLOTTERS_H #include "netsurf/plotters.h" -#include -#include struct IBox; - -struct gui_globals -{ - struct BitMap *bm; - struct RastPort *rp; - struct Layer_Info *layerinfo; - APTR areabuf; - APTR tmprasbuf; - struct Rectangle rect; - struct MinList *shared_pens; - bool managed_pen_list; - bool palette_mapped; - ULONG apen; - ULONG open; - LONG apen_num; - LONG open_num; - int width; /* size of bm and */ - int height; /* associated memory */ -}; +struct gui_globals; extern const struct plotter_table amiplot; @@ -69,6 +49,13 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit */ void ami_plot_ra_free(struct gui_globals *gg); +/** + * Get RastPort associated with a render area + * \param gg render area + * \returns pointer to render area BitMap + */ +struct RastPort *ami_plot_ra_get_rastport(struct gui_globals *gg); + /** * Get a drawing BitMap associated with a render area * \param gg render area diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c index 13ffc5b96..8c8565478 100644 --- a/frontends/amiga/print.c +++ b/frontends/amiga/print.c @@ -495,12 +495,10 @@ struct MsgPort *ami_print_get_msgport(void) bool ami_print_begin(struct print_settings *ps) { - ami_print_info.gg = calloc(1, sizeof(struct gui_globals)); - if(!ami_print_info.gg) return false; - ami_print_info.gg = ami_plot_ra_alloc(ami_print_info.PED->ped_MaxXDots, ami_print_info.PED->ped_MaxYDots, true, false); + if(!ami_print_info.gg) return false; ami_print_info.page = 0; @@ -538,7 +536,7 @@ bool ami_print_dump(void) ami_print_info.PReq->io_Command = PRD_DUMPRPORT; ami_print_info.PReq->io_Flags = 0; ami_print_info.PReq->io_Error = 0; - ami_print_info.PReq->io_RastPort = ami_print_info.gg->rp; + ami_print_info.PReq->io_RastPort = ami_plot_ra_get_rastport(ami_print_info.gg); ami_print_info.PReq->io_ColorMap = NULL; ami_print_info.PReq->io_Modes = 0; ami_print_info.PReq->io_SrcX = 0; -- cgit v1.2.3