summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xamiga/gui.c76
-rwxr-xr-xamiga/gui.h4
-rwxr-xr-xamiga/history_local.c5
-rwxr-xr-xamiga/plotters.c270
-rwxr-xr-xamiga/thumbnail.c11
5 files changed, 180 insertions, 186 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index 0c7f87a2e..55bd2b48e 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -586,21 +586,21 @@ void gui_init2(int argc, char** argv)
* Height is set to screen width to give enough space for thumbnails *
* Also applies to the further gfx/layers functions and memory below */
- glob.layerinfo = NewLayerInfo();
- glob.areabuf = AllocVec(100,MEMF_PRIVATE | MEMF_CLEAR);
- glob.tmprasbuf = AllocVec(scrn->Width*scrn->Width,MEMF_PRIVATE | MEMF_CLEAR);
+ browserglob.layerinfo = NewLayerInfo();
+ browserglob.areabuf = AllocVec(100,MEMF_PRIVATE | MEMF_CLEAR);
+ browserglob.tmprasbuf = AllocVec(scrn->Width*scrn->Width,MEMF_PRIVATE | MEMF_CLEAR);
if(!option_direct_render)
{
- glob.bm = p96AllocBitMap(scrn->Width,scrn->Width,32,
+ browserglob.bm = p96AllocBitMap(scrn->Width,scrn->Width,32,
BMF_INTERLEAVED, NULL, RGBFB_A8R8G8B8);
- if(!glob.bm) warn_user("NoMemory","");
+ if(!browserglob.bm) warn_user("NoMemory","");
- InitRastPort(&glob.rp);
- glob.rp.BitMap = glob.bm;
+ InitRastPort(&browserglob.rp);
+ browserglob.rp.BitMap = browserglob.bm;
- ami_init_layers(&glob.rp);
+ ami_init_layers(&browserglob.rp);
}
/* init shared bitmaps */
}
@@ -688,34 +688,34 @@ void ami_init_layers(struct RastPort *rp)
{
SetDrMd(rp,BGBACKFILL);
- rp->Layer = CreateUpfrontLayer(glob.layerinfo,rp->BitMap,0,0,
+ rp->Layer = CreateUpfrontLayer(browserglob.layerinfo,rp->BitMap,0,0,
scrn->Width-1,scrn->Width-1,LAYERSIMPLE,NULL);
InstallLayerHook(rp->Layer,LAYERS_NOBACKFILL);
rp->AreaInfo = AllocVec(sizeof(struct AreaInfo),MEMF_PRIVATE | MEMF_CLEAR);
- if((!glob.areabuf) || (!rp->AreaInfo)) warn_user("NoMemory","");
+ if((!browserglob.areabuf) || (!rp->AreaInfo)) warn_user("NoMemory","");
- InitArea(rp->AreaInfo,glob.areabuf,100/5);
+ InitArea(rp->AreaInfo,browserglob.areabuf,100/5);
rp->TmpRas = AllocVec(sizeof(struct TmpRas),MEMF_PRIVATE | MEMF_CLEAR);
- if((!glob.tmprasbuf) || (!rp->TmpRas)) warn_user("NoMemory","");
+ if((!browserglob.tmprasbuf) || (!rp->TmpRas)) warn_user("NoMemory","");
- InitTmpRas(rp->TmpRas,glob.tmprasbuf,scrn->Width*scrn->Width);
- currp = rp;
+ InitTmpRas(rp->TmpRas,browserglob.tmprasbuf,scrn->Width*scrn->Width);
+ glob = &browserglob;
#ifdef NS_AMIGA_CAIRO
- glob.surface = cairo_amigaos_surface_create(rp->BitMap);
- glob.cr = cairo_create(glob.surface);
+ browserglob.surface = cairo_amigaos_surface_create(rp->BitMap);
+ browserglob.cr = cairo_create(browserglob.surface);
#endif
}
void ami_free_layers(struct RastPort *rp)
{
#ifdef NS_AMIGA_CAIRO
- cairo_destroy(glob.cr);
- cairo_surface_destroy(glob.surface);
+ cairo_destroy(browserglob.cr);
+ cairo_surface_destroy(browserglob.surface);
#endif
DeleteLayer(0,rp->Layer);
FreeVec(rp->TmpRas);
@@ -1581,11 +1581,11 @@ void gui_quit(void)
ami_arexx_cleanup();
- if(!option_direct_render) ami_free_layers(&glob.rp);
- DisposeLayerInfo(glob.layerinfo);
- p96FreeBitMap(glob.bm);
- FreeVec(glob.tmprasbuf);
- FreeVec(glob.areabuf);
+ if(!option_direct_render) ami_free_layers(&browserglob.rp);
+ DisposeLayerInfo(browserglob.layerinfo);
+ p96FreeBitMap(browserglob.bm);
+ FreeVec(browserglob.tmprasbuf);
+ FreeVec(browserglob.areabuf);
ami_close_fonts();
@@ -2121,12 +2121,6 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
if(option_direct_render) ami_init_layers(gwin->shared->win->RPort);
- //currp = &glob.rp; // WINDOW.CLASS: &gwin->rp; //gwin->win->RPort;
-
-// GetRPAttrs(&gwin->rp,RPTAG_Font,&origrpfont,TAG_DONE);
-
-// ami_tte_setdefaults(&gwin->rp,gwin->win);
-
GetAttr(WINDOW_HorizObject,gwin->shared->objects[OID_MAIN],(ULONG *)&gwin->shared->objects[OID_HSCROLL]);
GetAttr(WINDOW_VertObject,gwin->shared->objects[OID_MAIN],(ULONG *)&gwin->shared->objects[OID_VSCROLL]);
@@ -2279,10 +2273,10 @@ void ami_clearclipreg(struct RastPort *rp)
reg = InstallClipRegion(rp->Layer,NULL);
if(reg) DisposeRegion(reg);
- glob.rect.MinX = 0;
- glob.rect.MinY = 0;
- glob.rect.MaxX = scrn->Width-1;
- glob.rect.MaxY = scrn->Height-1;
+ browserglob.rect.MinX = 0;
+ browserglob.rect.MinY = 0;
+ browserglob.rect.MaxX = scrn->Width-1;
+ browserglob.rect.MaxY = scrn->Height-1;
}
/**
@@ -2352,10 +2346,10 @@ void ami_do_redraw_limits(struct gui_window *g, struct content *c,int x0, int y0
current_redraw_browser = NULL;
- ami_clearclipreg(currp);
+ ami_clearclipreg(&browserglob.rp);
if(!option_direct_render)
- BltBitMapRastPort(glob.bm,x0-sx,y0-sy,g->shared->win->RPort,
+ BltBitMapRastPort(browserglob.bm,x0-sx,y0-sy,g->shared->win->RPort,
xoffset+x0-sx,yoffset+y0-sy,x1-x0,y1-y0,0x0C0);
}
@@ -2412,15 +2406,13 @@ void ami_do_redraw(struct gui_window_2 *g)
GetAttr(SCROLLER_Top,g->objects[OID_HSCROLL],(ULONG *)&hcurrent);
GetAttr(SCROLLER_Top,g->objects[OID_VSCROLL],(ULONG *)&vcurrent);
-// DebugPrintF("DOING REDRAW\n");
-
c = g->bw->current_content;
if(!c) return;
if (c->locked) return;
current_redraw_browser = g->bw;
-// currp = &glob.rp;
+// currp = &browserglob.rp;
width=bbox->Width;
height=bbox->Height;
@@ -2497,14 +2489,14 @@ void ami_do_redraw(struct gui_window_2 *g)
g->bw->scale,0xFFFFFF);
}
- ami_clearclipreg(currp);
+ ami_clearclipreg(&browserglob.rp);
if(!option_direct_render)
{
Forbid();
GetAttr(SPACE_AreaBox,g->gadgets[GID_BROWSER],(ULONG *)&bbox);
- BltBitMapRastPort(glob.bm,0,0,g->win->RPort,bbox->Left,bbox->Top,
+ BltBitMapRastPort(browserglob.bm,0,0,g->win->RPort,bbox->Left,bbox->Top,
bbox->Width,bbox->Height,0x0C0);
Permit();
}
@@ -2951,7 +2943,7 @@ void gui_window_remove_caret(struct gui_window *g)
GetAttr(SCROLLER_Top,g->shared->objects[OID_HSCROLL],(ULONG *)&xs);
GetAttr(SCROLLER_Top,g->shared->objects[OID_VSCROLL],(ULONG *)&ys);
- BltBitMapRastPort(glob.bm,g->c_x-xs,g->c_y-ys,g->shared->win->RPort,bbox->Left+g->c_x-xs,bbox->Top+g->c_y-ys,2+1,g->c_h+1,0x0C0);
+ BltBitMapRastPort(browserglob.bm,g->c_x-xs,g->c_y-ys,g->shared->win->RPort,bbox->Left+g->c_x-xs,bbox->Top+g->c_y-ys,2+1,g->c_h+1,0x0C0);
g->c_h = 0;
}
@@ -2964,7 +2956,7 @@ void gui_window_new_content(struct gui_window *g)
c = g->shared->bw->current_content;
else return;
- ami_clearclipreg(currp);
+ ami_clearclipreg(&browserglob.rp);
g->shared->new_content = true;
g->scrollx = 0;
g->scrolly = 0;
diff --git a/amiga/gui.h b/amiga/gui.h
index f6a791fa5..032ceb728 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -138,7 +138,6 @@ void ami_clearclipreg(struct RastPort *rp);
void ami_do_redraw(struct gui_window_2 *g);
STRPTR ami_locale_langs(void);
-struct RastPort *currp;
struct TextFont *origrpfont;
struct MinList *window_list;
struct Screen *scrn;
@@ -148,5 +147,6 @@ struct FileRequester *savereq;
struct MsgPort *sport;
bool win_destroyed;
struct browser_window *curbw;
-struct gui_globals glob;
+struct gui_globals *glob;
+struct gui_globals browserglob;
#endif
diff --git a/amiga/history_local.c b/amiga/history_local.c
index f15df6af6..b9f2c6f0a 100755
--- a/amiga/history_local.c
+++ b/amiga/history_local.c
@@ -167,10 +167,11 @@ void ami_history_redraw(struct history_window *hw)
// currp = &glob.rp;
- ami_clearclipreg(currp);
+ ami_clearclipreg(&browserglob.rp);
ami_history_update_extent(hw);
- BltBitMapRastPort(glob.bm,0,0,hw->win->RPort,bbox->Left,bbox->Top,bbox->Width,bbox->Height,0x0C0);
+ BltBitMapRastPort(browserglob.bm, 0, 0, hw->win->RPort,
+ bbox->Left, bbox->Top, bbox->Width, bbox->Height, 0x0C0);
}
/**
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 98b95b527..40832ac90 100755
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -83,7 +83,7 @@ void ami_cairo_set_colour(cairo_t *cr,colour c)
g = (c & 0xff00) >> 8;
b = (c & 0xff0000) >> 16;
- cairo_set_source_rgba(glob.cr, r / 255.0,
+ cairo_set_source_rgba(glob->cr, r / 255.0,
g / 255.0, b / 255.0, 1.0);
}
@@ -91,33 +91,33 @@ void ami_cairo_set_solid(cairo_t *cr)
{
double dashes = 0;
- cairo_set_dash(glob.cr, &dashes, 0, 0);
+ cairo_set_dash(glob->cr, &dashes, 0, 0);
}
void ami_cairo_set_dotted(cairo_t *cr)
{
double cdashes = 1;
- cairo_set_dash(glob.cr, &cdashes, 1, 0);
+ cairo_set_dash(glob->cr, &cdashes, 1, 0);
}
void ami_cairo_set_dashed(cairo_t *cr)
{
double cdashes = 3;
- cairo_set_dash(glob.cr, &cdashes, 1, 0);
+ cairo_set_dash(glob->cr, &cdashes, 1, 0);
}
#endif
bool ami_clg(colour c)
{
- p96RectFill(currp,0,0,scrn->Width-1,scrn->Width-1,
+ p96RectFill(&glob->rp,0,0,scrn->Width-1,scrn->Width-1,
p96EncodeColor(RGBFB_A8B8G8R8,c));
/*
- SetRPAttrs(currp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
+ SetRPAttrs(&glob->rp,RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
TAG_DONE);
- Move(currp,0,0);
- ClearScreen(currp);
+ Move(&glob->rp,0,0);
+ ClearScreen(&glob->rp);
*/
return true;
}
@@ -126,36 +126,36 @@ bool ami_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed)
{
#ifndef NS_AMIGA_CAIRO_ALL
- currp->PenWidth = line_width;
- currp->PenHeight = line_width;
+ glob->rp.PenWidth = line_width;
+ glob->rp.PenHeight = line_width;
- currp->LinePtrn = PATT_LINE;
- if(dotted) currp->LinePtrn = PATT_DOT;
- if(dashed) currp->LinePtrn = PATT_DASH;
+ glob->rp.LinePtrn = PATT_LINE;
+ if(dotted) glob->rp.LinePtrn = PATT_DOT;
+ if(dashed) glob->rp.LinePtrn = PATT_DASH;
- SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
+ SetRPAttrs(&glob->rp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
TAG_DONE);
- Move(currp,x0,y0);
- Draw(currp,x0+width,y0);
- Draw(currp,x0+width,y0+height);
- Draw(currp,x0,y0+height);
- Draw(currp,x0,y0);
-
- currp->PenWidth = 1;
- currp->PenHeight = 1;
- currp->LinePtrn = PATT_LINE;
+ Move(&glob->rp,x0,y0);
+ Draw(&glob->rp,x0+width,y0);
+ Draw(&glob->rp,x0+width,y0+height);
+ Draw(&glob->rp,x0,y0+height);
+ Draw(&glob->rp,x0,y0);
+
+ glob->rp.PenWidth = 1;
+ glob->rp.PenHeight = 1;
+ glob->rp.LinePtrn = PATT_LINE;
#else
- ami_cairo_set_colour(glob.cr,c);
- if (dotted) ami_cairo_set_dotted(glob.cr);
- else if (dashed) ami_cairo_set_dashed(glob.cr);
- else ami_cairo_set_solid(glob.cr);
+ ami_cairo_set_colour(glob->cr,c);
+ if (dotted) ami_cairo_set_dotted(glob->cr);
+ else if (dashed) ami_cairo_set_dashed(glob->cr);
+ else ami_cairo_set_solid(glob->cr);
if (line_width == 0)
line_width = 1;
- cairo_set_line_width(glob.cr, line_width);
- cairo_rectangle(glob.cr, x0, y0, width, height);
- cairo_stroke(glob.cr);
+ cairo_set_line_width(glob->cr, line_width);
+ cairo_rectangle(glob->cr, x0, y0, width, height);
+ cairo_stroke(glob->cr);
#endif
return true;
@@ -165,34 +165,34 @@ bool ami_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed)
{
#ifndef NS_AMIGA_CAIRO_ALL
- currp->PenWidth = width;
- currp->PenHeight = width;
+ glob->rp.PenWidth = width;
+ glob->rp.PenHeight = width;
- currp->LinePtrn = PATT_LINE;
- if(dotted) currp->LinePtrn = PATT_DOT;
- if(dashed) currp->LinePtrn = PATT_DASH;
+ glob->rp.LinePtrn = PATT_LINE;
+ if(dotted) glob->rp.LinePtrn = PATT_DOT;
+ if(dashed) glob->rp.LinePtrn = PATT_DASH;
- SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
+ SetRPAttrs(&glob->rp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
TAG_DONE);
- Move(currp,x0,y0);
- Draw(currp,x1,y1);
+ Move(&glob->rp,x0,y0);
+ Draw(&glob->rp,x1,y1);
- currp->PenWidth = 1;
- currp->PenHeight = 1;
- currp->LinePtrn = PATT_LINE;
+ glob->rp.PenWidth = 1;
+ glob->rp.PenHeight = 1;
+ glob->rp.LinePtrn = PATT_LINE;
#else
- ami_cairo_set_colour(glob.cr,c);
- if (dotted) ami_cairo_set_dotted(glob.cr);
- else if (dashed) ami_cairo_set_dashed(glob.cr);
- else ami_cairo_set_solid(glob.cr);
+ ami_cairo_set_colour(glob->cr,c);
+ if (dotted) ami_cairo_set_dotted(glob->cr);
+ else if (dashed) ami_cairo_set_dashed(glob->cr);
+ else ami_cairo_set_solid(glob->cr);
if (width == 0)
width = 1;
- cairo_set_line_width(glob.cr, width);
- cairo_move_to(glob.cr, x0 + 0.5, y0 + 0.5);
- cairo_line_to(glob.cr, x1 + 0.5, y1 + 0.5);
- cairo_stroke(glob.cr);
+ cairo_set_line_width(glob->cr, width);
+ cairo_move_to(glob->cr, x0 + 0.5, y0 + 0.5);
+ cairo_line_to(glob->cr, x1 + 0.5, y1 + 0.5);
+ cairo_stroke(glob->cr);
#endif
return true;
}
@@ -205,31 +205,31 @@ bool ami_polygon(const int *p, unsigned int n, colour fill)
//DebugPrintF("poly\n");
- SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,fill),
+ SetRPAttrs(&glob->rp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,fill),
RPTAG_OPenColor,p96EncodeColor(RGBFB_A8B8G8R8,fill),
// RPTAG_OPenColor,0xffffffff,
TAG_DONE);
- AreaMove(currp,p[0],p[1]);
+ AreaMove(&glob->rp,p[0],p[1]);
for(k=1;k<n;k++)
{
- AreaDraw(currp,p[k*2],p[(k*2)+1]);
+ AreaDraw(&glob->rp,p[k*2],p[(k*2)+1]);
}
- AreaEnd(currp);
- BNDRYOFF(currp);
+ AreaEnd(&glob->rp);
+ BNDRYOFF(&glob->rp);
#else
- ami_cairo_set_colour(glob.cr,fill);
- ami_cairo_set_solid(glob.cr);
+ ami_cairo_set_colour(glob->cr,fill);
+ ami_cairo_set_solid(glob->cr);
- cairo_set_line_width(glob.cr, 0);
- cairo_move_to(glob.cr, p[0], p[1]);
+ cairo_set_line_width(glob->cr, 0);
+ cairo_move_to(glob->cr, p[0], p[1]);
for (k = 1; k != n; k++) {
- cairo_line_to(glob.cr, p[k * 2], p[k * 2 + 1]);
+ cairo_line_to(glob->cr, p[k * 2], p[k * 2 + 1]);
}
- cairo_fill(glob.cr);
- cairo_stroke(glob.cr);
+ cairo_fill(glob->cr);
+ cairo_stroke(glob->cr);
#endif
return true;
@@ -238,16 +238,16 @@ bool ami_polygon(const int *p, unsigned int n, colour fill)
bool ami_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
{
#ifndef NS_AMIGA_CAIRO_ALL
- p96RectFill(currp,x0,y0,x1-1,y1-1,
+ p96RectFill(&glob->rp,x0,y0,x1-1,y1-1,
p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour));
#else
- ami_cairo_set_colour(glob.cr, style->fill_colour);
- ami_cairo_set_solid(glob.cr);
+ ami_cairo_set_colour(glob->cr, style->fill_colour);
+ ami_cairo_set_solid(glob->cr);
- cairo_set_line_width(glob.cr, 0);
- cairo_rectangle(glob.cr, x0, y0, x1 - x0, y1 - y0);
- cairo_fill(glob.cr);
- cairo_stroke(glob.cr);
+ cairo_set_line_width(glob->cr, 0);
+ cairo_rectangle(glob->cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_fill(glob->cr);
+ cairo_stroke(glob->cr);
#endif
return true;
}
@@ -256,10 +256,10 @@ bool ami_clip(int x0, int y0, int x1, int y1)
{
struct Region *reg = NULL;
- if(currp->Layer)
+ if(glob->rp.Layer)
{
- reg = InstallClipRegion(currp->Layer,NULL);
+ reg = InstallClipRegion(glob->rp.Layer,NULL);
if(!reg)
{
@@ -267,24 +267,24 @@ bool ami_clip(int x0, int y0, int x1, int y1)
}
else
{
- ClearRectRegion(reg,&glob.rect);
+ ClearRectRegion(reg,&glob->rect);
}
- glob.rect.MinX = x0;
- glob.rect.MinY = y0;
- glob.rect.MaxX = x1-1;
- glob.rect.MaxY = y1-1;
+ glob->rect.MinX = x0;
+ glob->rect.MinY = y0;
+ glob->rect.MaxX = x1-1;
+ glob->rect.MaxY = y1-1;
- OrRectRegion(reg,&glob.rect);
+ OrRectRegion(reg,&glob->rect);
- reg = InstallClipRegion(currp->Layer,reg);
+ reg = InstallClipRegion(glob->rp.Layer,reg);
if(reg) DisposeRegion(reg);
}
#ifdef NS_AMIGA_CAIRO_ALL
- cairo_reset_clip(glob.cr);
- cairo_rectangle(glob.cr, x0, y0, x1 - x0, y1 - y0);
- cairo_clip(glob.cr);
+ cairo_reset_clip(glob->cr);
+ cairo_rectangle(glob->cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_clip(glob->cr);
#endif
return true;
}
@@ -292,40 +292,40 @@ bool ami_clip(int x0, int y0, int x1, int y1)
bool ami_text(int x, int y, const struct css_style *style,
const char *text, size_t length, colour bg, colour c)
{
- ami_unicode_text(currp,text,length,style,x,y,c);
+ ami_unicode_text(&glob->rp,text,length,style,x,y,c);
return true;
}
bool ami_disc(int x, int y, int radius, colour c, bool filled)
{
#ifndef NS_AMIGA_CAIRO_ALL
- SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
+ SetRPAttrs(&glob->rp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
TAG_DONE);
if(filled)
{
- AreaCircle(currp,x,y,radius);
- AreaEnd(currp);
+ AreaCircle(&glob->rp,x,y,radius);
+ AreaEnd(&glob->rp);
}
else
{
- DrawEllipse(currp,x,y,radius,radius); // NB: does not support fill, need to use AreaCircle for that
+ DrawEllipse(&glob->rp,x,y,radius,radius); // NB: does not support fill, need to use AreaCircle for that
}
#else
- ami_cairo_set_colour(glob.cr,c);
- ami_cairo_set_solid(glob.cr);
+ ami_cairo_set_colour(glob->cr,c);
+ ami_cairo_set_solid(glob->cr);
if (filled)
- cairo_set_line_width(glob.cr, 0);
+ cairo_set_line_width(glob->cr, 0);
else
- cairo_set_line_width(glob.cr, 1);
+ cairo_set_line_width(glob->cr, 1);
- cairo_arc(glob.cr, x, y, radius, 0, M_PI * 2);
+ cairo_arc(glob->cr, x, y, radius, 0, M_PI * 2);
if (filled)
- cairo_fill(glob.cr);
+ cairo_fill(glob->cr);
- cairo_stroke(glob.cr);
+ cairo_stroke(glob->cr);
#endif
return true;
}
@@ -334,23 +334,23 @@ bool ami_arc(int x, int y, int radius, int angle1, int angle2,
colour c)
{
#ifdef NS_AMIGA_CAIRO
- ami_cairo_set_colour(glob.cr,c);
- ami_cairo_set_solid(glob.cr);
+ ami_cairo_set_colour(glob->cr,c);
+ ami_cairo_set_solid(glob->cr);
- cairo_set_line_width(glob.cr, 1);
- cairo_arc(glob.cr, x, y, radius,
+ cairo_set_line_width(glob->cr, 1);
+ cairo_arc(glob->cr, x, y, radius,
(angle1 + 90) * (M_PI / 180),
(angle2 + 90) * (M_PI / 180));
- cairo_stroke(glob.cr);
+ cairo_stroke(glob->cr);
#else
/* http://www.crbond.com/primitives.htm
CommonFuncsPPC.lha */
//DebugPrintF("arc\n");
- SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
+ SetRPAttrs(&glob->rp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
TAG_DONE);
-// DrawArc(currp,x,y,(float)angle1,(float)angle2,radius);
+// DrawArc(&glob->rp,x,y,(float)angle1,(float)angle2,radius);
#endif
return true;
@@ -362,13 +362,13 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
if(!width || !height) return true;
- if(((x + width) < glob.rect.MinX) ||
- ((y + height) < glob.rect.MinY) ||
- (x > glob.rect.MaxX) ||
- (y > glob.rect.MaxY))
+ if(((x + width) < glob->rect.MinX) ||
+ ((y + height) < glob->rect.MinY) ||
+ (x > glob->rect.MaxX) ||
+ (y > glob->rect.MaxY))
return true;
- tbm = ami_getcachenativebm(bitmap,width,height,currp->BitMap);
+ tbm = ami_getcachenativebm(bitmap,width,height,glob->rp.BitMap);
if(!tbm) return true;
@@ -377,12 +377,12 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
uint32 comptype = COMPOSITE_Src;
if(!bitmap->opaque) comptype = COMPOSITE_Src_Over_Dest;
- CompositeTags(comptype,tbm,currp->BitMap,
+ CompositeTags(comptype,tbm,glob->rp.BitMap,
COMPTAG_Flags,COMPFLAG_IgnoreDestAlpha,
- COMPTAG_DestX,glob.rect.MinX,
- COMPTAG_DestY,glob.rect.MinY,
- COMPTAG_DestWidth,glob.rect.MaxX - glob.rect.MinX + 1,
- COMPTAG_DestHeight,glob.rect.MaxY - glob.rect.MinY + 1,
+ COMPTAG_DestX,glob->rect.MinX,
+ COMPTAG_DestY,glob->rect.MinY,
+ COMPTAG_DestWidth,glob->rect.MaxX - glob->rect.MinX + 1,
+ COMPTAG_DestHeight,glob->rect.MaxY - glob->rect.MinY + 1,
COMPTAG_SrcWidth,width,
COMPTAG_SrcHeight,height,
COMPTAG_OffsetX,x,
@@ -394,7 +394,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
BltBitMapTags(BLITA_Width,width,
BLITA_Height,height,
BLITA_Source,tbm,
- BLITA_Dest,currp,
+ BLITA_Dest,&glob->rp,
BLITA_DestX,x,
BLITA_DestY,y,
BLITA_SrcType,BLITT_BITMAP,
@@ -426,7 +426,7 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
if(!(repeat_x || repeat_y))
return ami_bitmap(x, y, width, height, bitmap);
- tbm = ami_getcachenativebm(bitmap,width,height,currp->BitMap);
+ tbm = ami_getcachenativebm(bitmap,width,height,glob->rp.BitMap);
if(!tbm) return true;
@@ -446,8 +446,8 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
if(repeat_x)
{
- xf = glob.rect.MaxX;
- xm = glob.rect.MinX;
+ xf = glob->rect.MaxX;
+ xm = glob->rect.MinX;
}
else
{
@@ -457,8 +457,8 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
if(repeat_y)
{
- yf = glob.rect.MaxY;
- ym = glob.rect.MinY;
+ yf = glob->rect.MaxY;
+ ym = glob->rect.MinY;
}
else
{
@@ -488,11 +488,11 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
bfh->h_Data = &bfbm;
}
- InstallLayerHook(currp->Layer,bfh);
+ InstallLayerHook(glob->rp.Layer,bfh);
- EraseRect(currp,xm,ym,xf,yf);
+ EraseRect(&glob->rp,xm,ym,xf,yf);
- InstallLayerHook(currp->Layer,LAYERS_NOBACKFILL);
+ InstallLayerHook(glob->rp.Layer,LAYERS_NOBACKFILL);
if(bitmap->opaque) DeleteBackFillHook(bfh);
else FreeVec(bfh);
@@ -580,11 +580,11 @@ bool ami_path(const float *p, unsigned int n, colour fill, float width,
}
/* Save CTM */
- cairo_get_matrix(glob.cr, &old_ctm);
+ cairo_get_matrix(glob->cr, &old_ctm);
/* Set up line style and width */
- cairo_set_line_width(glob.cr, 1);
- ami_cairo_set_solid(glob.cr);
+ cairo_set_line_width(glob->cr, 1);
+ ami_cairo_set_solid(glob->cr);
/* Load new CTM */
n_ctm.xx = transform[0];
@@ -594,52 +594,52 @@ bool ami_path(const float *p, unsigned int n, colour fill, float width,
n_ctm.x0 = transform[4];
n_ctm.y0 = transform[5];
- cairo_set_matrix(glob.cr, &n_ctm);
+ cairo_set_matrix(glob->cr, &n_ctm);
/* Construct path */
for (i = 0; i < n; ) {
if (p[i] == PLOTTER_PATH_MOVE) {
- cairo_move_to(glob.cr, p[i+1], p[i+2]);
+ cairo_move_to(glob->cr, p[i+1], p[i+2]);
i += 3;
} else if (p[i] == PLOTTER_PATH_CLOSE) {
- cairo_close_path(glob.cr);
+ cairo_close_path(glob->cr);
i++;
} else if (p[i] == PLOTTER_PATH_LINE) {
- cairo_line_to(glob.cr, p[i+1], p[i+2]);
+ cairo_line_to(glob->cr, p[i+1], p[i+2]);
i += 3;
} else if (p[i] == PLOTTER_PATH_BEZIER) {
- cairo_curve_to(glob.cr, p[i+1], p[i+2],
+ cairo_curve_to(glob->cr, p[i+1], p[i+2],
p[i+3], p[i+4],
p[i+5], p[i+6]);
i += 7;
} else {
LOG(("bad path command %f", p[i]));
/* Reset matrix for safety */
- cairo_set_matrix(glob.cr, &old_ctm);
+ cairo_set_matrix(glob->cr, &old_ctm);
return false;
}
}
/* Restore original CTM */
- cairo_set_matrix(glob.cr, &old_ctm);
+ cairo_set_matrix(glob->cr, &old_ctm);
/* Now draw path */
if (fill != TRANSPARENT) {
- ami_cairo_set_colour(glob.cr,fill);
+ ami_cairo_set_colour(glob->cr,fill);
if (c != TRANSPARENT) {
/* Fill & Stroke */
- cairo_fill_preserve(glob.cr);
- ami_cairo_set_colour(glob.cr,c);
- cairo_stroke(glob.cr);
+ cairo_fill_preserve(glob->cr);
+ ami_cairo_set_colour(glob->cr,c);
+ cairo_stroke(glob->cr);
} else {
/* Fill only */
- cairo_fill(glob.cr);
+ cairo_fill(glob->cr);
}
} else if (c != TRANSPARENT) {
/* Stroke only */
- ami_cairo_set_colour(glob.cr,c);
- cairo_stroke(glob.cr);
+ ami_cairo_set_colour(glob->cr,c);
+ cairo_stroke(glob->cr);
}
#endif
return true;
diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c
index ac19873ac..a0f5918b4 100755
--- a/amiga/thumbnail.c
+++ b/amiga/thumbnail.c
@@ -32,12 +32,13 @@ bool thumbnail_create(struct content *content, struct bitmap *bitmap,
{
struct BitScaleArgs bsa;
- bitmap->nativebm = p96AllocBitMap(bitmap->width,bitmap->height,32,
- BMF_CLEAR | BMF_DISPLAYABLE | BMF_INTERLEAVED,glob.bm,RGBFB_A8R8G8B8);
+ bitmap->nativebm = p96AllocBitMap(bitmap->width, bitmap->height, 32,
+ BMF_CLEAR | BMF_DISPLAYABLE | BMF_INTERLEAVED,
+ browserglob.bm, RGBFB_A8R8G8B8);
bitmap->nativebmwidth = bitmap->width;
bitmap->nativebmheight = bitmap->height;
- ami_clearclipreg(currp);
+ ami_clearclipreg(&browserglob.rp);
content_redraw(content, 0, 0, content->width, content->width,
0, 0, content->width, content->width, 1.0, 0xFFFFFF);
@@ -46,7 +47,7 @@ bool thumbnail_create(struct content *content, struct bitmap *bitmap,
uint32 flags = COMPFLAG_IgnoreDestAlpha | COMPFLAG_SrcAlphaOverride;
if(option_scale_quality) flags |= COMPFLAG_SrcFilter;
- CompositeTags(COMPOSITE_Src,glob.bm,bitmap->nativebm,
+ CompositeTags(COMPOSITE_Src,browserglob.bm,bitmap->nativebm,
COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(bitmap->width/content->width),
COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(bitmap->height/content->width),
COMPTAG_Flags,flags,
@@ -72,7 +73,7 @@ bool thumbnail_create(struct content *content, struct bitmap *bitmap,
bsa.bsa_XDestFactor = bitmap->width;
bsa.bsa_YSrcFactor = content->width;
bsa.bsa_YDestFactor = bitmap->height;
- bsa.bsa_SrcBitMap = glob.bm;
+ bsa.bsa_SrcBitMap = browserglob.bm;
bsa.bsa_DestBitMap = bitmap->nativebm;
bsa.bsa_Flags = 0;
if(option_scale_quality) bsa.bsa_Flags = BSAF_AVERAGE;