From 6c8225d3ab17f25aa1e8ed7f22533772c8d98245 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 2 Jul 2016 14:49:18 +0100 Subject: Don't abort on startup if GuiGFX is not available Most OS4 users won't need it, everybody else might like the opportunity of using NetSurf to download it :) --- frontends/amiga/bitmap.c | 21 +++++++++++++++------ frontends/amiga/libs.c | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'frontends/amiga') diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c index badd37438..d6d0c76c9 100644 --- a/frontends/amiga/bitmap.c +++ b/frontends/amiga/bitmap.c @@ -80,6 +80,7 @@ enum { }; static APTR pool_bitmap = NULL; +static bool guigfx_warned = false; /* exported function documented in amiga/bitmap.h */ void *amiga_bitmap_create(int width, int height, unsigned int state) @@ -416,16 +417,19 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap, int w if(tbm == NULL) { if(type == AMI_NSBM_TRUECOLOUR) { - if((tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, 32, 0, - friendbm, AMI_BITMAP_FORMAT))) { - ami_rtg_writepixelarray(amiga_bitmap_get_buffer(bitmap), + tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, 32, 0, + friendbm, AMI_BITMAP_FORMAT); + if(tbm == NULL) return NULL; + + ami_rtg_writepixelarray(amiga_bitmap_get_buffer(bitmap), tbm, bitmap->width, bitmap->height, bitmap->width * 4, AMI_BITMAP_FORMAT); - } } else { - if((tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, - 8, 0, friendbm, AMI_BITMAP_FORMAT))) { + tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, + 8, 0, friendbm, AMI_BITMAP_FORMAT); + if(tbm == NULL) return NULL; + if(GuiGFXBase != NULL) { struct RastPort rp; InitRastPort(&rp); rp.BitMap = tbm; @@ -450,6 +454,11 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap, int w DirectDrawTrueColor(ddh, (ULONG *)amiga_bitmap_get_buffer(bitmap), 0, 0, TAG_DONE); DeleteDirectDrawHandle(ddh); ami_bitmap_argb_to_rgba(bitmap); + } else { + if(guigfx_warned == false) { + amiga_warn_user("BMConvErr", NULL); + guigfx_warned = true; + } } } diff --git a/frontends/amiga/libs.c b/frontends/amiga/libs.c index 993cd3ad0..00facf957 100644 --- a/frontends/amiga/libs.c +++ b/frontends/amiga/libs.c @@ -227,7 +227,7 @@ bool ami_libs_open(void) AMINS_LIB_OPEN("Picasso96API.library", 0, P96, "main", 1, false) /* Non-OS provided libraries */ - AMINS_LIB_OPEN("guigfx.library", 9, GuiGFX, "main", 1, true) + AMINS_LIB_OPEN("guigfx.library", 9, GuiGFX, "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 -- cgit v1.2.3