Try to ensure we get the correct type of native BitMap

This commit is contained in:
Chris Young 2017-02-13 18:41:38 +00:00
parent 184348dada
commit 0c32cbb7cb
6 changed files with 12 additions and 10 deletions

View File

@ -703,11 +703,11 @@ static inline struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap,
}
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
int width, int height, struct BitMap *friendbm)
int width, int height, bool palette_mapped, struct BitMap *friendbm)
{
if(bitmap == NULL) return NULL;
if(__builtin_expect(ami_plot_screen_is_palettemapped() == true, 0)) {
if(__builtin_expect(palette_mapped == true, 0)) {
return ami_bitmap_get_palettemapped(bitmap, width, height, friendbm);
} else {
return ami_bitmap_get_truecolour(bitmap, width, height, friendbm);

View File

@ -34,7 +34,7 @@ struct nsurl;
struct gui_globals;
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
int width, int height, struct BitMap *friendbm);
int width, int height, bool palette_mapped, struct BitMap *friendbm);
PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
int height, struct BitMap *n_bm);

View File

@ -1810,7 +1810,7 @@ static void gui_window_set_icon(struct gui_window *g, struct hlcache_handle *ico
if ((icon != NULL) && ((icon_bitmap = content_get_bitmap(icon)) != NULL))
{
bm = ami_bitmap_get_native(icon_bitmap, 16, 16,
bm = ami_bitmap_get_native(icon_bitmap, 16, 16, ami_plot_screen_is_palettemapped(),
g->shared->win->RPort->BitMap);
}
@ -5135,7 +5135,7 @@ static nserror gui_search_web_provider_update(const char *provider_name,
if(nsoption_bool(kiosk_mode) == true) return NSERROR_BAD_PARAMETER;
if (ico_bitmap != NULL) {
bm = ami_bitmap_get_native(ico_bitmap, 16, 16, NULL);
bm = ami_bitmap_get_native(ico_bitmap, 16, 16, ami_plot_screen_is_palettemapped(), NULL);
}
if(bm == NULL) return NSERROR_BAD_PARAMETER;

View File

@ -385,7 +385,7 @@ void amiga_icon_superimpose_favicon_internal(struct hlcache_handle *icon, struct
if(format != IDFMT_DIRECTMAPPED) return;
#ifdef __amigaos4__
if ((icon != NULL) && (content_get_bitmap(icon) != NULL)) {
bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16, NULL);
bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16, false, NULL);
}
if(bm) {
@ -506,7 +506,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
if(bm)
{
bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
THUMBNAIL_HEIGHT, NULL);
THUMBNAIL_HEIGHT, false, NULL);
icondata = malloc(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT);
ami_bitmap_set_icondata(bm, icondata);

View File

@ -451,7 +451,7 @@ ami_bitmap(struct gui_globals *glob, int x, int y, int width, int height, struct
return NSERROR_OK;
}
tbm = ami_bitmap_get_native(bitmap, width, height, glob->rp->BitMap);
tbm = ami_bitmap_get_native(bitmap, width, height, glob->palette_mapped, glob->rp->BitMap);
if (!tbm) {
return NSERROR_OK;
}
@ -1051,7 +1051,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->palette_mapped, glob->rp->BitMap);
if (!tbm) {
return NSERROR_OK;
}

View File

@ -47,6 +47,7 @@
#include "amiga/gui.h"
#include "amiga/drag.h"
#include "amiga/bitmap.h"
#include "amiga/plotters.h"
#include "amiga/schedule.h"
#include "amiga/theme.h"
#include "amiga/misc.h"
@ -179,7 +180,8 @@ void ami_theme_throbber_setup(void)
if(throbber_update_interval == 0) throbber_update_interval = 250;
bm = ami_bitmap_from_datatype(throbberfile);
throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm), bitmap_get_height(bm), NULL);
throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm), bitmap_get_height(bm),
ami_plot_screen_is_palettemapped(), NULL);
throbber_nsbm = bm;
}