summaryrefslogtreecommitdiff
path: root/amiga/bitmap.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2011-03-26 10:33:58 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2011-03-26 10:33:58 +0000
commit14d6826685a69d2983cb8df3faaf14b563a0ec6b (patch)
treeb016aa7aef90693974331509064020787da6bd57 /amiga/bitmap.c
parent2c55af59de7070fa581abba528e23c2668a35c23 (diff)
downloadnetsurf-14d6826685a69d2983cb8df3faaf14b563a0ec6b.tar.gz
netsurf-14d6826685a69d2983cb8df3faaf14b563a0ec6b.tar.bz2
Implement ask overwrite
svn path=/trunk/netsurf/; revision=12135
Diffstat (limited to 'amiga/bitmap.c')
-rw-r--r--amiga/bitmap.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 162eb9d0d..ff07da910 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -20,6 +20,7 @@
#include "assert.h"
#include "amiga/bitmap.h"
+#include "amiga/download.h"
#include <proto/exec.h>
#include <proto/Picasso96API.h>
#ifdef __amigaos4__
@@ -137,6 +138,8 @@ bool bitmap_save(void *bitmap, const char *path, unsigned flags)
int err = 0;
Object *dto = NULL;
+ if(!ami_download_check_overwrite(path, NULL)) return false;
+
if(dto = ami_datatype_object_from_bitmap(bitmap))
{
err = SaveDTObjectA(dto, NULL, NULL, path, DTWM_IFF, FALSE, NULL);
@@ -418,3 +421,26 @@ struct BitMap *ami_getcachenativebm(struct bitmap *bitmap,int width,int height,s
return tbm;
}
+
+APTR ami_colormap_to_clut(struct ColorMap *cmap)
+{
+ int i;
+ UBYTE *clut = AllocVec(256 * 4, MEMF_PRIVATE | MEMF_CLEAR);
+ ULONG colour[3 * 256];
+
+ if(!clut) return NULL;
+
+ /* Get the palette from the ColorMap */
+ GetRGB32(cmap, 0, 256, (ULONG *)&colour);
+
+ /* convert it to a table of ARGB values */
+ for(i = 0; i < 1024; i += 4)
+ {
+ clut[i] = (0xff << 24) |
+ ((colour[i] & 0xff000000) >> 8) |
+ ((colour[i + 1] & 0xff000000) >> 16) |
+ ((colour[i + 2] & 0xff000000) >> 24);
+ }
+
+ return clut;
+}