summaryrefslogtreecommitdiff
path: root/amiga/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'amiga/bitmap.c')
-rw-r--r--amiga/bitmap.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index dd6a91b67..73cb4e35f 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -46,6 +46,13 @@
#include "amiga/misc.h"
#include "amiga/rtg.h"
+enum {
+ AMI_NSBM_NONE = 0,
+ AMI_NSBM_TRUECOLOUR,
+ AMI_NSBM_PALETTEMAPPED
+};
+
+
/* exported function documented in amiga/bitmap.h */
void *amiga_bitmap_create(int width, int height, unsigned int state)
{
@@ -69,6 +76,7 @@ void *amiga_bitmap_create(int width, int height, unsigned int state)
bitmap->url = NULL;
bitmap->title = NULL;
bitmap->icondata = NULL;
+ bitmap->native = AMI_NSBM_NONE;
return bitmap;
}
@@ -163,6 +171,7 @@ void amiga_bitmap_modified(void *bitmap)
bm->nativebm = NULL;
bm->dto = NULL;
bm->native_mask = NULL;
+ bm->native = AMI_NSBM_NONE;
}
@@ -353,6 +362,10 @@ static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int
if(!bitmap) return NULL;
+ if((bitmap->native != AMI_NSBM_NONE) && (bitmap->native != AMI_NSBM_TRUECOLOUR)) {
+ amiga_bitmap_modified(bitmap);
+ }
+
if(bitmap->nativebm)
{
if((bitmap->nativebmwidth == width) && (bitmap->nativebmheight==height))
@@ -384,6 +397,7 @@ static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int
bitmap->nativebm = tbm;
bitmap->nativebmwidth = bitmap->width;
bitmap->nativebmheight = bitmap->height;
+ bitmap->native = AMI_NSBM_TRUECOLOUR;
}
}
@@ -436,12 +450,14 @@ static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int
ami_rtg_freebitmap(tbm);
tbm = scaledbm;
bitmap->nativebm = NULL;
+ bitmap->native = AMI_NSBM_NONE;
if(nsoption_int(cache_bitmaps) >= 1)
{
bitmap->nativebm = tbm;
bitmap->nativebmwidth = width;
bitmap->nativebmheight = height;
+ bitmap->native = AMI_NSBM_TRUECOLOUR;
}
}
@@ -482,7 +498,11 @@ static inline struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap,
int width, int height)
{
struct BitMap *dtbm;
-
+
+ if((bitmap->native != AMI_NSBM_NONE) && (bitmap->native != AMI_NSBM_PALETTEMAPPED)) {
+ amiga_bitmap_modified(bitmap);
+ }
+
/* Dispose the DataTypes object if we've performed a layout already,
and we need to scale, as scaling can only be performed before
the first GM_LAYOUT */
@@ -519,6 +539,10 @@ static inline struct BitMap *ami_bitmap_get_palettemapped(struct bitmap *bitmap,
bitmap->nativebmwidth = width;
bitmap->nativebmheight = height;
+ /**\todo Native bitmaps are stored as DataTypes Objects here?
+ This is sub-optimal and they should be cached as BitMaps according to user
+ preferences */
+ bitmap->native = AMI_NSBM_PALETTEMAPPED;
return dtbm;
}
@@ -534,7 +558,11 @@ struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
{
+<<<<<<< HEAD
+// if(ami_plot_screen_is_palettemapped() == true) return NSERROR_OK;
+=======
if(ami_plot_screen_is_palettemapped() == true) return NSERROR_OK;
+>>>>>>> 6847fad65368bab3418eb716af4f9d485dfe30b1
struct redraw_context ctx = {
.interactive = false,