Abstract P96 functions away so we can decide what to use at run-time.
This allows us to avoid opening P96 on OS4.1FE in future, and not require it to be installed on OS3.
This commit is contained in:
parent
d0f7247ea6
commit
e3af7f3343
|
@ -73,7 +73,7 @@ S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \
|
|||
launch.c search.c history_local.c download.c iff_dr2d.c \
|
||||
sslcert.c gui_options.c print.c theme.c drag.c icon.c libs.c \
|
||||
datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \
|
||||
stringview/stringview.c stringview/urlhistory.c \
|
||||
stringview/stringview.c stringview/urlhistory.c rtg.c \
|
||||
agclass/amigaguide_class.c fs_backing_store.c os3support.c
|
||||
S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "amiga/bitmap.h"
|
||||
#include "amiga/download.h"
|
||||
#include "amiga/misc.h"
|
||||
#include "amiga/rtg.h"
|
||||
|
||||
/**
|
||||
* Create a bitmap.
|
||||
|
@ -122,7 +123,7 @@ void bitmap_destroy(void *bitmap)
|
|||
if(bm)
|
||||
{
|
||||
if((bm->nativebm) && (bm->dto == NULL)) {
|
||||
p96FreeBitMap(bm->nativebm);
|
||||
ami_rtg_freebitmap(bm->nativebm);
|
||||
}
|
||||
|
||||
if(bm->dto) {
|
||||
|
@ -180,7 +181,7 @@ void bitmap_modified(void *bitmap) {
|
|||
struct bitmap *bm = bitmap;
|
||||
|
||||
if((bm->nativebm) && (bm->dto == NULL))
|
||||
p96FreeBitMap(bm->nativebm);
|
||||
ami_rtg_freebitmap(bm->nativebm);
|
||||
|
||||
if(bm->dto) DisposeDTObject(bm->dto);
|
||||
if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
|
||||
|
@ -408,7 +409,7 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,
|
|||
}
|
||||
else
|
||||
{
|
||||
if(bitmap->nativebm) p96FreeBitMap(bitmap->nativebm);
|
||||
if(bitmap->nativebm) ami_rtg_freebitmap(bitmap->nativebm);
|
||||
bitmap->nativebm = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -419,10 +420,11 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,
|
|||
ri.BytesPerRow = bitmap->width * 4;
|
||||
ri.RGBFormat = AMI_BITMAP_FORMAT;
|
||||
|
||||
if((tbm = p96AllocBitMap(bitmap->width, bitmap->height, 32, 0,
|
||||
if((tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, 32, 0,
|
||||
friendbm, AMI_BITMAP_FORMAT))) {
|
||||
InitRastPort(&trp);
|
||||
trp.BitMap = tbm;
|
||||
/*\todo abstract p96WritePixelArray */
|
||||
p96WritePixelArray((struct RenderInfo *)&ri, 0, 0, &trp, 0, 0,
|
||||
bitmap->width, bitmap->height);
|
||||
}
|
||||
|
@ -440,7 +442,7 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,
|
|||
struct BitMap *scaledbm;
|
||||
struct BitScaleArgs bsa;
|
||||
|
||||
scaledbm = p96AllocBitMap(width, height, 32, BMF_DISPLAYABLE,
|
||||
scaledbm = ami_rtg_allocbitmap(width, height, 32, BMF_DISPLAYABLE,
|
||||
friendbm, AMI_BITMAP_FORMAT);
|
||||
|
||||
if(GfxBase->LibNode.lib_Version >= 53) // AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1)
|
||||
|
@ -482,8 +484,8 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,
|
|||
BitMapScale(&bsa);
|
||||
}
|
||||
|
||||
if(bitmap->nativebm != tbm) p96FreeBitMap(bitmap->nativebm);
|
||||
p96FreeBitMap(tbm);
|
||||
if(bitmap->nativebm != tbm) ami_rtg_freebitmap(bitmap->nativebm);
|
||||
ami_rtg_freebitmap(tbm);
|
||||
tbm = scaledbm;
|
||||
bitmap->nativebm = NULL;
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include <proto/keymap.h>
|
||||
#include <proto/locale.h>
|
||||
#ifdef __amigaos4__
|
||||
#include <proto/Picasso96API.h>
|
||||
#include <proto/popupmenu.h>
|
||||
#endif
|
||||
#include <proto/utility.h>
|
||||
|
@ -142,6 +141,7 @@
|
|||
#include "amiga/plotters.h"
|
||||
#include "amiga/plugin_hack.h"
|
||||
#include "amiga/print.h"
|
||||
#include "amiga/rtg.h"
|
||||
#include "amiga/schedule.h"
|
||||
#include "amiga/search.h"
|
||||
#include "amiga/theme.h"
|
||||
|
@ -2844,7 +2844,7 @@ void ami_switch_tab(struct gui_window_2 *gwin, bool redraw)
|
|||
RefreshSetGadgetAttrs((struct Gadget *)gwin->objects[GID_URL],
|
||||
gwin->win, NULL, STRINGA_TextVal, "", TAG_DONE);
|
||||
|
||||
p96RectFill(gwin->win->RPort, bbox->Left, bbox->Top,
|
||||
ami_rtg_rectfill(gwin->win->RPort, bbox->Left, bbox->Top,
|
||||
bbox->Width+bbox->Left, bbox->Height+bbox->Top, 0xffffffff);
|
||||
|
||||
ami_gui_free_space_box(bbox);
|
||||
|
@ -2859,7 +2859,7 @@ void ami_switch_tab(struct gui_window_2 *gwin, bool redraw)
|
|||
{
|
||||
gui_window_set_icon(gwin->gw, gwin->gw->favicon);
|
||||
|
||||
p96RectFill(gwin->win->RPort, bbox->Left, bbox->Top,
|
||||
ami_rtg_rectfill(gwin->win->RPort, bbox->Left, bbox->Top,
|
||||
bbox->Width+bbox->Left, bbox->Height+bbox->Top, 0xffffffff);
|
||||
browser_window_update(gwin->gw->bw, false);
|
||||
|
||||
|
|
14
amiga/libs.c
14
amiga/libs.c
|
@ -37,7 +37,7 @@
|
|||
} else { \
|
||||
LOG(("Failed to open %s v%d", LIB, LIBVER)); \
|
||||
if(FAIL == true) { \
|
||||
STRPTR error = ASPrintf("Unable to open %s v%d", LIB, LIBVER); \
|
||||
STRPTR error = ASPrintf("Unable to open %s v%d (fatal error)", LIB, LIBVER); \
|
||||
ami_misc_fatal_error(error); \
|
||||
FreeVec(error); \
|
||||
return false; \
|
||||
|
@ -58,7 +58,7 @@
|
|||
} else { \
|
||||
LOG(("Failed to open %s v%d", LIB, LIBVER)); \
|
||||
if(FAIL == true) { \
|
||||
STRPTR error = ASPrintf("Unable to open %s v%d", LIB, LIBVER); \
|
||||
STRPTR error = ASPrintf("Unable to open %s v%d (fatal error)", LIB, LIBVER); \
|
||||
ami_misc_fatal_error(error); \
|
||||
FreeVec(error); \
|
||||
return false; \
|
||||
|
@ -76,7 +76,6 @@
|
|||
|
||||
#ifdef __amigaos4__
|
||||
AMINS_LIB_STRUCT(Application);
|
||||
AMINS_LIB_STRUCT(P96);
|
||||
#else
|
||||
struct UtilityBase *UtilityBase; /* AMINS_LIB_STRUCT(Utility) */
|
||||
#endif
|
||||
|
@ -91,6 +90,7 @@ AMINS_LIB_STRUCT(Intuition);
|
|||
AMINS_LIB_STRUCT(Keymap);
|
||||
AMINS_LIB_STRUCT(Layers);
|
||||
AMINS_LIB_STRUCT(Locale);
|
||||
AMINS_LIB_STRUCT(P96);
|
||||
AMINS_LIB_STRUCT(Workbench);
|
||||
|
||||
AMINS_LIB_STRUCT(ARexx);
|
||||
|
@ -120,7 +120,6 @@ bool ami_libs_open(void)
|
|||
#ifdef __amigaos4__
|
||||
/* Libraries only needed on OS4 */
|
||||
AMINS_LIB_OPEN("application.library", 53, Application, "application", 2, false)
|
||||
AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1, true)
|
||||
#else
|
||||
/* Libraries we get automatically on OS4 but not OS3 */
|
||||
AMINS_LIB_OPEN("utility.library", 37, Utility, "main", 1, true)
|
||||
|
@ -139,6 +138,11 @@ bool ami_libs_open(void)
|
|||
AMINS_LIB_OPEN("locale.library", 37, Locale, "main", 1, true)
|
||||
AMINS_LIB_OPEN("workbench.library", 37, Workbench, "main", 1, true)
|
||||
|
||||
/*\todo This is down here as we need to check the graphics.library version
|
||||
* before opening. If it is sufficiently new enough we can avoid using P96
|
||||
*/
|
||||
AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1, false)
|
||||
|
||||
/* NB: timer.device is opened in schedule.c (ultimately by the scheduler process).
|
||||
* The library base and interface are obtained there, rather than here, due to
|
||||
* the additional complexities of opening devices, which aren't important here
|
||||
|
@ -213,10 +217,10 @@ void ami_libs_close(void)
|
|||
AMINS_LIB_CLOSE(Keymap)
|
||||
AMINS_LIB_CLOSE(Layers)
|
||||
AMINS_LIB_CLOSE(Locale)
|
||||
AMINS_LIB_CLOSE(P96)
|
||||
AMINS_LIB_CLOSE(Workbench)
|
||||
#ifdef __amigaos4__
|
||||
AMINS_LIB_CLOSE(Application)
|
||||
AMINS_LIB_CLOSE(P96)
|
||||
#else
|
||||
AMINS_LIB_CLOSE(Utility)
|
||||
#endif
|
||||
|
|
|
@ -150,9 +150,7 @@
|
|||
#define ShowWindow(...) (void)0
|
||||
|
||||
/* P96 */
|
||||
#define p96FreeBitMap(B) FreeBitMap(B)
|
||||
#define p96AllocBitMap(W,H,D,FL,FR,FM) AllocBitMap(W,H,D,FL,FR)
|
||||
#define p96RectFill(RP,X,Y,XW,YH,C) RectFill(RP,X,Y,XW,YH) /* Needs pen */
|
||||
#define p96WritePixelArray (void)0 /* TODO - see rtg.c */
|
||||
|
||||
/* Utility */
|
||||
#define SetMem memset
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
|
||||
#include "amiga/os3support.h"
|
||||
|
||||
#ifdef __amigaos4__
|
||||
#include <proto/Picasso96API.h>
|
||||
#endif
|
||||
#include <proto/exec.h>
|
||||
#include <proto/intuition.h>
|
||||
|
||||
|
@ -134,10 +131,10 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height)
|
|||
gg->bm = AllocBitMap(width, height, depth,
|
||||
BMF_INTERLEAVED | BMF_DISPLAYABLE, friend);
|
||||
} else {
|
||||
gg->bm = p96AllocBitMap(width, height, 32,
|
||||
gg->bm = ami_rtg_allocbitmap(width, height, 32,
|
||||
BMF_INTERLEAVED | BMF_DISPLAYABLE, friend, RGBFB_A8R8G8B8);
|
||||
}
|
||||
|
||||
|
||||
if(!gg->bm) warn_user("NoMemory","");
|
||||
|
||||
gg->rp = AllocVecTagList(sizeof(struct RastPort), NULL);
|
||||
|
@ -167,8 +164,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height)
|
|||
|
||||
void ami_free_layers(struct gui_globals *gg)
|
||||
{
|
||||
if(gg->rp)
|
||||
{
|
||||
if(gg->rp) {
|
||||
DeleteLayer(0,gg->rp->Layer);
|
||||
FreeVec(gg->rp->TmpRas);
|
||||
FreeVec(gg->rp->AreaInfo);
|
||||
|
@ -179,7 +175,7 @@ void ami_free_layers(struct gui_globals *gg)
|
|||
FreeVec(gg->areabuf);
|
||||
DisposeLayerInfo(gg->layerinfo);
|
||||
if(palette_mapped == false) {
|
||||
p96FreeBitMap(gg->bm);
|
||||
ami_rtg_freebitmap(gg->bm);
|
||||
} else {
|
||||
FreeBitMap(gg->bm);
|
||||
}
|
||||
|
@ -550,9 +546,8 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
|
|||
#endif
|
||||
}
|
||||
|
||||
if((bitmap->dto == NULL) && (tbm != bitmap->nativebm))
|
||||
{
|
||||
p96FreeBitMap(tbm);
|
||||
if((bitmap->dto == NULL) && (tbm != bitmap->nativebm)) {
|
||||
ami_rtg_freebitmap(tbm);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -654,7 +649,7 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
|
|||
|
||||
if((bitmap->dto == NULL) && (tbm != bitmap->nativebm))
|
||||
{
|
||||
p96FreeBitMap(tbm);
|
||||
ami_rtg_freebitmap(tbm);
|
||||
}
|
||||
#else
|
||||
#warning FIXME: bitmap tiling uses backfill hooks
|
||||
|
|
Loading…
Reference in New Issue