mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-26 22:09:43 +03:00
Support old picture.datatype
This commit is contained in:
parent
490de208d0
commit
20e4bdadaf
@ -276,6 +276,18 @@ size_t bitmap_get_bpp(void *vbitmap)
|
||||
return 4;
|
||||
}
|
||||
|
||||
#ifndef __amigaos4__
|
||||
void ami_bitmap_argb_to_rgba(struct bitmap *bm)
|
||||
{
|
||||
if(bm == NULL) return;
|
||||
|
||||
ULONG *data = (ULONG *)bitmap_get_buffer(bm);
|
||||
for(int i = 0; i < ((bitmap_get_rowstride(bm) / sizeof(ULONG)) * bitmap_get_height(bm)); i++) {
|
||||
data[i] = (data[i] << 8) | (data[i] >> 24);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
|
||||
{
|
||||
Object *dto;
|
||||
@ -318,6 +330,11 @@ struct bitmap *ami_bitmap_from_datatype(char *filename)
|
||||
{
|
||||
Object *dto;
|
||||
struct bitmap *bm = NULL;
|
||||
#ifdef __amigaos4__
|
||||
int bm_format = PBPAFMT_RGBA;
|
||||
#else
|
||||
int bm_format = PBPAFMT_ARGB;
|
||||
#endif
|
||||
|
||||
if(dto = NewDTObject(filename,
|
||||
DTA_GroupID, GID_PICTURE,
|
||||
@ -332,9 +349,11 @@ struct bitmap *ami_bitmap_from_datatype(char *filename)
|
||||
bm = bitmap_create(bmh->bmh_Width, bmh->bmh_Height, 0);
|
||||
|
||||
IDoMethod(dto, PDTM_READPIXELARRAY, bitmap_get_buffer(bm),
|
||||
PBPAFMT_RGBA, bitmap_get_rowstride(bm), 0, 0,
|
||||
bm_format, bitmap_get_rowstride(bm), 0, 0,
|
||||
bmh->bmh_Width, bmh->bmh_Height);
|
||||
|
||||
#ifndef __amigaos4__
|
||||
ami_bitmap_argb_to_rgba(bitmap);
|
||||
#endif
|
||||
bitmap_set_opaque(bm, bitmap_test_opaque(bm));
|
||||
}
|
||||
DisposeDTObject(dto);
|
||||
|
@ -49,4 +49,9 @@ PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
|
||||
|
||||
Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap);
|
||||
struct bitmap *ami_bitmap_from_datatype(char *filename);
|
||||
|
||||
#ifndef __amigaos4__
|
||||
void ami_bitmap_argb_to_rgba(struct bitmap *bm);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -175,7 +175,11 @@ static struct bitmap *amiga_dt_picture_cache_convert(struct content *c)
|
||||
Object *dto;
|
||||
struct bitmap *bitmap;
|
||||
unsigned int bm_flags = BITMAP_NEW;
|
||||
#ifdef __amigaos4__
|
||||
int bm_format = PBPAFMT_RGBA;
|
||||
#else
|
||||
int bm_format = PBPAFMT_ARGB;
|
||||
#endif
|
||||
struct amiga_dt_picture_content *adt = (struct amiga_dt_picture_content *)c;
|
||||
|
||||
if(dto = amiga_dt_picture_newdtobject(adt))
|
||||
@ -192,7 +196,9 @@ static struct bitmap *amiga_dt_picture_cache_convert(struct content *c)
|
||||
IDoMethod(dto, PDTM_READPIXELARRAY,
|
||||
bm_buffer, bm_format, bitmap_get_rowstride(bitmap),
|
||||
0, 0, c->width, c->height);
|
||||
|
||||
#ifndef __amigaos4__
|
||||
ami_bitmap_argb_to_rgba(bitmap);
|
||||
#endif
|
||||
bitmap_set_opaque(bitmap, bitmap_test_opaque(bitmap));
|
||||
|
||||
DisposeDTObject(dto);
|
||||
|
Loading…
Reference in New Issue
Block a user