23#include <proto/exec.h>
25#include <graphics/blitattr.h>
26#include <graphics/composite.h>
28#include <graphics/gfxbase.h>
29#include <proto/datatypes.h>
30#include <datatypes/pictureclass.h>
32#include <proto/intuition.h>
33#include <proto/utility.h>
35#include <proto/guigfx.h>
36#include <guigfx/guigfx.h>
37#include <render/render.h>
39#include <inline/guigfx.h>
43#include <exec/extmem.h>
64#ifdef AMI_NS_TRIANGLE_SCALING
65#undef AMI_NS_TRIANGLE_SCALING
98#define VTX(I,X,Y,S,T) vtx[I].x = X; vtx[I].y = Y; vtx[I].s = S; vtx[I].t = T; vtx[I].w = 1.0f;
99#define VTX_RECT(SX,SY,SW,SH,DX,DY,DW,DH) \
100 VTX(0, DX, DY, SX, SY); \
101 VTX(1, DX + DW, DY, SX + SW, SY); \
102 VTX(2, DX, DY + DH, SX, SY + SH); \
103 VTX(3, DX + DW, DY, SX + SW, SY); \
104 VTX(4, DX, DY + DH, SX, SY + SH); \
105 VTX(5, DX + DW, DY + DH, SX + SW, SY + SH);
118 if(
bitmap == NULL)
return NULL;
126 ASOEXTMEM_Size, &size64,
127 ASOEXTMEM_AllocationPolicy, EXTMEMPOLICY_IMMEDIATE,
164 "Unmapping ExtMem object %p for bitmap %p",
182 "Mapping ExtMem object %p for bitmap %p",
203 return ((bm->
width)*4);
265 if((DoDTMethod(
dto, 0, 0, DTM_PROCLAYOUT, 0, 1)) == 0) {
271 DisposeDTObject(
dto);
274 if(err == 0)
return false;
356 printf(
"Width=%ld, Height=%ld, Opaque=%s\nnativebm=%lx, width=%ld, height=%ld\n",
372 struct BitMapHeader *bmhd;
374 if((dto = NewDTObject(NULL,
375 DTA_SourceType,DTST_RAM,
376 DTA_GroupID,GID_PICTURE,
378 PDTA_DestMode,PMODE_V43,
381 if(GetDTAttrs(dto,PDTA_BitMapHeader,&bmhd,TAG_DONE))
385 bmhd->bmh_Depth = (UBYTE)32;
389 SetDTAttrs(dto,NULL,NULL,
395 PDTA_SourceMode,PMODE_V43,
412 if((
dto = NewDTObject(filename,
413 DTA_GroupID, GID_PICTURE,
414 PDTA_DestMode, PMODE_V43,
417 struct BitMapHeader *bmh;
419 if(GetDTAttrs(dto, PDTA_BitMapHeader, &bmh, TAG_DONE))
425 bmh->bmh_Width, bmh->bmh_Height);
429 DisposeDTObject(dto);
438 struct BitMap *restrict tbm = NULL;
458 if(tbm == NULL)
return NULL;
466 if(tbm == NULL)
return NULL;
468 if(GuiGFXBase != NULL) {
472 ULONG dithermode = DITHERMODE_NONE;
475 dithermode = DITHERMODE_EDD;
477 dithermode = DITHERMODE_FS;
483 scrn->ViewPort.ColorMap,
484 GGFX_DitherMode, dithermode,
492 DeleteDirectDrawHandle(ddh);
524 struct BitMap *restrict scaledbm;
525 struct BitScaleArgs bsa;
532 if(__builtin_expect(((GfxBase->LibNode.lib_Version >= 53) &&
538 uint32 err = COMPERR_Success;
539#ifdef AMI_NS_TRIANGLE_SCALING
543 flags = COMPFLAG_HardwareOnly;
544 if(
nsoption_bool(scale_quality) ==
true) flags |= COMPFLAG_SrcFilter;
546 err = CompositeTags(COMPOSITE_Src, tbm, scaledbm,
547 COMPTAG_VertexArray, vtx,
548 COMPTAG_VertexFormat, COMPVF_STW0_Present,
549 COMPTAG_NumTriangles, 2,
550 COMPTAG_Flags, flags,
551 COMPTAG_FriendBitMap,
scrn->RastPort.BitMap,
554 if (err != COMPERR_Success) {
556 "Composite error %ld - falling back",
565 if(
nsoption_bool(scale_quality) ==
true) flags |= COMPFLAG_SrcFilter;
567 err = CompositeTags(COMPOSITE_Src, tbm, scaledbm,
570 COMPTAG_Flags, flags,
571 COMPTAG_FriendBitMap,
scrn->RastPort.BitMap,
575 "Fallback returned error %ld", err);
587 bsa.bsa_XDestFactor =
width;
589 bsa.bsa_YDestFactor =
height;
590 bsa.bsa_SrcBitMap = tbm;
591 bsa.bsa_DestBitMap = scaledbm;
627 int height,
struct BitMap *n_bm)
638 bm_width = GetBitMapAttr(n_bm, BMA_WIDTH);
639 bpr = RASSIZE(bm_width, 1);
644 for(x=0; x<
width; x++) {
645 if ((*bmi & 0xff000000U) <= (ULONG)
nsoption_int(mask_alpha)) maskbit = 0;
649 maskbit << (7 - (x % 8));
669 if(
bitmap == NULL)
return NULL;
687 NSLOG(netsurf, INFO,
"Entering bitmap_render");
702 .background_images =
true,
709 BltBitMapTags( BLITA_SrcX, 0,
714 BLITA_SrcType, BLITT_BITMAP,
716 BLITA_DestType, BLITT_ARGB32,
728#warning FIXME for OS3 (in current state none of bitmap_render can work!)
736 if(bm->
url != NULL)
return;
742 if(bm->
title != NULL)
return;
743 bm->
title = strdup(title);
759 if(bm->
nativebm == nbm)
return true;
struct Screen * ami_gui_get_screen(void)
Get a pointer to the screen NetSurf is running on.
static struct Screen * scrn
nserror amiga_warn_user(const char *warning, const char *detail)
Warn the user of an event.
const struct plotter_table amiplot
void ami_plot_ra_free(struct gui_globals *gg)
Free a plotter render area.
struct BitMap * ami_plot_ra_get_bitmap(struct gui_globals *gg)
Get a drawing BitMap associated with a render area.
static bool palette_mapped
void ami_clearclipreg(struct gui_globals *gg)
struct gui_globals * ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit, bool alloc_pen_list)
Alloc a plotter render area.
nserror ami_schedule(int t, void(*callback)(void *p), void *p)
Schedule a callback.
bool bitmap_test_opaque(void *bitmap)
Test whether a bitmap is completely opaque (no transparency).
nserror
Enumeration of error codes.
#define VTX_RECT(SX, SY, SW, SH, DX, DY, DW, DH)
size_t amiga_bitmap_get_rowstride(void *bitmap)
Find the width of a pixel row in bytes.
static struct gui_bitmap_table bitmap_table
void * amiga_bitmap_create(int width, int height, enum gui_bitmap_flags flags)
Create a bitmap.
void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url)
Set bitmap URL.
struct BitMap * ami_bitmap_get_native(struct bitmap *bitmap, int width, int height, bool palette_mapped, struct BitMap *friendbm)
int bitmap_get_width(void *bitmap)
get width of a bitmap.
void ami_bitmap_free_icondata(struct bitmap *bm)
Free an icondata pointer.
static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content)
void ami_bitmap_fini(void)
Cleanup bitmap allocations.
int bitmap_get_height(void *bitmap)
get height of a bitmap.
static struct BitMap * ami_bitmap_get_truecolour(struct bitmap *bitmap, int width, int height, struct BitMap *friendbm)
bool amiga_bitmap_save(void *bitmap, const char *path, unsigned flags)
Save a bitmap in the platform's native format.
PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width, int height, struct BitMap *n_bm)
static struct BitMap * ami_bitmap_get_generic(struct bitmap *bitmap, int width, int height, struct BitMap *restrict friendbm, int type)
static void amiga_bitmap_unmap_buffer(void *p)
bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm)
Test if a BitMap is owned by a bitmap.
struct bitmap * ami_bitmap_from_datatype(char *filename)
struct gui_bitmap_table * amiga_bitmap_table
void ami_bitmap_set_title(struct bitmap *bm, const char *title)
Set bitmap title.
void amiga_bitmap_modified(void *bitmap)
The bitmap image has changed, so flush any persistant cache.
static struct BitMap * ami_bitmap_get_palettemapped(struct bitmap *bitmap, int width, int height, struct BitMap *friendbm)
void amiga_bitmap_set_opaque(void *bitmap, bool opaque)
Sets whether a bitmap should be plotted opaque.
static bool guigfx_warned
Object * ami_datatype_object_from_bitmap(struct bitmap *bitmap)
void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
Set an icondata pointer.
bool amiga_bitmap_get_opaque(void *bitmap)
Gets whether a bitmap should be plotted opaque.
unsigned char * amiga_bitmap_get_buffer(void *bitmap)
Return a pointer to the pixel data in a bitmap.
void amiga_bitmap_destroy(void *bitmap)
Free a bitmap.
#define AMI_BITMAP_SCALE_ICON
#define AMI_BITMAP_FORMAT
Generic bitmap handling interface.
gui_bitmap_flags
Bitmap creation flags.
@ BITMAP_OPAQUE
image is opaque
Public content interface.
int content_get_width(struct hlcache_handle *h)
Retrieve width of content.
bool content_scaled_redraw(struct hlcache_handle *h, int width, int height, const struct redraw_context *ctx)
Redraw a content with scale set for horizontal fit.
#define NSLOG(catname, level, logmsg, args...)
void * ami_memory_clear_alloc(size_t size, UBYTE value)
#define ami_memory_itempool_create(s)
#define ami_memory_itempool_alloc(p, s)
#define ami_memory_itempool_free(p, i, s)
#define ami_memory_itempool_delete(p)
#define ami_memory_clear_free(p)
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
NetSurf URL handling (interface).
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
nsurl * nsurl_ref(nsurl *url)
Increment the reference count to a NetSurf URL object.
struct nsurl nsurl
NetSurf URL object.
void FreeSysObject(ULONG type, APTR obj)
Minimal compatibility header for AmigaOS 3.
#define AllocSysObjectTags(A, B, C, D)
#define SaveDTObjectA(O, W, R, F, M, I, A)
void ami_rtg_writepixelarray(UBYTE *pixdata, struct BitMap *bm, ULONG width, ULONG height, ULONG bpr, ULONG format)
void ami_rtg_freebitmap(struct BitMap *bm)
struct BitMap * ami_rtg_allocbitmap(ULONG width, ULONG height, ULONG depth, ULONG flags, struct BitMap *friend, RGBFTYPE format)
Abstract RTG functions for newer/older/non-P96 systems.
Interface to utility string handling.
RISC OS wimp toolkit bitmap.
int height
height of bitmap
bool opaque
Whether the bitmap is opaque.
struct ExtMemIFace * iextmem
Content which corresponds to a single URL.
void *(* create)(int width, int height, enum gui_bitmap_flags flags)
Create a new bitmap.
bool interactive
Redraw to show interactive features.
Option reading and saving interface.
#define nsoption_int(OPTION)
Get the value of an integer option.
#define nsoption_bool(OPTION)
Get the value of a boolean option.
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
static nserror bitmap(const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags)
Plot a bitmap.