summaryrefslogtreecommitdiff
path: root/amiga/bitmap.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2012-08-10 18:05:22 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2012-08-10 18:05:22 +0100
commitc456153e902177da27d99fc3baca4fcd89f6de6c (patch)
tree6acd875b107d124c685743d073c8436c614dd132 /amiga/bitmap.c
parentbc5918ebbc01a4d5022c8b3b308af41318097c84 (diff)
downloadnetsurf-c456153e902177da27d99fc3baca4fcd89f6de6c.tar.gz
netsurf-c456153e902177da27d99fc3baca4fcd89f6de6c.tar.bz2
Correct byte order - is RGBA not ARGB
Fix mask offset calculation
Diffstat (limited to 'amiga/bitmap.c')
-rw-r--r--amiga/bitmap.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 4d20fb4d1..db5424502 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008, 2009 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2008, 2009, 2012 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define AMI_CUSTOM_MASK 1
+
#include "amiga/os3support.h"
#include "assert.h"
@@ -230,7 +232,7 @@ bool bitmap_test_opaque(void *bitmap)
for(a=0;a<p;a+=4)
{
- if ((*bmi & 0xff000000U) != 0xff000000U) return false;
+ if ((*bmi & 0x000000ffU) != 0x000000ffU) return false;
bmi++;
}
return true;
@@ -487,13 +489,17 @@ static PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width, int height
bitmap->native_mask = AllocRaster(width, height);
+ for(int i=0; i<(height * (width / 8)); i++) {
+ bitmap->native_mask[i] = 0;
+ }
+
for(y=0; y<height; y++) {
for(x=0; x<width; x++) {
- if ((*bmi & 0xff000000U) == 0x00000000U) maskbit = 1;
+ if ((*bmi & 0x000000ffU) == 0x00000000U) maskbit = 1;
else maskbit = 0;
bmi++;
- bitmap->native_mask[(y*4) + (x/8)] =
- (bitmap->native_mask[(y*4) + (x/8)] << 1) | maskbit;
+ bitmap->native_mask[(y*(width/8)) + (x/8)] =
+ (bitmap->native_mask[(y*(width/8)) + (x/8)] << 1) | maskbit;
}
}