Remove use of global context data from Amiga frontend
This commit is contained in:
parent
7b9fa8d7eb
commit
edaa9c29f2
|
@ -179,7 +179,8 @@ bool print_draw_next_page(const struct printer *printer,
|
|||
struct redraw_context ctx = {
|
||||
.interactive = false,
|
||||
.background_images = !nsoption_bool(remove_backgrounds),
|
||||
.plot = printer->plotter
|
||||
.plot = printer->plotter,
|
||||
.priv = settings->priv
|
||||
};
|
||||
|
||||
html_redraw_printing_top_cropped = INT_MAX;
|
||||
|
|
|
@ -61,6 +61,9 @@ struct print_settings{
|
|||
|
||||
/*the functions used to measure fonts*/
|
||||
const struct gui_layout_table *font_func;
|
||||
|
||||
/* Private data for the plotter context */
|
||||
const void *priv;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -725,25 +725,22 @@ static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *conte
|
|||
#ifdef __amigaos4__
|
||||
LOG("Entering bitmap_render");
|
||||
|
||||
struct redraw_context ctx = {
|
||||
.interactive = false,
|
||||
.background_images = true,
|
||||
.plot = &amiplot
|
||||
};
|
||||
|
||||
int plot_width;
|
||||
int plot_height;
|
||||
struct gui_globals bm_globals;
|
||||
struct gui_globals *temp_gg = glob;
|
||||
|
||||
struct redraw_context ctx = {
|
||||
.interactive = false,
|
||||
.background_images = true,
|
||||
.plot = &amiplot,
|
||||
.priv = &bm_globals
|
||||
};
|
||||
|
||||
plot_width = MIN(content_get_width(content), bitmap->width);
|
||||
plot_height = ((plot_width * bitmap->height) + (bitmap->width / 2)) /
|
||||
bitmap->width;
|
||||
|
||||
ami_init_layers(&bm_globals, bitmap->width, bitmap->height, true);
|
||||
bm_globals.shared_pens = NULL;
|
||||
|
||||
glob = &bm_globals;
|
||||
ami_clearclipreg(&bm_globals);
|
||||
|
||||
content_scaled_redraw(content, plot_width, plot_height, &ctx);
|
||||
|
@ -768,12 +765,6 @@ static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *conte
|
|||
|
||||
ami_free_layers(&bm_globals);
|
||||
amiga_bitmap_set_opaque(bitmap, true);
|
||||
|
||||
/* Restore previous render area. This is set when plotting starts,
|
||||
* but if bitmap_render is called *during* a browser render then
|
||||
* having an invalid pointer here causes NetSurf to crash.
|
||||
*/
|
||||
glob = temp_gg;
|
||||
#else
|
||||
#warning FIXME for OS3 (in current state none of bitmap_render can work!)
|
||||
#endif
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
extern struct gui_bitmap_table *amiga_bitmap_table;
|
||||
struct bitmap;
|
||||
struct nsurl;
|
||||
struct gui_globals;
|
||||
|
||||
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
|
||||
int width, int height, struct BitMap *friendbm);
|
||||
|
|
|
@ -230,7 +230,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
|
|||
struct redraw_context ctx = {
|
||||
.interactive = true,
|
||||
.background_images = true,
|
||||
.plot = &amiplot
|
||||
.plot = &amiplot,
|
||||
.priv = &ami_cw->gg
|
||||
};
|
||||
|
||||
if(ami_gui_get_space_box((Object *)ami_cw->objects[GID_CW_DRAW], &bbox) != NSERROR_OK) {
|
||||
|
@ -240,8 +241,6 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
|
|||
|
||||
ami_cw_scroller_top(ami_cw, &pos_x, &pos_y);
|
||||
|
||||
glob = &ami_cw->gg;
|
||||
|
||||
if(x - pos_x + width > bbox->Width) width = bbox->Width - (x - pos_x);
|
||||
if(y - pos_y + height > bbox->Height) height = bbox->Height - (y - pos_y);
|
||||
|
||||
|
@ -293,8 +292,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
|
|||
}
|
||||
|
||||
ami_gui_free_space_box(bbox);
|
||||
ami_clearclipreg(glob);
|
||||
ami_gui_set_default_gg();
|
||||
ami_clearclipreg(&ami_cw->gg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
static plot_font_style_t *prev_fstyle = NULL;
|
||||
static struct TextFont *prev_font = NULL;
|
||||
static struct RastPort temp_rp;
|
||||
|
||||
static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_style_t *fstyle)
|
||||
{
|
||||
|
@ -133,17 +134,16 @@ static nserror amiga_bm_nsfont_width(const plot_font_style_t *fstyle,
|
|||
{
|
||||
char *localtext = NULL;
|
||||
|
||||
if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
|
||||
*width = length;
|
||||
|
||||
struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle);
|
||||
struct TextFont *bmfont = ami_font_bm_open(&temp_rp, fstyle);
|
||||
if(bmfont == NULL) return NSERROR_INVALID;
|
||||
|
||||
if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
|
||||
return NSERROR_INVALID;
|
||||
}
|
||||
|
||||
*width = TextLength(glob->rp, localtext, (UWORD)strlen(localtext));
|
||||
*width = TextLength(&temp_rp, localtext, (UWORD)strlen(localtext));
|
||||
free(localtext);
|
||||
|
||||
return NSERROR_OK;
|
||||
|
@ -170,16 +170,14 @@ static nserror amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyl
|
|||
char *localtext = NULL;
|
||||
UWORD co = 0;
|
||||
|
||||
if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
|
||||
|
||||
bmfont = ami_font_bm_open(glob->rp, fstyle);
|
||||
bmfont = ami_font_bm_open(&temp_rp, fstyle);
|
||||
if(bmfont == NULL) return NSERROR_INVALID;
|
||||
|
||||
if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
|
||||
return NSERROR_INVALID;
|
||||
}
|
||||
|
||||
co = TextFit(glob->rp, localtext, (UWORD)strlen(localtext),
|
||||
co = TextFit(&temp_rp, localtext, (UWORD)strlen(localtext),
|
||||
&extent, NULL, 1, x, 32767);
|
||||
*char_offset = ami_font_bm_convert_local_to_utf8_offset(string, length, co);
|
||||
*actual_x = extent.te_Extent.MaxX;
|
||||
|
@ -222,16 +220,14 @@ static nserror amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
|
|||
char *charp;
|
||||
char *localtext;
|
||||
|
||||
if((glob == NULL) || (glob->rp == NULL)) return NSERROR_INVALID;
|
||||
|
||||
struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle);
|
||||
struct TextFont *bmfont = ami_font_bm_open(&temp_rp, fstyle);
|
||||
if(bmfont == NULL) return NSERROR_INVALID;
|
||||
|
||||
if(utf8_to_local_encoding(string, length, &localtext) != NSERROR_OK) {
|
||||
return NSERROR_INVALID;
|
||||
}
|
||||
|
||||
offset = TextFit(glob->rp, localtext, (UWORD)strlen(localtext),
|
||||
offset = TextFit(&temp_rp, localtext, (UWORD)strlen(localtext),
|
||||
&extent, NULL, 1, (UWORD)x, 32767);
|
||||
|
||||
co = offset;
|
||||
|
@ -253,7 +249,7 @@ static nserror amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
|
|||
}
|
||||
|
||||
if((co > 0) && (co < strlen(localtext))) {
|
||||
*actual_x = TextLength(glob->rp, localtext, co);
|
||||
*actual_x = TextLength(&temp_rp, localtext, co);
|
||||
*char_offset = ami_font_bm_convert_local_to_utf8_offset(string, length, co);
|
||||
} else {
|
||||
*actual_x = x;
|
||||
|
@ -298,6 +294,9 @@ void ami_font_diskfont_init(void)
|
|||
|
||||
/* Alloc space to hold currently open font - doesn't matter if this fails */
|
||||
prev_fstyle = calloc(1, sizeof(plot_font_style_t));
|
||||
|
||||
/* Init temp RastPort */
|
||||
InitRastPort(&temp_rp);
|
||||
}
|
||||
|
||||
void ami_font_diskfont_fini(void)
|
||||
|
|
|
@ -993,11 +993,6 @@ static STRPTR ami_gui_read_all_tooltypes(int argc, char **argv)
|
|||
return current_user;
|
||||
}
|
||||
|
||||
void ami_gui_set_default_gg(void)
|
||||
{
|
||||
glob = &browserglob;
|
||||
}
|
||||
|
||||
static void gui_init2(int argc, char** argv)
|
||||
{
|
||||
struct Screen *screen;
|
||||
|
@ -1008,9 +1003,6 @@ static void gui_init2(int argc, char** argv)
|
|||
|
||||
notalreadyrunning = ami_arexx_init(&rxsig);
|
||||
|
||||
/* Treeview init code ends up calling a font function which needs this */
|
||||
ami_gui_set_default_gg();
|
||||
|
||||
/* ...and this ensures the treeview at least gets the WB colour palette to work with */
|
||||
if(scrn == NULL) {
|
||||
if((screen = LockPubScreen("Workbench"))) {
|
||||
|
@ -3529,6 +3521,7 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
|
|||
int left, int top, int width, int height,
|
||||
int sx, int sy, struct IBox *bbox, struct redraw_context *ctx)
|
||||
{
|
||||
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
|
||||
int x, y;
|
||||
struct rect clip;
|
||||
int tile_size_x = glob->width;
|
||||
|
@ -3636,7 +3629,8 @@ static void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw
|
|||
struct redraw_context ctx = {
|
||||
.interactive = true,
|
||||
.background_images = true,
|
||||
.plot = &amiplot
|
||||
.plot = &amiplot,
|
||||
.priv = &browserglob
|
||||
};
|
||||
|
||||
if(!g) return;
|
||||
|
@ -4459,8 +4453,6 @@ gui_window_create(struct browser_window *bw,
|
|||
|
||||
ami_gui_win_list_add(g->shared, AMINS_WINDOW, &ami_gui_table);
|
||||
|
||||
ami_gui_set_default_gg();
|
||||
|
||||
if(locked_screen) {
|
||||
UnlockPubScreen(NULL,scrn);
|
||||
locked_screen = FALSE;
|
||||
|
@ -4907,11 +4899,10 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
|
|||
struct redraw_context ctx = {
|
||||
.interactive = true,
|
||||
.background_images = true,
|
||||
.plot = &amiplot
|
||||
.plot = &amiplot,
|
||||
.priv = &browserglob
|
||||
};
|
||||
|
||||
ami_gui_set_default_gg();
|
||||
|
||||
if(nsoption_bool(direct_render) == false)
|
||||
{
|
||||
ami_do_redraw_tiled(gwin, true, hcurrent, vcurrent, width, height, hcurrent, vcurrent, bbox, &ctx);
|
||||
|
|
|
@ -258,11 +258,6 @@ uint32 ami_gui_get_app_id(void);
|
|||
*/
|
||||
STRPTR ami_gui_get_screen_title(void);
|
||||
|
||||
/**
|
||||
* Set gui_globals back to the default for the browser context
|
||||
*/
|
||||
void ami_gui_set_default_gg(void);
|
||||
|
||||
/**
|
||||
* Switch to the most-recently-opened tab
|
||||
*/
|
||||
|
|
|
@ -108,6 +108,7 @@ enum {
|
|||
struct gui_window;
|
||||
struct gui_window_2;
|
||||
struct hlcache_handle;
|
||||
struct Window;
|
||||
|
||||
ULONG ami_gui_menu_number(int item);
|
||||
struct Menu *ami_gui_menu_create(struct gui_window_2 *gwin);
|
||||
|
|
|
@ -87,7 +87,8 @@ static void ami_history_redraw(struct history_window *hw)
|
|||
struct redraw_context ctx = {
|
||||
.interactive = true,
|
||||
.background_images = true,
|
||||
.plot = &amiplot
|
||||
.plot = &amiplot,
|
||||
.priv = hw->gg
|
||||
};
|
||||
|
||||
GetAttr(SCROLLER_Top,hw->objects[OID_HSCROLL],(ULONG *)&xs);
|
||||
|
@ -97,16 +98,14 @@ static void ami_history_redraw(struct history_window *hw)
|
|||
return;
|
||||
}
|
||||
|
||||
glob = hw->gg;
|
||||
|
||||
/* core should clear this area for us
|
||||
SetRPAttrs(glob->rp, RPTAG_APenColor, 0xffffffff, TAG_DONE);
|
||||
RectFill(glob->rp, 0, 0, bbox->Width - 1, bbox->Height - 1);
|
||||
*/
|
||||
|
||||
browser_window_history_redraw_rectangle(hw->gw->bw, xs, ys,
|
||||
bbox->Width + xs, bbox->Height + ys, 0, 0, &ctx);
|
||||
|
||||
ami_gui_set_default_gg();
|
||||
|
||||
ami_clearclipreg(hw->gg);
|
||||
ami_history_update_extent(hw);
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ struct bfbitmap {
|
|||
int offsetx;
|
||||
int offsety;
|
||||
APTR mask;
|
||||
bool palette_mapped;
|
||||
};
|
||||
|
||||
struct ami_plot_pen {
|
||||
|
@ -81,10 +82,9 @@ struct bez_point {
|
|||
float y;
|
||||
};
|
||||
|
||||
struct gui_globals *glob;
|
||||
|
||||
static int init_layers_count = 0;
|
||||
static APTR pool_pens = NULL;
|
||||
static bool palette_mapped = true; /* palette-mapped state for the screen */
|
||||
|
||||
#ifndef M_PI /* For some reason we don't always get this from math.h */
|
||||
#define M_PI 3.14159265358979323846
|
||||
|
@ -117,8 +117,10 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
|
|||
#ifdef __amigaos4__
|
||||
if(depth < 16) {
|
||||
gg->palette_mapped = true;
|
||||
if(force32bit == false) palette_mapped = true;
|
||||
} else {
|
||||
gg->palette_mapped = false;
|
||||
if(force32bit == false) palette_mapped = false;
|
||||
}
|
||||
#else
|
||||
/* Friend BitMaps are weird.
|
||||
|
@ -142,6 +144,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
|
|||
*/
|
||||
#warning OS3 locked to palette-mapped modes
|
||||
gg->palette_mapped = true;
|
||||
palette_mapped = true;
|
||||
if(depth > 8) depth = 8;
|
||||
#endif
|
||||
|
||||
|
@ -207,6 +210,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
|
|||
gg->open = 0x00000000;
|
||||
gg->apen_num = -1;
|
||||
gg->open_num = -1;
|
||||
gg->shared_pens = NULL;
|
||||
|
||||
init_layers_count++;
|
||||
LOG("Layer initialised (total: %d)", init_layers_count);
|
||||
|
@ -289,14 +293,9 @@ void ami_plot_release_pens(struct MinList *shared_pens)
|
|||
Remove((struct Node *)node);
|
||||
ami_memory_itempool_free(pool_pens, node, sizeof(struct ami_plot_pen));
|
||||
} while((node = nnode));
|
||||
|
||||
glob->apen = 0x00000000;
|
||||
glob->open = 0x00000000;
|
||||
glob->apen_num = -1;
|
||||
glob->open_num = -1;
|
||||
}
|
||||
|
||||
static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
|
||||
static void ami_plot_setapen(struct gui_globals *glob, struct RastPort *rp, ULONG colr)
|
||||
{
|
||||
if(glob->apen == colr) return;
|
||||
|
||||
|
@ -315,7 +314,7 @@ static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
|
|||
glob->apen = colr;
|
||||
}
|
||||
|
||||
static void ami_plot_setopen(struct RastPort *rp, ULONG colr)
|
||||
static void ami_plot_setopen(struct gui_globals *glob, struct RastPort *rp, ULONG colr)
|
||||
{
|
||||
if(glob->open == colr) return;
|
||||
|
||||
|
@ -343,7 +342,7 @@ void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox)
|
|||
}
|
||||
|
||||
|
||||
static void ami_arc_gfxlib(int x, int y, int radius, int angle1, int angle2)
|
||||
static void ami_arc_gfxlib(struct RastPort *rp, int x, int y, int radius, int angle1, int angle2)
|
||||
{
|
||||
double angle1_r = (double)(angle1) * (M_PI / 180.0);
|
||||
double angle2_r = (double)(angle2) * (M_PI / 180.0);
|
||||
|
@ -359,19 +358,19 @@ static void ami_arc_gfxlib(int x, int y, int radius, int angle1, int angle2)
|
|||
|
||||
x1 = (int)(cos(b) * (double)radius);
|
||||
y1 = (int)(sin(b) * (double)radius);
|
||||
Move(glob->rp, x0 + x1, y0 - y1);
|
||||
Move(rp, x0 + x1, y0 - y1);
|
||||
|
||||
for(angle = (b + step); angle <= c; angle += step) {
|
||||
x1 = (int)(cos(angle) * (double)radius);
|
||||
y1 = (int)(sin(angle) * (double)radius);
|
||||
Draw(glob->rp, x0 + x1, y0 - y1);
|
||||
Draw(rp, x0 + x1, y0 - y1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
static nserror
|
||||
ami_bitmap(int x, int y, int width, int height, struct bitmap *bitmap)
|
||||
ami_bitmap(struct gui_globals *glob, int x, int y, int width, int height, struct bitmap *bitmap)
|
||||
{
|
||||
PLOT_LOG("[ami_plotter] Entered ami_bitmap()");
|
||||
|
||||
|
@ -471,7 +470,7 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage
|
|||
for (yf = -bfbm->offsety; yf < msg->Bounds.MaxY; yf += bfbm->height) {
|
||||
#ifdef __amigaos4__
|
||||
if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) &&
|
||||
(glob->palette_mapped == false), 1)) {
|
||||
(bfbm->palette_mapped == false), 1)) {
|
||||
CompositeTags(COMPOSITE_Src_Over_Dest, bfbm->bm, rp->BitMap,
|
||||
COMPTAG_Flags, COMPFLAG_IgnoreDestAlpha,
|
||||
COMPTAG_DestX, msg->Bounds.MinX,
|
||||
|
@ -489,7 +488,7 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage
|
|||
{
|
||||
ULONG tag, tag_data, minterm = 0xc0;
|
||||
|
||||
if(glob->palette_mapped == false) {
|
||||
if(bfbm->palette_mapped == false) {
|
||||
tag = BLITA_UseSrcAlpha;
|
||||
tag_data = TRUE;
|
||||
minterm = 0xc0;
|
||||
|
@ -534,7 +533,8 @@ static void ami_bezier(struct bez_point *restrict a, struct bez_point *restrict
|
|||
|
||||
bool ami_plot_screen_is_palettemapped(void)
|
||||
{
|
||||
return glob->palette_mapped;
|
||||
/* This may not be entirely correct - previously we returned the state of the current BitMap */
|
||||
return palette_mapped;
|
||||
}
|
||||
|
||||
|
||||
|
@ -549,6 +549,7 @@ bool ami_plot_screen_is_palettemapped(void)
|
|||
static nserror
|
||||
ami_clip(const struct redraw_context *ctx, const struct rect *clip)
|
||||
{
|
||||
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
|
||||
struct Region *reg = NULL;
|
||||
|
||||
PLOT_LOG("[ami_plotter] Entered ami_clip()");
|
||||
|
@ -597,12 +598,14 @@ ami_arc(const struct redraw_context *ctx,
|
|||
{
|
||||
PLOT_LOG("[ami_plotter] Entered ami_arc()");
|
||||
|
||||
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
|
||||
|
||||
if (angle2 < angle1) {
|
||||
angle2 += 360;
|
||||
}
|
||||
|
||||
ami_plot_setapen(glob->rp, style->fill_colour);
|
||||
ami_arc_gfxlib(x, y, radius, angle1, angle2);
|
||||
ami_plot_setapen(glob, glob->rp, style->fill_colour);
|
||||
ami_arc_gfxlib(glob->rp, x, y, radius, angle1, angle2);
|
||||
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
@ -627,14 +630,16 @@ ami_disc(const struct redraw_context *ctx,
|
|||
{
|
||||
PLOT_LOG("[ami_plotter] Entered ami_disc()");
|
||||
|
||||
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
|
||||
|
||||
if (style->fill_type != PLOT_OP_TYPE_NONE) {
|
||||
ami_plot_setapen(glob->rp, style->fill_colour);
|
||||
ami_plot_setapen(glob, glob->rp, style->fill_colour);
|
||||
AreaCircle(glob->rp,x,y,radius);
|
||||
AreaEnd(glob->rp);
|
||||
}
|
||||
|
||||
if (style->stroke_type != PLOT_OP_TYPE_NONE) {
|
||||
ami_plot_setapen(glob->rp, style->stroke_colour);
|
||||
ami_plot_setapen(glob, glob->rp, style->stroke_colour);
|
||||
DrawEllipse(glob->rp,x,y,radius,radius);
|
||||
}
|
||||
|
||||
|
@ -660,6 +665,8 @@ ami_line(const struct redraw_context *ctx,
|
|||
{
|
||||
PLOT_LOG("[ami_plotter] Entered ami_line()");
|
||||
|
||||
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
|
||||
|
||||
glob->rp->PenWidth = style->stroke_width;
|
||||
glob->rp->PenHeight = style->stroke_width;
|
||||
|
||||
|
@ -678,7 +685,7 @@ ami_line(const struct redraw_context *ctx,
|
|||
break;
|
||||
}
|
||||
|
||||
ami_plot_setapen(glob->rp, style->stroke_colour);
|
||||
ami_plot_setapen(glob, glob->rp, style->stroke_colour);
|
||||
Move(glob->rp, line->x0, line->y0);
|
||||
Draw(glob->rp, line->x1, line->y1);
|
||||
|
||||
|
@ -710,8 +717,10 @@ ami_rectangle(const struct redraw_context *ctx,
|
|||
{
|
||||
PLOT_LOG("[ami_plotter] Entered ami_rectangle()");
|
||||
|
||||
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
|
||||
|
||||
if (style->fill_type != PLOT_OP_TYPE_NONE) {
|
||||
ami_plot_setapen(glob->rp, style->fill_colour);
|
||||
ami_plot_setapen(glob, glob->rp, style->fill_colour);
|
||||
RectFill(glob->rp, rect->x0, rect->y0, rect->x1- 1 , rect->y1 - 1);
|
||||
}
|
||||
|
||||
|
@ -734,7 +743,7 @@ ami_rectangle(const struct redraw_context *ctx,
|
|||
break;
|
||||
}
|
||||
|
||||
ami_plot_setapen(glob->rp, style->stroke_colour);
|
||||
ami_plot_setapen(glob, glob->rp, style->stroke_colour);
|
||||
Move(glob->rp, rect->x0, rect->y0);
|
||||
Draw(glob->rp, rect->x1, rect->y0);
|
||||
Draw(glob->rp, rect->x1, rect->y1);
|
||||
|
@ -772,7 +781,9 @@ ami_polygon(const struct redraw_context *ctx,
|
|||
{
|
||||
PLOT_LOG("[ami_plotter] Entered ami_polygon()");
|
||||
|
||||
ami_plot_setapen(glob->rp, style->fill_colour);
|
||||
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
|
||||
|
||||
ami_plot_setapen(glob, glob->rp, style->fill_colour);
|
||||
|
||||
if (AreaMove(glob->rp,p[0],p[1]) == -1) {
|
||||
LOG("AreaMove: vector list full");
|
||||
|
@ -816,9 +827,11 @@ ami_path(const struct redraw_context *ctx,
|
|||
{
|
||||
unsigned int i;
|
||||
struct bez_point start_p = {0, 0}, cur_p = {0, 0}, p_a, p_b, p_c, p_r;
|
||||
|
||||
|
||||
PLOT_LOG("[ami_plotter] Entered ami_path()");
|
||||
|
||||
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
|
||||
|
||||
if (n == 0) {
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
@ -829,13 +842,13 @@ ami_path(const struct redraw_context *ctx,
|
|||
}
|
||||
|
||||
if (pstyle->fill_colour != NS_TRANSPARENT) {
|
||||
ami_plot_setapen(glob->rp, pstyle->fill_colour);
|
||||
ami_plot_setapen(glob, glob->rp, pstyle->fill_colour);
|
||||
if (pstyle->stroke_colour != NS_TRANSPARENT) {
|
||||
ami_plot_setopen(glob->rp, pstyle->stroke_colour);
|
||||
ami_plot_setopen(glob, glob->rp, pstyle->stroke_colour);
|
||||
}
|
||||
} else {
|
||||
if (pstyle->stroke_colour != NS_TRANSPARENT) {
|
||||
ami_plot_setapen(glob->rp, pstyle->stroke_colour);
|
||||
ami_plot_setapen(glob, glob->rp, pstyle->stroke_colour);
|
||||
} else {
|
||||
return NSERROR_OK; /* wholly transparent */
|
||||
}
|
||||
|
@ -958,12 +971,14 @@ ami_bitmap_tile(const struct redraw_context *ctx,
|
|||
|
||||
PLOT_LOG("[ami_plotter] Entered ami_bitmap_tile()");
|
||||
|
||||
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
|
||||
|
||||
if ((width == 0) || (height == 0)) {
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
if (!(repeat_x || repeat_y)) {
|
||||
return ami_bitmap(x, y, width, height, bitmap);
|
||||
return ami_bitmap(glob, x, y, width, height, bitmap);
|
||||
}
|
||||
|
||||
/* If it is a one pixel transparent image, we are wasting our time */
|
||||
|
@ -973,7 +988,7 @@ ami_bitmap_tile(const struct redraw_context *ctx,
|
|||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
tbm = ami_bitmap_get_native(bitmap,width,height,glob->rp->BitMap);
|
||||
tbm = ami_bitmap_get_native(bitmap, width, height, glob->rp->BitMap);
|
||||
if (!tbm) {
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
@ -1025,6 +1040,7 @@ ami_bitmap_tile(const struct redraw_context *ctx,
|
|||
bfbm.offsetx = ox;
|
||||
bfbm.offsety = oy;
|
||||
bfbm.mask = ami_bitmap_get_mask(bitmap, width, height, tbm);
|
||||
bfbm.palette_mapped = glob->palette_mapped;
|
||||
bfh = calloc(1, sizeof(struct Hook));
|
||||
bfh->h_Entry = (HOOKFUNC)ami_bitmap_tile_hook;
|
||||
bfh->h_SubEntry = 0;
|
||||
|
@ -1072,10 +1088,12 @@ ami_text(const struct redraw_context *ctx,
|
|||
{
|
||||
PLOT_LOG("[ami_plotter] Entered ami_text()");
|
||||
|
||||
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
|
||||
|
||||
if (__builtin_expect(ami_nsfont == NULL, 0)) {
|
||||
return NSERROR_OK;
|
||||
}
|
||||
ami_plot_setapen(glob->rp, fstyle->foreground);
|
||||
ami_plot_setapen(glob, glob->rp, fstyle->foreground);
|
||||
ami_nsfont->text(glob->rp, text, length, fstyle, x, y, nsoption_bool(font_antialiasing));
|
||||
|
||||
return NSERROR_OK;
|
||||
|
|
|
@ -45,8 +45,6 @@ struct gui_globals
|
|||
|
||||
extern const struct plotter_table amiplot;
|
||||
|
||||
extern struct gui_globals *glob;
|
||||
|
||||
void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool force32bit);
|
||||
void ami_free_layers(struct gui_globals *gg);
|
||||
void ami_clearclipreg(struct gui_globals *gg);
|
||||
|
|
|
@ -436,6 +436,7 @@ void ami_print(struct hlcache_handle *c, int copies)
|
|||
ami_print_info.ps->page_width = ami_print_info.PED->ped_MaxXDots;
|
||||
ami_print_info.ps->page_height = ami_print_info.PED->ped_MaxYDots;
|
||||
ami_print_info.ps->scale = scale;
|
||||
ami_print_info.ps->priv = ami_print_info.gg;
|
||||
|
||||
if(!print_set_up(c, &amiprinter, ami_print_info.ps, &height))
|
||||
{
|
||||
|
@ -459,10 +460,8 @@ bool ami_print_cont(void)
|
|||
|
||||
if(ami_print_info.page <= ami_print_info.pages)
|
||||
{
|
||||
glob = ami_print_info.gg;
|
||||
print_draw_next_page(&amiprinter, ami_print_info.ps);
|
||||
ami_print_dump();
|
||||
ami_gui_set_default_gg();
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
|
@ -525,7 +524,6 @@ void ami_print_end(void)
|
|||
ami_free_layers(ami_print_info.gg);
|
||||
free(ami_print_info.gg);
|
||||
DisposeObject(ami_print_info.objects[OID_MAIN]);
|
||||
ami_gui_set_default_gg();
|
||||
|
||||
ami_print_close_device();
|
||||
ami_print_free();
|
||||
|
|
Loading…
Reference in New Issue