Make gui_globals less... global

This commit is contained in:
Chris Young 2017-02-13 18:27:37 +00:00
parent e38f4d2f1a
commit 76d1758d7f
6 changed files with 40 additions and 26 deletions

View File

@ -47,6 +47,7 @@
#include "netsurf/plot_style.h"
#include <proto/exec.h>
#include <proto/graphics.h>
#include <proto/intuition.h>
#include <proto/layout.h>
#include <proto/utility.h>

View File

@ -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);

View File

@ -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);

View File

@ -20,6 +20,8 @@
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/layers.h>
#include <proto/graphics.h>
#include <intuition/intuition.h>
#include <graphics/rpattr.h>
@ -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;

View File

@ -20,29 +20,9 @@
#define AMIGA_PLOTTERS_H
#include "netsurf/plotters.h"
#include <proto/layers.h>
#include <proto/graphics.h>
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

View File

@ -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;