summaryrefslogtreecommitdiff
path: root/frontends/amiga/plotters.c
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/amiga/plotters.c')
-rw-r--r--frontends/amiga/plotters.c85
1 files changed, 52 insertions, 33 deletions
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index b8485430f..8bc1712dd 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -115,6 +115,7 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit
/* init shared bitmaps */
int depth = 32;
struct BitMap *friend = NULL;
+ struct Screen *scrn = ami_gui_get_screen();
struct gui_globals *gg = malloc(sizeof(struct gui_globals));
@@ -125,11 +126,34 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit
if(depth < 16) {
gg->palette_mapped = true;
if(force32bit == false) palette_mapped = true;
+
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = true,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian) (PMA)");
+
} else {
gg->palette_mapped = false;
- if(force32bit == false) palette_mapped = false;
+
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = false,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian)");
+
}
#else
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = true,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian) (PMA)");
+
+
/* Friend BitMaps are weird.
* For OS4, we shouldn't use a friend BitMap here (see below).
* For OS3 AGA, we get no display blitted if we use a friend BitMap,
@@ -143,16 +167,12 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit
if((depth > 8) && (force32bit == false)) friend = scrn->RastPort.BitMap;
}
- /* OS3 is locked to using palette-mapped display even on RTG.
- * To change this, comment out the below and build with the similar OS4 lines above.
- * Various bits of RTG code are OS4-only and OS3 versions will need to be written,
- * however a brief test reveals a negative performance benefit, so this lock to a
- * palette-mapped display is most likely permanent.
- */
-#warning OS3 locked to palette-mapped modes
- gg->palette_mapped = true;
- palette_mapped = true;
- if(depth > 8) depth = 8;
+ if(depth < 16) {
+ gg->palette_mapped = true;
+ if(force32bit == false) palette_mapped = true;
+ } else {
+ gg->palette_mapped = false;
+ }
#endif
/* Probably need to fix this next line */
@@ -256,11 +276,7 @@ void ami_plot_ra_free(struct gui_globals *gg)
ami_memory_chip_free(gg->tmprasbuf);
free(gg->areabuf);
DisposeLayerInfo(gg->layerinfo);
- if(gg->palette_mapped == false) {
- if(gg->bm) ami_rtg_freebitmap(gg->bm);
- } else {
- if(gg->bm) FreeBitMap(gg->bm);
- }
+ if(gg->bm) ami_rtg_freebitmap(gg->bm);
if(gg->managed_pen_list == true) {
ami_plot_release_pens(gg->shared_pens);
@@ -295,6 +311,7 @@ void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList *pen_list)
void ami_clearclipreg(struct gui_globals *gg)
{
struct Region *reg = NULL;
+ struct Screen *scrn = ami_gui_get_screen();
reg = InstallClipRegion(gg->rp->Layer,NULL);
if(reg) DisposeRegion(reg);
@@ -313,6 +330,8 @@ void ami_clearclipreg(struct gui_globals *gg)
static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr)
{
struct ami_plot_pen *node;
+ struct Screen *scrn = ami_gui_get_screen();
+
LONG pen = ObtainBestPenA(scrn->ViewPort.ColorMap,
(colr & 0x000000ff) << 24,
(colr & 0x0000ff00) << 16,
@@ -336,6 +355,7 @@ static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr)
void ami_plot_release_pens(struct MinList *shared_pens)
{
+ struct Screen *scrn = ami_gui_get_screen();
struct ami_plot_pen *node;
struct ami_plot_pen *nnode;
@@ -400,10 +420,10 @@ void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox)
static void ami_arc_gfxlib(struct RastPort *rp, int x, int y, int radius, int angle1, int angle2)
{
- double angle1_r = (double)(angle1) * (M_PI / 180.0);
- double angle2_r = (double)(angle2) * (M_PI / 180.0);
- double angle, b, c;
- double step = 0.1; //(angle2_r - angle1_r) / ((angle2_r - angle1_r) * (double)radius);
+ float angle1_r = (float)(angle1) * (M_PI / 180.0);
+ float angle2_r = (float)(angle2) * (M_PI / 180.0);
+ float angle, b, c;
+ float step = 0.1; //(angle2_r - angle1_r) / ((angle2_r - angle1_r) * (float)radius);
int x0, y0, x1, y1;
x0 = x;
@@ -412,13 +432,13 @@ static void ami_arc_gfxlib(struct RastPort *rp, int x, int y, int radius, int an
b = angle1_r;
c = angle2_r;
- x1 = (int)(cos(b) * (double)radius);
- y1 = (int)(sin(b) * (double)radius);
+ x1 = (int)(cos(b) * (float)radius);
+ y1 = (int)(sin(b) * (float)radius);
Move(rp, x0 + x1, y0 - y1);
for(angle = (b + step); angle <= c; angle += step) {
- x1 = (int)(cos(angle) * (double)radius);
- y1 = (int)(sin(angle) * (double)radius);
+ x1 = (int)(cos(angle) * (float)radius);
+ y1 = (int)(sin(angle) * (float)radius);
Draw(rp, x0 + x1, y0 - y1);
}
}
@@ -429,7 +449,7 @@ static nserror
ami_bitmap(struct gui_globals *glob, int x, int y, int width, int height, struct bitmap *bitmap)
{
NSLOG(plot, DEEPDEBUG, "[ami_plotter] Entered ami_bitmap()");
-
+ struct Screen *scrn = ami_gui_get_screen();
struct BitMap *tbm;
if (!width || !height) {
@@ -519,6 +539,7 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage
{
int xf,yf;
struct bfbitmap *bfbm = (struct bfbitmap *)hook->h_Data;
+ struct Screen *scrn = ami_gui_get_screen();
/* tile down and across to extents (msg->Bounds.MinX)*/
for (xf = -bfbm->offsetx; xf < msg->Bounds.MaxX; xf += bfbm->width) {
@@ -580,7 +601,7 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage
static void ami_bezier(struct bez_point *restrict a, struct bez_point *restrict b,
struct bez_point *restrict c, struct bez_point *restrict d,
- double t, struct bez_point *restrict p) {
+ float t, struct bez_point *restrict p) {
p->x = pow((1 - t), 3) * a->x + 3 * t * pow((1 -t), 2) * b->x + 3 * (1-t) * pow(t, 2)* c->x + pow (t, 3)* d->x;
p->y = pow((1 - t), 3) * a->y + 3 * t * pow((1 -t), 2) * b->y + 3 * (1-t) * pow(t, 2)* c->y + pow (t, 3)* d->y;
}
@@ -722,8 +743,8 @@ ami_line(const struct redraw_context *ctx,
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
- glob->rp->PenWidth = style->stroke_width;
- glob->rp->PenHeight = style->stroke_width;
+ glob->rp->PenWidth = plot_style_fixed_to_int(style->stroke_width);
+ glob->rp->PenHeight = plot_style_fixed_to_int(style->stroke_width);
switch (style->stroke_type) {
case PLOT_OP_TYPE_SOLID: /**< Solid colour */
@@ -780,8 +801,8 @@ ami_rectangle(const struct redraw_context *ctx,
}
if (style->stroke_type != PLOT_OP_TYPE_NONE) {
- glob->rp->PenWidth = style->stroke_width;
- glob->rp->PenHeight = style->stroke_width;
+ glob->rp->PenWidth = plot_style_fixed_to_int(style->stroke_width);
+ glob->rp->PenHeight = plot_style_fixed_to_int(style->stroke_width);
switch (style->stroke_type) {
case PLOT_OP_TYPE_SOLID: /**< Solid colour */
@@ -868,7 +889,6 @@ ami_polygon(const struct redraw_context *ctx,
* \param pstyle Style controlling the path plot.
* \param p elements of path
* \param n nunber of elements on path
- * \param width The width of the path
* \param transform A transform to apply to the path.
* \return NSERROR_OK on success else error code.
*/
@@ -877,7 +897,6 @@ ami_path(const struct redraw_context *ctx,
const plot_style_t *pstyle,
const float *p,
unsigned int n,
- float width,
const float transform[6])
{
unsigned int i;
@@ -955,7 +974,7 @@ ami_path(const struct redraw_context *ctx,
p_c.x = p[i+5];
p_c.y = p[i+6];
- for (double t = 0.0; t <= 1.0; t += 0.1) {
+ for (float t = 0.0; t <= 1.0; t += 0.1) {
ami_bezier(&cur_p, &p_a, &p_b, &p_c, t, &p_r);
if (pstyle->fill_colour != NS_TRANSPARENT) {
if (AreaDraw(glob->rp, p_r.x, p_r.y) == -1) {