Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/0c32cbb7cb942a3c5845064701f04dc5b413dfad
...commit
http://git.netsurf-browser.org/netsurf.git/commit/0c32cbb7cb942a3c5845064701f04dc5b413dfad
...tree
http://git.netsurf-browser.org/netsurf.git/tree/0c32cbb7cb942a3c5845064701f04dc5b413dfad
The branch, master has been updated
via 0c32cbb7cb942a3c5845064701f04dc5b413dfad (commit)
via 184348dada5ca68c0765c54061fef76408d4ed6c (commit)
via 76d1758d7f51d071be9c09b55e50c6ee82ed8afc (commit)
via e38f4d2f1a2211ed03ac6418c460931194fa2870 (commit)
via 593ec1fbeab32d598bc4cc5de42bb0887ad0d520 (commit)
via 075e9c0258bd75307a90b3e6bd576742bf212b08 (commit)
from edaa9c29f22a550ddc7c8e1f02ff6d9dedf9a5b1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=0c32cbb7cb942a3c5845064701f04dc5b413dfad
commit 0c32cbb7cb942a3c5845064701f04dc5b413dfad
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>
Try to ensure we get the correct type of native BitMap
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 24471c3..533b416 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -703,11 +703,11 @@ static inline struct BitMap
*ami_bitmap_get_palettemapped(struct bitmap *bitmap,
}
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
- int width, int height, struct BitMap *friendbm)
+ int width, int height, bool palette_mapped,
struct BitMap *friendbm)
{
if(bitmap == NULL) return NULL;
- if(__builtin_expect(ami_plot_screen_is_palettemapped() == true, 0)) {
+ if(__builtin_expect(palette_mapped == true, 0)) {
return ami_bitmap_get_palettemapped(bitmap, width, height,
friendbm);
} else {
return ami_bitmap_get_truecolour(bitmap, width, height,
friendbm);
diff --git a/frontends/amiga/bitmap.h b/frontends/amiga/bitmap.h
index 056953f..17939d7 100755
--- a/frontends/amiga/bitmap.h
+++ b/frontends/amiga/bitmap.h
@@ -34,7 +34,7 @@ struct nsurl;
struct gui_globals;
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
- int width, int height, struct BitMap *friendbm);
+ int width, int height, bool palette_mapped,
struct BitMap *friendbm);
PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
int height, struct BitMap *n_bm);
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index eb6be4c..e8a13d7 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -1810,7 +1810,7 @@ static void gui_window_set_icon(struct gui_window *g,
struct hlcache_handle *ico
if ((icon != NULL) && ((icon_bitmap = content_get_bitmap(icon)) !=
NULL))
{
- bm = ami_bitmap_get_native(icon_bitmap, 16, 16,
+ bm = ami_bitmap_get_native(icon_bitmap, 16, 16,
ami_plot_screen_is_palettemapped(),
g->shared->win->RPort->BitMap);
}
@@ -5135,7 +5135,7 @@ static nserror gui_search_web_provider_update(const char
*provider_name,
if(nsoption_bool(kiosk_mode) == true) return NSERROR_BAD_PARAMETER;
if (ico_bitmap != NULL) {
- bm = ami_bitmap_get_native(ico_bitmap, 16, 16, NULL);
+ bm = ami_bitmap_get_native(ico_bitmap, 16, 16,
ami_plot_screen_is_palettemapped(), NULL);
}
if(bm == NULL) return NSERROR_BAD_PARAMETER;
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index a92b867..6521854 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -385,7 +385,7 @@ void amiga_icon_superimpose_favicon_internal(struct
hlcache_handle *icon, struct
if(format != IDFMT_DIRECTMAPPED) return;
#ifdef __amigaos4__
if ((icon != NULL) && (content_get_bitmap(icon) != NULL)) {
- bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16,
NULL);
+ bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16,
false, NULL);
}
if(bm) {
@@ -506,7 +506,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
if(bm)
{
bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
-
THUMBNAIL_HEIGHT, NULL);
+
THUMBNAIL_HEIGHT, false, NULL);
icondata = malloc(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT);
ami_bitmap_set_icondata(bm, icondata);
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 0b41dea..8a88917 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -451,7 +451,7 @@ ami_bitmap(struct gui_globals *glob, int x, int y, int
width, int height, struct
return NSERROR_OK;
}
- tbm = ami_bitmap_get_native(bitmap, width, height, glob->rp->BitMap);
+ tbm = ami_bitmap_get_native(bitmap, width, height,
glob->palette_mapped, glob->rp->BitMap);
if (!tbm) {
return NSERROR_OK;
}
@@ -1051,7 +1051,7 @@ ami_bitmap_tile(const struct redraw_context *ctx,
return NSERROR_OK;
}
- tbm = ami_bitmap_get_native(bitmap, width, height, glob->rp->BitMap);
+ tbm = ami_bitmap_get_native(bitmap, width, height,
glob->palette_mapped, glob->rp->BitMap);
if (!tbm) {
return NSERROR_OK;
}
diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c
index 496fc54..5e4be07 100644
--- a/frontends/amiga/theme.c
+++ b/frontends/amiga/theme.c
@@ -47,6 +47,7 @@
#include "amiga/gui.h"
#include "amiga/drag.h"
#include "amiga/bitmap.h"
+#include "amiga/plotters.h"
#include "amiga/schedule.h"
#include "amiga/theme.h"
#include "amiga/misc.h"
@@ -179,7 +180,8 @@ void ami_theme_throbber_setup(void)
if(throbber_update_interval == 0) throbber_update_interval = 250;
bm = ami_bitmap_from_datatype(throbberfile);
- throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm),
bitmap_get_height(bm), NULL);
+ throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm),
bitmap_get_height(bm),
+ ami_plot_screen_is_palettemapped(), NULL);
throbber_nsbm = bm;
}
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=184348dada5ca68c0765c54061fef76408d4ed6c
commit 184348dada5ca68c0765c54061fef76408d4ed6c
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>
Remove direct_render, only ever used for debugging
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index a82482c..eb6be4c 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -4828,7 +4828,6 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
ULONG hcurrent,vcurrent,xoffset,yoffset,width=800,height=600;
struct IBox *bbox;
ULONG oldh = gwin->oldh, oldv=gwin->oldv;
- struct RastPort *temprp;
if(browser_window_redraw_ready(gwin->gw->bw) == false) return;
@@ -4897,7 +4896,6 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
}
else
{
- struct rect clip;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
@@ -4905,33 +4903,8 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
.priv = browserglob
};
- if(nsoption_bool(direct_render) == false)
- {
- ami_do_redraw_tiled(gwin, true, hcurrent, vcurrent,
width, height, hcurrent, vcurrent, bbox, &ctx);
- }
- else
- {
-#if 0
-/**FIXME: this is broken, only exists for debugging */
- ami_plot_ra_set_pen_list(browserglob,
gwin->shared_pens);
- temprp = browserglob->rp;
- browserglob->rp = gwin->win->RPort;
- clip.x0 = bbox->Left;
- clip.y0 = bbox->Top;
- clip.x1 = bbox->Left + bbox->Width;
- clip.y1 = bbox->Top + bbox->Height;
-
- ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
-
- if(browser_window_redraw(gwin->gw->bw, clip.x0 -
hcurrent, clip.y0 - vcurrent, &clip, &ctx))
- {
- ami_clearclipreg(browserglob);
- browserglob->rp = temprp;
- }
-
- ami_reset_pointer(gwin);
-#endif
- }
+ ami_do_redraw_tiled(gwin, true, hcurrent, vcurrent, width,
height, hcurrent, vcurrent, bbox, &ctx);
+
/* Tell NetSurf not to bother with the next queued box redraw,
as we've redrawn everything. */
ami_gui_window_update_box_deferred(gwin->gw, false);
}
diff --git a/frontends/amiga/options.h b/frontends/amiga/options.h
index b5b2b3b..a2cc92e 100644
--- a/frontends/amiga/options.h
+++ b/frontends/amiga/options.h
@@ -79,7 +79,6 @@ NSOPTION_INTEGER(cookies_window_ypos, 0)
NSOPTION_INTEGER(cookies_window_xsize, 0)
NSOPTION_INTEGER(cookies_window_ysize, 0)
NSOPTION_INTEGER(web_search_width, 0)
-NSOPTION_BOOL(direct_render, false)
NSOPTION_BOOL(window_simple_refresh, false)
NSOPTION_BOOL(resize_with_contents, false)
NSOPTION_INTEGER(reformat_delay, 0)
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index cc48fc4..0b41dea 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -460,8 +460,7 @@ ami_bitmap(struct gui_globals *glob, int x, int y, int
width, int height, struct
#ifdef __amigaos4__
if (__builtin_expect((GfxBase->LibNode.lib_Version >= 53) &&
- (glob->palette_mapped == false) &&
- (nsoption_bool(direct_render) == false), 1)) {
+ (glob->palette_mapped == false), 1)) {
uint32 comptype = COMPOSITE_Src_Over_Dest;
uint32 compflags = COMPFLAG_IgnoreDestAlpha;
if(amiga_bitmap_get_opaque(bitmap)) {
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=76d1758d7f51d071be9c09b55e50c6ee82ed8afc
commit 76d1758d7f51d071be9c09b55e50c6ee82ed8afc
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>
Make gui_globals less... global
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 5fc5c37..84861e0 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -47,6 +47,7 @@
#include "netsurf/plot_style.h"
#include <proto/exec.h>
+#include <proto/graphics.h>
#include <proto/intuition.h>
#include <proto/layout.h>
#include <proto/utility.h>
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index a8a1265..a82482c 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -4911,6 +4911,8 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
}
else
{
+#if 0
+/**FIXME: this is broken, only exists for debugging */
ami_plot_ra_set_pen_list(browserglob,
gwin->shared_pens);
temprp = browserglob->rp;
browserglob->rp = gwin->win->RPort;
@@ -4928,6 +4930,7 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
}
ami_reset_pointer(gwin);
+#endif
}
/* Tell NetSurf not to bother with the next queued box redraw,
as we've redrawn everything. */
ami_gui_window_update_box_deferred(gwin->gw, false);
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 34d6b03..368557d 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -109,7 +109,7 @@ static void ami_history_redraw(struct history_window *hw)
ami_clearclipreg(hw->gg);
ami_history_update_extent(hw);
- BltBitMapRastPort(hw->gg->bm, 0, 0, hw->win->RPort,
+ BltBitMapRastPort(ami_plot_ra_get_bitmap(hw->gg), 0, 0, hw->win->RPort,
bbox->Left, bbox->Top, bbox->Width,
bbox->Height, 0x0C0);
ami_gui_free_space_box(bbox);
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 0f00bc4..cc48fc4 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -20,6 +20,8 @@
#include <proto/exec.h>
#include <proto/intuition.h>
+#include <proto/layers.h>
+#include <proto/graphics.h>
#include <intuition/intuition.h>
#include <graphics/rpattr.h>
@@ -82,6 +84,24 @@ struct bez_point {
float y;
};
+struct gui_globals {
+ struct BitMap *bm;
+ struct RastPort *rp;
+ struct Layer_Info *layerinfo;
+ APTR areabuf;
+ APTR tmprasbuf;
+ struct Rectangle rect;
+ struct MinList *shared_pens;
+ bool managed_pen_list;
+ bool palette_mapped;
+ ULONG apen;
+ ULONG open;
+ LONG apen_num;
+ LONG open_num;
+ int width; /* size of bm and */
+ int height; /* associated memory */
+};
+
static int init_layers_count = 0;
static APTR pool_pens = NULL;
static bool palette_mapped = true; /* palette-mapped state for the screen */
@@ -260,6 +280,11 @@ void ami_plot_ra_free(struct gui_globals *gg)
free(gg);
}
+struct RastPort *ami_plot_ra_get_rastport(struct gui_globals *gg)
+{
+ return gg->rp;
+}
+
struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg)
{
return gg->bm;
diff --git a/frontends/amiga/plotters.h b/frontends/amiga/plotters.h
index ed89916..9425923 100644
--- a/frontends/amiga/plotters.h
+++ b/frontends/amiga/plotters.h
@@ -20,29 +20,9 @@
#define AMIGA_PLOTTERS_H
#include "netsurf/plotters.h"
-#include <proto/layers.h>
-#include <proto/graphics.h>
struct IBox;
-
-struct gui_globals
-{
- struct BitMap *bm;
- struct RastPort *rp;
- struct Layer_Info *layerinfo;
- APTR areabuf;
- APTR tmprasbuf;
- struct Rectangle rect;
- struct MinList *shared_pens;
- bool managed_pen_list;
- bool palette_mapped;
- ULONG apen;
- ULONG open;
- LONG apen_num;
- LONG open_num;
- int width; /* size of bm and */
- int height; /* associated memory */
-};
+struct gui_globals;
extern const struct plotter_table amiplot;
@@ -70,6 +50,13 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG
height, bool force32bit
void ami_plot_ra_free(struct gui_globals *gg);
/**
+ * Get RastPort associated with a render area
+ * \param gg render area
+ * \returns pointer to render area BitMap
+ */
+struct RastPort *ami_plot_ra_get_rastport(struct gui_globals *gg);
+
+/**
* Get a drawing BitMap associated with a render area
* \param gg render area
* \returns pointer to render area BitMap
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 13ffc5b..8c85654 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -495,12 +495,10 @@ struct MsgPort *ami_print_get_msgport(void)
bool ami_print_begin(struct print_settings *ps)
{
- ami_print_info.gg = calloc(1, sizeof(struct gui_globals));
- if(!ami_print_info.gg) return false;
-
ami_print_info.gg = ami_plot_ra_alloc(ami_print_info.PED->ped_MaxXDots,
ami_print_info.PED->ped_MaxYDots,
true, false);
+ if(!ami_print_info.gg) return false;
ami_print_info.page = 0;
@@ -538,7 +536,7 @@ bool ami_print_dump(void)
ami_print_info.PReq->io_Command = PRD_DUMPRPORT;
ami_print_info.PReq->io_Flags = 0;
ami_print_info.PReq->io_Error = 0;
- ami_print_info.PReq->io_RastPort = ami_print_info.gg->rp;
+ ami_print_info.PReq->io_RastPort =
ami_plot_ra_get_rastport(ami_print_info.gg);
ami_print_info.PReq->io_ColorMap = NULL;
ami_print_info.PReq->io_Modes = 0;
ami_print_info.PReq->io_SrcX = 0;
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=e38f4d2f1a2211ed03ac6418c460931194fa2870
commit e38f4d2f1a2211ed03ac6418c460931194fa2870
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>
Get render bitmap size via function
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index e629345..5fc5c37 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -219,8 +219,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
struct IBox *bbox;
ULONG pos_x, pos_y;
struct rect draw_rect;
- int tile_size_x = ami_cw->gg->width;
- int tile_size_y = ami_cw->gg->height;
+ int tile_size_x;
+ int tile_size_y;
int tile_x, tile_y, tile_w, tile_h;
int x = r->x0;
int y = r->y0;
@@ -254,6 +254,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
y = pos_y;
}
+ ami_plot_ra_get_size(ami_cw->gg, &tile_size_x, &tile_size_y);
+
for(tile_y = y; tile_y < (y + height); tile_y += tile_size_y) {
tile_h = tile_size_y;
if(((y + height) - tile_y) < tile_size_y)
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 973f4e7..a8a1265 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -3524,8 +3524,10 @@ static void ami_do_redraw_tiled(struct gui_window_2
*gwin, bool busy,
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
int x, y;
struct rect clip;
- int tile_size_x = glob->width;
- int tile_size_y = glob->height;
+ int tile_size_x;
+ int tile_size_y;
+
+ ami_plot_ra_get_size(glob, &tile_size_x, &tile_size_y);
int tile_x_scale = (int)(tile_size_x / gwin->gw->scale);
int tile_y_scale = (int)(tile_size_y / gwin->gw->scale);
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index e70a9a9..0f00bc4 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -265,6 +265,12 @@ struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals
*gg)
return gg->bm;
}
+void ami_plot_ra_get_size(struct gui_globals *gg, int *width, int *height)
+{
+ *width = gg->width;
+ *height = gg->height;
+}
+
void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList *pen_list)
{
gg->shared_pens = pen_list;
diff --git a/frontends/amiga/plotters.h b/frontends/amiga/plotters.h
index 4d2dc66..ed89916 100644
--- a/frontends/amiga/plotters.h
+++ b/frontends/amiga/plotters.h
@@ -77,6 +77,14 @@ void ami_plot_ra_free(struct gui_globals *gg);
struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg);
/**
+ * Get size of BitMap associated with a render area
+ * \param gg render area
+ * \param width updated to BitMap width
+ * \param height updated to BitMap height
+ */
+void ami_plot_ra_get_size(struct gui_globals *gg, int *width, int *height);
+
+/**
* Set a list of shared pens for a render area to use
* Only relevant for palette-mapped screens
* \param gg render area
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=593ec1fbeab32d598bc4cc5de42bb0887ad0d520
commit 593ec1fbeab32d598bc4cc5de42bb0887ad0d520
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>
Manage shared pens internally unless we need multiple lists (eg. per
browser_window)
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 31448d6..24471c3 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -733,7 +733,7 @@ static nserror bitmap_render(struct bitmap *bitmap, struct
hlcache_handle *conte
plot_height = ((plot_width * bitmap->height) + (bitmap->width / 2)) /
bitmap->width;
- bm_globals = ami_plot_ra_alloc(bitmap->width, bitmap->height, true);
+ bm_globals = ami_plot_ra_alloc(bitmap->width, bitmap->height, true,
false);
ami_clearclipreg(bm_globals);
struct redraw_context ctx = {
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 0c85baf..e629345 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -915,8 +915,7 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
ami_cw->dragging = false;
/* allocate drawing area etc */
- ami_cw->gg = ami_plot_ra_alloc(100, 100, false); // force tiles to save
memory
- ami_cw->gg->shared_pens = ami_AllocMinList();
+ ami_cw->gg = ami_plot_ra_alloc(100, 100, false, true); // force tiles
to save memory
ami_cw->deferred_rects = NewObjList();
ami_cw->deferred_rects_pool = ami_memory_itempool_create(sizeof(struct
rect));
@@ -986,7 +985,6 @@ nserror ami_corewindow_fini(struct ami_corewindow *ami_cw)
#endif
/* release off-screen bitmap stuff */
- ami_plot_release_pens(ami_cw->gg->shared_pens);
ami_plot_ra_free(ami_cw->gg);
/* free the window title */
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index e6f23ab..973f4e7 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -885,7 +885,7 @@ static void ami_openscreen(void)
static void ami_openscreenfirst(void)
{
ami_openscreen();
- if(browserglob == NULL) browserglob = ami_plot_ra_alloc(0, 0, false);
+ if(browserglob == NULL) browserglob = ami_plot_ra_alloc(0, 0, false,
false);
ami_theme_throbber_setup();
}
@@ -3530,7 +3530,7 @@ static void ami_do_redraw_tiled(struct gui_window_2
*gwin, bool busy,
int tile_x_scale = (int)(tile_size_x / gwin->gw->scale);
int tile_y_scale = (int)(tile_size_y / gwin->gw->scale);
- glob->shared_pens = gwin->shared_pens; /* do we need this?? */
+ ami_plot_ra_set_pen_list(glob, gwin->shared_pens);
if(top < 0) {
height += top;
@@ -4909,7 +4909,7 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
}
else
{
- browserglob->shared_pens = gwin->shared_pens;
+ ami_plot_ra_set_pen_list(browserglob,
gwin->shared_pens);
temprp = browserglob->rp;
browserglob->rp = gwin->win->RPort;
clip.x0 = bbox->Left;
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 8ebfc7e..34d6b03 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -132,7 +132,7 @@ void ami_history_open(struct gui_window *gw)
if(!gw->hw)
{
gw->hw = calloc(1, sizeof(struct history_window));
- gw->hw->gg = ami_plot_ra_alloc(scrn->Width, scrn->Height,
false);
+ gw->hw->gg = ami_plot_ra_alloc(scrn->Width, scrn->Height,
false, true);
gw->hw->gw = gw;
browser_window_history_size(gw->bw, &width, &height);
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 1911b7d..e70a9a9 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -102,7 +102,7 @@ static bool palette_mapped = true; /* palette-mapped state
for the screen */
/* Define the below to get additional debug */
#undef AMI_PLOTTER_DEBUG
-struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool
force32bit)
+struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool
force32bit, bool alloc_pen_list)
{
/* init shared bitmaps */
int depth = 32;
@@ -201,15 +201,24 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG
height, bool force32bit
InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height);
- if((gg->palette_mapped == true) && (pool_pens == NULL)) {
- pool_pens = ami_memory_itempool_create(sizeof(struct
ami_plot_pen));
+ gg->shared_pens = NULL;
+ gg->managed_pen_list = false;
+
+ if(gg->palette_mapped == true) {
+ if(pool_pens == NULL) {
+ pool_pens = ami_memory_itempool_create(sizeof(struct
ami_plot_pen));
+ }
+
+ if(alloc_pen_list == true) {
+ gg->shared_pens = ami_AllocMinList();
+ gg->managed_pen_list = true;
+ }
}
gg->apen = 0x00000000;
gg->open = 0x00000000;
gg->apen_num = -1;
gg->open_num = -1;
- gg->shared_pens = NULL;
init_layers_count++;
LOG("Layer initialised (total: %d)", init_layers_count);
@@ -242,6 +251,12 @@ void ami_plot_ra_free(struct gui_globals *gg)
if(gg->bm) FreeBitMap(gg->bm);
}
+ if(gg->managed_pen_list == true) {
+ ami_plot_release_pens(gg->shared_pens);
+ free(gg->shared_pens);
+ gg->shared_pens = NULL;
+ }
+
free(gg);
}
@@ -250,6 +265,11 @@ struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals
*gg)
return gg->bm;
}
+void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList *pen_list)
+{
+ gg->shared_pens = pen_list;
+}
+
void ami_clearclipreg(struct gui_globals *gg)
{
struct Region *reg = NULL;
@@ -261,6 +281,11 @@ void ami_clearclipreg(struct gui_globals *gg)
gg->rect.MinY = 0;
gg->rect.MaxX = scrn->Width-1;
gg->rect.MaxY = scrn->Height-1;
+
+ gg->apen = 0x00000000;
+ gg->open = 0x00000000;
+ gg->apen_num = -1;
+ gg->open_num = -1;
}
static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr)
diff --git a/frontends/amiga/plotters.h b/frontends/amiga/plotters.h
index c82208f..4d2dc66 100644
--- a/frontends/amiga/plotters.h
+++ b/frontends/amiga/plotters.h
@@ -34,6 +34,7 @@ struct gui_globals
APTR tmprasbuf;
struct Rectangle rect;
struct MinList *shared_pens;
+ bool managed_pen_list;
bool palette_mapped;
ULONG apen;
ULONG open;
@@ -50,8 +51,38 @@ void ami_plot_clear_bbox(struct RastPort *rp, struct IBox
*bbox);
void ami_plot_release_pens(struct MinList *shared_pens);
bool ami_plot_screen_is_palettemapped(void);
-struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool
force32bit);
+/* Plotter render area management */
+
+/**
+ * Alloc a plotter render area
+ * \param width of render bitmap
+ * \param height of render bitmap
+ * \param force32bit allocate a 32-bit bitmap even if this does not match the
screen
+ * \param alloc_pen_list set to false to use own pen list (eg. if multiple pen
lists will be required)
+ * \returns pointer to render area
+ */
+struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool
force32bit, bool alloc_pen_list);
+
+/**
+ * Free a plotter render area
+ * \param gg render area to free
+ */
void ami_plot_ra_free(struct gui_globals *gg);
+
+/**
+ * Get a drawing BitMap associated with a render area
+ * \param gg render area
+ * \returns pointer to render area BitMap
+ */
struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg);
+/**
+ * Set a list of shared pens for a render area to use
+ * Only relevant for palette-mapped screens
+ * \param gg render area
+ * \param pen_list allocated by ami_AllocMinList()
+ */
+void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList
*pen_list);
+
#endif
+
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 23f8ead..13ffc5b 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -500,7 +500,7 @@ bool ami_print_begin(struct print_settings *ps)
ami_print_info.gg = ami_plot_ra_alloc(ami_print_info.PED->ped_MaxXDots,
ami_print_info.PED->ped_MaxYDots,
- true);
+ true, false);
ami_print_info.page = 0;
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=075e9c0258bd75307a90b3e6bd576742bf212b08
commit 075e9c0258bd75307a90b3e6bd576742bf212b08
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>
Alloc gui_global structure when initialising
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 95e99aa..31448d6 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -727,29 +727,29 @@ static nserror bitmap_render(struct bitmap *bitmap,
struct hlcache_handle *conte
int plot_width;
int plot_height;
- struct gui_globals bm_globals;
+ struct gui_globals *bm_globals;
+
+ plot_width = MIN(content_get_width(content), bitmap->width);
+ plot_height = ((plot_width * bitmap->height) + (bitmap->width / 2)) /
+ bitmap->width;
+
+ bm_globals = ami_plot_ra_alloc(bitmap->width, bitmap->height, true);
+ ami_clearclipreg(bm_globals);
struct redraw_context ctx = {
.interactive = false,
.background_images = true,
.plot = &amiplot,
- .priv = &bm_globals
+ .priv = bm_globals
};
- plot_width = MIN(content_get_width(content), bitmap->width);
- plot_height = ((plot_width * bitmap->height) + (bitmap->width / 2)) /
- bitmap->width;
-
- ami_init_layers(&bm_globals, bitmap->width, bitmap->height, true);
- ami_clearclipreg(&bm_globals);
-
content_scaled_redraw(content, plot_width, plot_height, &ctx);
BltBitMapTags( BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_Width, bitmap->width,
BLITA_Height, bitmap->height,
- BLITA_Source, bm_globals.bm,
+ BLITA_Source,
ami_plot_ra_get_bitmap(bm_globals),
BLITA_SrcType, BLITT_BITMAP,
BLITA_Dest,
amiga_bitmap_get_buffer(bitmap),
BLITA_DestType, BLITT_ARGB32,
@@ -763,7 +763,7 @@ static nserror bitmap_render(struct bitmap *bitmap, struct
hlcache_handle *conte
/**\todo In theory we should be able to move the bitmap to our native
area
to try to avoid re-conversion (at the expense of memory) */
- ami_free_layers(&bm_globals);
+ ami_plot_ra_free(bm_globals);
amiga_bitmap_set_opaque(bitmap, true);
#else
#warning FIXME for OS3 (in current state none of bitmap_render can work!)
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 15b0a6e..0c85baf 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -219,8 +219,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
struct IBox *bbox;
ULONG pos_x, pos_y;
struct rect draw_rect;
- int tile_size_x = ami_cw->gg.width;
- int tile_size_y = ami_cw->gg.height;
+ int tile_size_x = ami_cw->gg->width;
+ int tile_size_y = ami_cw->gg->height;
int tile_x, tile_y, tile_w, tile_h;
int x = r->x0;
int y = r->y0;
@@ -231,7 +231,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
.interactive = true,
.background_images = true,
.plot = &amiplot,
- .priv = &ami_cw->gg
+ .priv = ami_cw->gg
};
if(ami_gui_get_space_box((Object *)ami_cw->objects[GID_CW_DRAW], &bbox)
!= NSERROR_OK) {
@@ -273,7 +273,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
#ifdef __amigaos4__
BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
- BLITA_Source, ami_cw->gg.bm,
+ BLITA_Source,
ami_plot_ra_get_bitmap(ami_cw->gg),
BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_DestType, BLITT_RASTPORT,
@@ -284,7 +284,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
BLITA_Height, tile_h,
TAG_DONE);
#else
- BltBitMapRastPort(ami_cw->gg.bm, 0, 0,
+ BltBitMapRastPort(ami_plot_ra_get_bitmap(ami_cw->gg),
0, 0,
ami_cw->win->RPort, bbox->Left + tile_x
- pos_x, bbox->Top + tile_y - pos_y,
tile_w, tile_h, 0xC0);
#endif
@@ -292,7 +292,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
}
ami_gui_free_space_box(bbox);
- ami_clearclipreg(&ami_cw->gg);
+ ami_clearclipreg(ami_cw->gg);
}
@@ -915,8 +915,8 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
ami_cw->dragging = false;
/* allocate drawing area etc */
- ami_init_layers(&ami_cw->gg, 100, 100, false); // force tiles to save
memory
- ami_cw->gg.shared_pens = ami_AllocMinList();
+ ami_cw->gg = ami_plot_ra_alloc(100, 100, false); // force tiles to save
memory
+ ami_cw->gg->shared_pens = ami_AllocMinList();
ami_cw->deferred_rects = NewObjList();
ami_cw->deferred_rects_pool = ami_memory_itempool_create(sizeof(struct
rect));
@@ -986,8 +986,8 @@ nserror ami_corewindow_fini(struct ami_corewindow *ami_cw)
#endif
/* release off-screen bitmap stuff */
- ami_plot_release_pens(ami_cw->gg.shared_pens);
- ami_free_layers(&ami_cw->gg);
+ ami_plot_release_pens(ami_cw->gg->shared_pens);
+ ami_plot_ra_free(ami_cw->gg);
/* free the window title */
ami_utf8_free(ami_cw->wintitle);
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index cfcd7fc..cc4fe4a 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -76,7 +76,7 @@ struct ami_corewindow {
char *wintitle;
/** stuff for our off-screen render bitmap */
- struct gui_globals gg;
+ struct gui_globals *gg;
struct MinList *shared_pens;
/** drag status set by core */
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index a18d4d5..e6f23ab 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -202,7 +202,7 @@ static BOOL locked_screen = FALSE;
static int screen_signal = -1;
static bool win_destroyed;
static STRPTR nsscreentitle;
-static struct gui_globals browserglob;
+static struct gui_globals *browserglob = NULL;
static struct MsgPort *applibport = NULL;
static uint32 ami_appid = 0;
@@ -885,7 +885,7 @@ static void ami_openscreen(void)
static void ami_openscreenfirst(void)
{
ami_openscreen();
- if(!browserglob.bm) ami_init_layers(&browserglob, 0, 0, false);
+ if(browserglob == NULL) browserglob = ami_plot_ra_alloc(0, 0, false);
ami_theme_throbber_setup();
}
@@ -3040,7 +3040,7 @@ static void gui_quit(void)
#endif
ami_arexx_cleanup();
- ami_free_layers(&browserglob);
+ ami_plot_ra_free(browserglob);
ami_font_fini();
ami_help_free();
@@ -3530,7 +3530,7 @@ static void ami_do_redraw_tiled(struct gui_window_2
*gwin, bool busy,
int tile_x_scale = (int)(tile_size_x / gwin->gw->scale);
int tile_y_scale = (int)(tile_size_y / gwin->gw->scale);
- browserglob.shared_pens = gwin->shared_pens; /* do we need this?? */
+ glob->shared_pens = gwin->shared_pens; /* do we need this?? */
if(top < 0) {
height += top;
@@ -3581,10 +3581,10 @@ static void ami_do_redraw_tiled(struct gui_window_2
*gwin, bool busy,
clip.y0 - (int)y,
&clip, ctx))
{
- ami_clearclipreg(&browserglob);
+ ami_clearclipreg(glob);
#ifdef __amigaos4__
BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
- BLITA_Source, browserglob.bm,
+ BLITA_Source,
ami_plot_ra_get_bitmap(glob),
BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_DestType, BLITT_RASTPORT,
@@ -3595,7 +3595,7 @@ static void ami_do_redraw_tiled(struct gui_window_2
*gwin, bool busy,
BLITA_Height, (int)(clip.y1),
TAG_DONE);
#else
- BltBitMapRastPort(browserglob.bm, 0, 0,
gwin->win->RPort,
+ BltBitMapRastPort(ami_plot_ra_get_bitmap(glob),
0, 0, gwin->win->RPort,
bbox->Left + (int)((x - sx) *
gwin->gw->scale),
bbox->Top + (int)((y - sy) *
gwin->gw->scale),
(int)(clip.x1), (int)(clip.y1), 0xC0);
@@ -3630,7 +3630,7 @@ static void ami_do_redraw_limits(struct gui_window *g,
struct browser_window *bw
.interactive = true,
.background_images = true,
.plot = &amiplot,
- .priv = &browserglob
+ .priv = browserglob
};
if(!g) return;
@@ -4900,7 +4900,7 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
.interactive = true,
.background_images = true,
.plot = &amiplot,
- .priv = &browserglob
+ .priv = browserglob
};
if(nsoption_bool(direct_render) == false)
@@ -4909,9 +4909,9 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
}
else
{
- browserglob.shared_pens = gwin->shared_pens;
- temprp = browserglob.rp;
- browserglob.rp = gwin->win->RPort;
+ browserglob->shared_pens = gwin->shared_pens;
+ temprp = browserglob->rp;
+ browserglob->rp = gwin->win->RPort;
clip.x0 = bbox->Left;
clip.y0 = bbox->Top;
clip.x1 = bbox->Left + bbox->Width;
@@ -4921,8 +4921,8 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
if(browser_window_redraw(gwin->gw->bw, clip.x0 -
hcurrent, clip.y0 - vcurrent, &clip, &ctx))
{
- ami_clearclipreg(&browserglob);
- browserglob.rp = temprp;
+ ami_clearclipreg(browserglob);
+ browserglob->rp = temprp;
}
ami_reset_pointer(gwin);
@@ -5273,7 +5273,7 @@ static void gui_window_new_content(struct gui_window *g)
c = browser_window_get_content(g->bw);
else return;
- ami_clearclipreg(&browserglob);
+ ami_clearclipreg(browserglob);
g->shared->new_content = true;
g->scrollx = 0;
g->scrolly = 0;
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 8cce869..8ebfc7e 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -132,9 +132,7 @@ void ami_history_open(struct gui_window *gw)
if(!gw->hw)
{
gw->hw = calloc(1, sizeof(struct history_window));
- gw->hw->gg = calloc(1, sizeof(struct gui_globals));
-
- ami_init_layers(gw->hw->gg, scrn->Width, scrn->Height, false);
+ gw->hw->gg = ami_plot_ra_alloc(scrn->Width, scrn->Height,
false);
gw->hw->gw = gw;
browser_window_history_size(gw->bw, &width, &height);
@@ -239,8 +237,7 @@ static bool ami_history_click(struct history_window *hw,
uint16 code)
void ami_history_close(struct history_window *hw)
{
- ami_free_layers(hw->gg);
- free(hw->gg);
+ ami_plot_ra_free(hw->gg);
hw->gw->hw = NULL;
DisposeObject(hw->objects[OID_MAIN]);
ami_gui_win_list_remove(hw);
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 0eea2ed..1911b7d 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -102,15 +102,14 @@ static bool palette_mapped = true; /* palette-mapped
state for the screen */
/* Define the below to get additional debug */
#undef AMI_PLOTTER_DEBUG
-void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool
force32bit)
+struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool
force32bit)
{
- /* init shared bitmaps *
- * Height is set to screen width to give enough space for thumbnails *
- * Also applies to the further gfx/layers functions and memory below */
-
- int depth = 32;
+ /* init shared bitmaps */
+ int depth = 32;
struct BitMap *friend = NULL;
+ struct gui_globals *gg = malloc(sizeof(struct gui_globals));
+
if(force32bit == false) depth = GetBitMapAttr(scrn->RastPort.BitMap,
BMA_DEPTH);
LOG("Screen depth = %d", depth);
@@ -214,9 +213,11 @@ void ami_init_layers(struct gui_globals *gg, ULONG width,
ULONG height, bool for
init_layers_count++;
LOG("Layer initialised (total: %d)", init_layers_count);
+
+ return gg;
}
-void ami_free_layers(struct gui_globals *gg)
+void ami_plot_ra_free(struct gui_globals *gg)
{
init_layers_count--;
@@ -240,6 +241,13 @@ void ami_free_layers(struct gui_globals *gg)
} else {
if(gg->bm) FreeBitMap(gg->bm);
}
+
+ free(gg);
+}
+
+struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg)
+{
+ return gg->bm;
}
void ami_clearclipreg(struct gui_globals *gg)
diff --git a/frontends/amiga/plotters.h b/frontends/amiga/plotters.h
index b92cdd4..c82208f 100644
--- a/frontends/amiga/plotters.h
+++ b/frontends/amiga/plotters.h
@@ -45,11 +45,13 @@ struct gui_globals
extern const struct plotter_table amiplot;
-void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool
force32bit);
-void ami_free_layers(struct gui_globals *gg);
void ami_clearclipreg(struct gui_globals *gg);
void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox);
void ami_plot_release_pens(struct MinList *shared_pens);
bool ami_plot_screen_is_palettemapped(void);
+struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool
force32bit);
+void ami_plot_ra_free(struct gui_globals *gg);
+struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg);
+
#endif
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 60a84e1..23f8ead 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -498,8 +498,7 @@ bool ami_print_begin(struct print_settings *ps)
ami_print_info.gg = calloc(1, sizeof(struct gui_globals));
if(!ami_print_info.gg) return false;
- ami_init_layers(ami_print_info.gg,
- ami_print_info.PED->ped_MaxXDots,
+ ami_print_info.gg = ami_plot_ra_alloc(ami_print_info.PED->ped_MaxXDots,
ami_print_info.PED->ped_MaxYDots,
true);
@@ -521,8 +520,7 @@ bool ami_print_next_page(void)
void ami_print_end(void)
{
- ami_free_layers(ami_print_info.gg);
- free(ami_print_info.gg);
+ ami_plot_ra_free(ami_print_info.gg);
DisposeObject(ami_print_info.objects[OID_MAIN]);
ami_print_close_device();
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/bitmap.c | 26 +++++------
frontends/amiga/bitmap.h | 2 +-
frontends/amiga/corewindow.c | 21 ++++-----
frontends/amiga/corewindow.h | 2 +-
frontends/amiga/gui.c | 56 ++++++++----------------
frontends/amiga/history_local.c | 9 ++--
frontends/amiga/icon.c | 4 +-
frontends/amiga/options.h | 1 -
frontends/amiga/plotters.c | 91 +++++++++++++++++++++++++++++++++------
frontends/amiga/plotters.h | 72 +++++++++++++++++++++----------
frontends/amiga/print.c | 14 +++---
frontends/amiga/theme.c | 4 +-
12 files changed, 183 insertions(+), 119 deletions(-)
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 95e99aa..533b416 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -703,11 +703,11 @@ static inline struct BitMap
*ami_bitmap_get_palettemapped(struct bitmap *bitmap,
}
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
- int width, int height, struct BitMap *friendbm)
+ int width, int height, bool palette_mapped,
struct BitMap *friendbm)
{
if(bitmap == NULL) return NULL;
- if(__builtin_expect(ami_plot_screen_is_palettemapped() == true, 0)) {
+ if(__builtin_expect(palette_mapped == true, 0)) {
return ami_bitmap_get_palettemapped(bitmap, width, height,
friendbm);
} else {
return ami_bitmap_get_truecolour(bitmap, width, height,
friendbm);
@@ -727,29 +727,29 @@ static nserror bitmap_render(struct bitmap *bitmap,
struct hlcache_handle *conte
int plot_width;
int plot_height;
- struct gui_globals bm_globals;
+ struct gui_globals *bm_globals;
+
+ plot_width = MIN(content_get_width(content), bitmap->width);
+ plot_height = ((plot_width * bitmap->height) + (bitmap->width / 2)) /
+ bitmap->width;
+
+ bm_globals = ami_plot_ra_alloc(bitmap->width, bitmap->height, true,
false);
+ ami_clearclipreg(bm_globals);
struct redraw_context ctx = {
.interactive = false,
.background_images = true,
.plot = &amiplot,
- .priv = &bm_globals
+ .priv = bm_globals
};
- plot_width = MIN(content_get_width(content), bitmap->width);
- plot_height = ((plot_width * bitmap->height) + (bitmap->width / 2)) /
- bitmap->width;
-
- ami_init_layers(&bm_globals, bitmap->width, bitmap->height, true);
- ami_clearclipreg(&bm_globals);
-
content_scaled_redraw(content, plot_width, plot_height, &ctx);
BltBitMapTags( BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_Width, bitmap->width,
BLITA_Height, bitmap->height,
- BLITA_Source, bm_globals.bm,
+ BLITA_Source,
ami_plot_ra_get_bitmap(bm_globals),
BLITA_SrcType, BLITT_BITMAP,
BLITA_Dest,
amiga_bitmap_get_buffer(bitmap),
BLITA_DestType, BLITT_ARGB32,
@@ -763,7 +763,7 @@ static nserror bitmap_render(struct bitmap *bitmap, struct
hlcache_handle *conte
/**\todo In theory we should be able to move the bitmap to our native
area
to try to avoid re-conversion (at the expense of memory) */
- ami_free_layers(&bm_globals);
+ ami_plot_ra_free(bm_globals);
amiga_bitmap_set_opaque(bitmap, true);
#else
#warning FIXME for OS3 (in current state none of bitmap_render can work!)
diff --git a/frontends/amiga/bitmap.h b/frontends/amiga/bitmap.h
index 056953f..17939d7 100755
--- a/frontends/amiga/bitmap.h
+++ b/frontends/amiga/bitmap.h
@@ -34,7 +34,7 @@ struct nsurl;
struct gui_globals;
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
- int width, int height, struct BitMap *friendbm);
+ int width, int height, bool palette_mapped,
struct BitMap *friendbm);
PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
int height, struct BitMap *n_bm);
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 15b0a6e..84861e0 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -47,6 +47,7 @@
#include "netsurf/plot_style.h"
#include <proto/exec.h>
+#include <proto/graphics.h>
#include <proto/intuition.h>
#include <proto/layout.h>
#include <proto/utility.h>
@@ -219,8 +220,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
struct IBox *bbox;
ULONG pos_x, pos_y;
struct rect draw_rect;
- int tile_size_x = ami_cw->gg.width;
- int tile_size_y = ami_cw->gg.height;
+ int tile_size_x;
+ int tile_size_y;
int tile_x, tile_y, tile_w, tile_h;
int x = r->x0;
int y = r->y0;
@@ -231,7 +232,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
.interactive = true,
.background_images = true,
.plot = &amiplot,
- .priv = &ami_cw->gg
+ .priv = ami_cw->gg
};
if(ami_gui_get_space_box((Object *)ami_cw->objects[GID_CW_DRAW], &bbox)
!= NSERROR_OK) {
@@ -254,6 +255,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
y = pos_y;
}
+ ami_plot_ra_get_size(ami_cw->gg, &tile_size_x, &tile_size_y);
+
for(tile_y = y; tile_y < (y + height); tile_y += tile_size_y) {
tile_h = tile_size_y;
if(((y + height) - tile_y) < tile_size_y)
@@ -273,7 +276,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
#ifdef __amigaos4__
BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
- BLITA_Source, ami_cw->gg.bm,
+ BLITA_Source,
ami_plot_ra_get_bitmap(ami_cw->gg),
BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_DestType, BLITT_RASTPORT,
@@ -284,7 +287,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
BLITA_Height, tile_h,
TAG_DONE);
#else
- BltBitMapRastPort(ami_cw->gg.bm, 0, 0,
+ BltBitMapRastPort(ami_plot_ra_get_bitmap(ami_cw->gg),
0, 0,
ami_cw->win->RPort, bbox->Left + tile_x
- pos_x, bbox->Top + tile_y - pos_y,
tile_w, tile_h, 0xC0);
#endif
@@ -292,7 +295,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct
rect *r)
}
ami_gui_free_space_box(bbox);
- ami_clearclipreg(&ami_cw->gg);
+ ami_clearclipreg(ami_cw->gg);
}
@@ -915,8 +918,7 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
ami_cw->dragging = false;
/* allocate drawing area etc */
- ami_init_layers(&ami_cw->gg, 100, 100, false); // force tiles to save
memory
- ami_cw->gg.shared_pens = ami_AllocMinList();
+ ami_cw->gg = ami_plot_ra_alloc(100, 100, false, true); // force tiles
to save memory
ami_cw->deferred_rects = NewObjList();
ami_cw->deferred_rects_pool = ami_memory_itempool_create(sizeof(struct
rect));
@@ -986,8 +988,7 @@ nserror ami_corewindow_fini(struct ami_corewindow *ami_cw)
#endif
/* release off-screen bitmap stuff */
- ami_plot_release_pens(ami_cw->gg.shared_pens);
- ami_free_layers(&ami_cw->gg);
+ ami_plot_ra_free(ami_cw->gg);
/* free the window title */
ami_utf8_free(ami_cw->wintitle);
diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h
index cfcd7fc..cc4fe4a 100644
--- a/frontends/amiga/corewindow.h
+++ b/frontends/amiga/corewindow.h
@@ -76,7 +76,7 @@ struct ami_corewindow {
char *wintitle;
/** stuff for our off-screen render bitmap */
- struct gui_globals gg;
+ struct gui_globals *gg;
struct MinList *shared_pens;
/** drag status set by core */
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index a18d4d5..e8a13d7 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -202,7 +202,7 @@ static BOOL locked_screen = FALSE;
static int screen_signal = -1;
static bool win_destroyed;
static STRPTR nsscreentitle;
-static struct gui_globals browserglob;
+static struct gui_globals *browserglob = NULL;
static struct MsgPort *applibport = NULL;
static uint32 ami_appid = 0;
@@ -885,7 +885,7 @@ static void ami_openscreen(void)
static void ami_openscreenfirst(void)
{
ami_openscreen();
- if(!browserglob.bm) ami_init_layers(&browserglob, 0, 0, false);
+ if(browserglob == NULL) browserglob = ami_plot_ra_alloc(0, 0, false,
false);
ami_theme_throbber_setup();
}
@@ -1810,7 +1810,7 @@ static void gui_window_set_icon(struct gui_window *g,
struct hlcache_handle *ico
if ((icon != NULL) && ((icon_bitmap = content_get_bitmap(icon)) !=
NULL))
{
- bm = ami_bitmap_get_native(icon_bitmap, 16, 16,
+ bm = ami_bitmap_get_native(icon_bitmap, 16, 16,
ami_plot_screen_is_palettemapped(),
g->shared->win->RPort->BitMap);
}
@@ -3040,7 +3040,7 @@ static void gui_quit(void)
#endif
ami_arexx_cleanup();
- ami_free_layers(&browserglob);
+ ami_plot_ra_free(browserglob);
ami_font_fini();
ami_help_free();
@@ -3524,13 +3524,15 @@ static void ami_do_redraw_tiled(struct gui_window_2
*gwin, bool busy,
struct gui_globals *glob = (struct gui_globals *)ctx->priv;
int x, y;
struct rect clip;
- int tile_size_x = glob->width;
- int tile_size_y = glob->height;
+ int tile_size_x;
+ int tile_size_y;
+
+ ami_plot_ra_get_size(glob, &tile_size_x, &tile_size_y);
int tile_x_scale = (int)(tile_size_x / gwin->gw->scale);
int tile_y_scale = (int)(tile_size_y / gwin->gw->scale);
- browserglob.shared_pens = gwin->shared_pens; /* do we need this?? */
+ ami_plot_ra_set_pen_list(glob, gwin->shared_pens);
if(top < 0) {
height += top;
@@ -3581,10 +3583,10 @@ static void ami_do_redraw_tiled(struct gui_window_2
*gwin, bool busy,
clip.y0 - (int)y,
&clip, ctx))
{
- ami_clearclipreg(&browserglob);
+ ami_clearclipreg(glob);
#ifdef __amigaos4__
BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
- BLITA_Source, browserglob.bm,
+ BLITA_Source,
ami_plot_ra_get_bitmap(glob),
BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_DestType, BLITT_RASTPORT,
@@ -3595,7 +3597,7 @@ static void ami_do_redraw_tiled(struct gui_window_2
*gwin, bool busy,
BLITA_Height, (int)(clip.y1),
TAG_DONE);
#else
- BltBitMapRastPort(browserglob.bm, 0, 0,
gwin->win->RPort,
+ BltBitMapRastPort(ami_plot_ra_get_bitmap(glob),
0, 0, gwin->win->RPort,
bbox->Left + (int)((x - sx) *
gwin->gw->scale),
bbox->Top + (int)((y - sy) *
gwin->gw->scale),
(int)(clip.x1), (int)(clip.y1), 0xC0);
@@ -3630,7 +3632,7 @@ static void ami_do_redraw_limits(struct gui_window *g,
struct browser_window *bw
.interactive = true,
.background_images = true,
.plot = &amiplot,
- .priv = &browserglob
+ .priv = browserglob
};
if(!g) return;
@@ -4826,7 +4828,6 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
ULONG hcurrent,vcurrent,xoffset,yoffset,width=800,height=600;
struct IBox *bbox;
ULONG oldh = gwin->oldh, oldv=gwin->oldv;
- struct RastPort *temprp;
if(browser_window_redraw_ready(gwin->gw->bw) == false) return;
@@ -4895,38 +4896,15 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
}
else
{
- struct rect clip;
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
.plot = &amiplot,
- .priv = &browserglob
+ .priv = browserglob
};
- if(nsoption_bool(direct_render) == false)
- {
- ami_do_redraw_tiled(gwin, true, hcurrent, vcurrent,
width, height, hcurrent, vcurrent, bbox, &ctx);
- }
- else
- {
- browserglob.shared_pens = gwin->shared_pens;
- temprp = browserglob.rp;
- browserglob.rp = gwin->win->RPort;
- clip.x0 = bbox->Left;
- clip.y0 = bbox->Top;
- clip.x1 = bbox->Left + bbox->Width;
- clip.y1 = bbox->Top + bbox->Height;
-
- ami_set_pointer(gwin, GUI_POINTER_WAIT, false);
+ ami_do_redraw_tiled(gwin, true, hcurrent, vcurrent, width,
height, hcurrent, vcurrent, bbox, &ctx);
- if(browser_window_redraw(gwin->gw->bw, clip.x0 -
hcurrent, clip.y0 - vcurrent, &clip, &ctx))
- {
- ami_clearclipreg(&browserglob);
- browserglob.rp = temprp;
- }
-
- ami_reset_pointer(gwin);
- }
/* Tell NetSurf not to bother with the next queued box redraw,
as we've redrawn everything. */
ami_gui_window_update_box_deferred(gwin->gw, false);
}
@@ -5157,7 +5135,7 @@ static nserror gui_search_web_provider_update(const char
*provider_name,
if(nsoption_bool(kiosk_mode) == true) return NSERROR_BAD_PARAMETER;
if (ico_bitmap != NULL) {
- bm = ami_bitmap_get_native(ico_bitmap, 16, 16, NULL);
+ bm = ami_bitmap_get_native(ico_bitmap, 16, 16,
ami_plot_screen_is_palettemapped(), NULL);
}
if(bm == NULL) return NSERROR_BAD_PARAMETER;
@@ -5273,7 +5251,7 @@ static void gui_window_new_content(struct gui_window *g)
c = browser_window_get_content(g->bw);
else return;
- ami_clearclipreg(&browserglob);
+ ami_clearclipreg(browserglob);
g->shared->new_content = true;
g->scrollx = 0;
g->scrolly = 0;
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 8cce869..368557d 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -109,7 +109,7 @@ static void ami_history_redraw(struct history_window *hw)
ami_clearclipreg(hw->gg);
ami_history_update_extent(hw);
- BltBitMapRastPort(hw->gg->bm, 0, 0, hw->win->RPort,
+ BltBitMapRastPort(ami_plot_ra_get_bitmap(hw->gg), 0, 0, hw->win->RPort,
bbox->Left, bbox->Top, bbox->Width,
bbox->Height, 0x0C0);
ami_gui_free_space_box(bbox);
@@ -132,9 +132,7 @@ void ami_history_open(struct gui_window *gw)
if(!gw->hw)
{
gw->hw = calloc(1, sizeof(struct history_window));
- gw->hw->gg = calloc(1, sizeof(struct gui_globals));
-
- ami_init_layers(gw->hw->gg, scrn->Width, scrn->Height, false);
+ gw->hw->gg = ami_plot_ra_alloc(scrn->Width, scrn->Height,
false, true);
gw->hw->gw = gw;
browser_window_history_size(gw->bw, &width, &height);
@@ -239,8 +237,7 @@ static bool ami_history_click(struct history_window *hw,
uint16 code)
void ami_history_close(struct history_window *hw)
{
- ami_free_layers(hw->gg);
- free(hw->gg);
+ ami_plot_ra_free(hw->gg);
hw->gw->hw = NULL;
DisposeObject(hw->objects[OID_MAIN]);
ami_gui_win_list_remove(hw);
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index a92b867..6521854 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -385,7 +385,7 @@ void amiga_icon_superimpose_favicon_internal(struct
hlcache_handle *icon, struct
if(format != IDFMT_DIRECTMAPPED) return;
#ifdef __amigaos4__
if ((icon != NULL) && (content_get_bitmap(icon) != NULL)) {
- bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16,
NULL);
+ bm = ami_bitmap_get_native(content_get_bitmap(icon), 16, 16,
false, NULL);
}
if(bm) {
@@ -506,7 +506,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
if(bm)
{
bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
-
THUMBNAIL_HEIGHT, NULL);
+
THUMBNAIL_HEIGHT, false, NULL);
icondata = malloc(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT);
ami_bitmap_set_icondata(bm, icondata);
diff --git a/frontends/amiga/options.h b/frontends/amiga/options.h
index b5b2b3b..a2cc92e 100644
--- a/frontends/amiga/options.h
+++ b/frontends/amiga/options.h
@@ -79,7 +79,6 @@ NSOPTION_INTEGER(cookies_window_ypos, 0)
NSOPTION_INTEGER(cookies_window_xsize, 0)
NSOPTION_INTEGER(cookies_window_ysize, 0)
NSOPTION_INTEGER(web_search_width, 0)
-NSOPTION_BOOL(direct_render, false)
NSOPTION_BOOL(window_simple_refresh, false)
NSOPTION_BOOL(resize_with_contents, false)
NSOPTION_INTEGER(reformat_delay, 0)
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 0eea2ed..8a88917 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -20,6 +20,8 @@
#include <proto/exec.h>
#include <proto/intuition.h>
+#include <proto/layers.h>
+#include <proto/graphics.h>
#include <intuition/intuition.h>
#include <graphics/rpattr.h>
@@ -82,6 +84,24 @@ struct bez_point {
float y;
};
+struct gui_globals {
+ struct BitMap *bm;
+ struct RastPort *rp;
+ struct Layer_Info *layerinfo;
+ APTR areabuf;
+ APTR tmprasbuf;
+ struct Rectangle rect;
+ struct MinList *shared_pens;
+ bool managed_pen_list;
+ bool palette_mapped;
+ ULONG apen;
+ ULONG open;
+ LONG apen_num;
+ LONG open_num;
+ int width; /* size of bm and */
+ int height; /* associated memory */
+};
+
static int init_layers_count = 0;
static APTR pool_pens = NULL;
static bool palette_mapped = true; /* palette-mapped state for the screen */
@@ -102,15 +122,14 @@ static bool palette_mapped = true; /* palette-mapped
state for the screen */
/* Define the below to get additional debug */
#undef AMI_PLOTTER_DEBUG
-void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool
force32bit)
+struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool
force32bit, bool alloc_pen_list)
{
- /* init shared bitmaps *
- * Height is set to screen width to give enough space for thumbnails *
- * Also applies to the further gfx/layers functions and memory below */
-
- int depth = 32;
+ /* init shared bitmaps */
+ int depth = 32;
struct BitMap *friend = NULL;
+ struct gui_globals *gg = malloc(sizeof(struct gui_globals));
+
if(force32bit == false) depth = GetBitMapAttr(scrn->RastPort.BitMap,
BMA_DEPTH);
LOG("Screen depth = %d", depth);
@@ -202,21 +221,32 @@ void ami_init_layers(struct gui_globals *gg, ULONG width,
ULONG height, bool for
InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height);
- if((gg->palette_mapped == true) && (pool_pens == NULL)) {
- pool_pens = ami_memory_itempool_create(sizeof(struct
ami_plot_pen));
+ gg->shared_pens = NULL;
+ gg->managed_pen_list = false;
+
+ if(gg->palette_mapped == true) {
+ if(pool_pens == NULL) {
+ pool_pens = ami_memory_itempool_create(sizeof(struct
ami_plot_pen));
+ }
+
+ if(alloc_pen_list == true) {
+ gg->shared_pens = ami_AllocMinList();
+ gg->managed_pen_list = true;
+ }
}
gg->apen = 0x00000000;
gg->open = 0x00000000;
gg->apen_num = -1;
gg->open_num = -1;
- gg->shared_pens = NULL;
init_layers_count++;
LOG("Layer initialised (total: %d)", init_layers_count);
+
+ return gg;
}
-void ami_free_layers(struct gui_globals *gg)
+void ami_plot_ra_free(struct gui_globals *gg)
{
init_layers_count--;
@@ -240,6 +270,35 @@ void ami_free_layers(struct gui_globals *gg)
} else {
if(gg->bm) FreeBitMap(gg->bm);
}
+
+ if(gg->managed_pen_list == true) {
+ ami_plot_release_pens(gg->shared_pens);
+ free(gg->shared_pens);
+ gg->shared_pens = NULL;
+ }
+
+ free(gg);
+}
+
+struct RastPort *ami_plot_ra_get_rastport(struct gui_globals *gg)
+{
+ return gg->rp;
+}
+
+struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg)
+{
+ return gg->bm;
+}
+
+void ami_plot_ra_get_size(struct gui_globals *gg, int *width, int *height)
+{
+ *width = gg->width;
+ *height = gg->height;
+}
+
+void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList *pen_list)
+{
+ gg->shared_pens = pen_list;
}
void ami_clearclipreg(struct gui_globals *gg)
@@ -253,6 +312,11 @@ void ami_clearclipreg(struct gui_globals *gg)
gg->rect.MinY = 0;
gg->rect.MaxX = scrn->Width-1;
gg->rect.MaxY = scrn->Height-1;
+
+ gg->apen = 0x00000000;
+ gg->open = 0x00000000;
+ gg->apen_num = -1;
+ gg->open_num = -1;
}
static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr)
@@ -387,7 +451,7 @@ ami_bitmap(struct gui_globals *glob, int x, int y, int
width, int height, struct
return NSERROR_OK;
}
- tbm = ami_bitmap_get_native(bitmap, width, height, glob->rp->BitMap);
+ tbm = ami_bitmap_get_native(bitmap, width, height,
glob->palette_mapped, glob->rp->BitMap);
if (!tbm) {
return NSERROR_OK;
}
@@ -396,8 +460,7 @@ ami_bitmap(struct gui_globals *glob, int x, int y, int
width, int height, struct
#ifdef __amigaos4__
if (__builtin_expect((GfxBase->LibNode.lib_Version >= 53) &&
- (glob->palette_mapped == false) &&
- (nsoption_bool(direct_render) == false), 1)) {
+ (glob->palette_mapped == false), 1)) {
uint32 comptype = COMPOSITE_Src_Over_Dest;
uint32 compflags = COMPFLAG_IgnoreDestAlpha;
if(amiga_bitmap_get_opaque(bitmap)) {
@@ -988,7 +1051,7 @@ ami_bitmap_tile(const struct redraw_context *ctx,
return NSERROR_OK;
}
- tbm = ami_bitmap_get_native(bitmap, width, height, glob->rp->BitMap);
+ tbm = ami_bitmap_get_native(bitmap, width, height,
glob->palette_mapped, glob->rp->BitMap);
if (!tbm) {
return NSERROR_OK;
}
diff --git a/frontends/amiga/plotters.h b/frontends/amiga/plotters.h
index b92cdd4..9425923 100644
--- a/frontends/amiga/plotters.h
+++ b/frontends/amiga/plotters.h
@@ -20,36 +20,64 @@
#define AMIGA_PLOTTERS_H
#include "netsurf/plotters.h"
-#include <proto/layers.h>
-#include <proto/graphics.h>
struct IBox;
-
-struct gui_globals
-{
- struct BitMap *bm;
- struct RastPort *rp;
- struct Layer_Info *layerinfo;
- APTR areabuf;
- APTR tmprasbuf;
- struct Rectangle rect;
- struct MinList *shared_pens;
- bool palette_mapped;
- ULONG apen;
- ULONG open;
- LONG apen_num;
- LONG open_num;
- int width; /* size of bm and */
- int height; /* associated memory */
-};
+struct gui_globals;
extern const struct plotter_table amiplot;
-void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool
force32bit);
-void ami_free_layers(struct gui_globals *gg);
void ami_clearclipreg(struct gui_globals *gg);
void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox);
void ami_plot_release_pens(struct MinList *shared_pens);
bool ami_plot_screen_is_palettemapped(void);
+/* Plotter render area management */
+
+/**
+ * Alloc a plotter render area
+ * \param width of render bitmap
+ * \param height of render bitmap
+ * \param force32bit allocate a 32-bit bitmap even if this does not match the
screen
+ * \param alloc_pen_list set to false to use own pen list (eg. if multiple pen
lists will be required)
+ * \returns pointer to render area
+ */
+struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool
force32bit, bool alloc_pen_list);
+
+/**
+ * Free a plotter render area
+ * \param gg render area to free
+ */
+void ami_plot_ra_free(struct gui_globals *gg);
+
+/**
+ * Get RastPort associated with a render area
+ * \param gg render area
+ * \returns pointer to render area BitMap
+ */
+struct RastPort *ami_plot_ra_get_rastport(struct gui_globals *gg);
+
+/**
+ * Get a drawing BitMap associated with a render area
+ * \param gg render area
+ * \returns pointer to render area BitMap
+ */
+struct BitMap *ami_plot_ra_get_bitmap(struct gui_globals *gg);
+
+/**
+ * Get size of BitMap associated with a render area
+ * \param gg render area
+ * \param width updated to BitMap width
+ * \param height updated to BitMap height
+ */
+void ami_plot_ra_get_size(struct gui_globals *gg, int *width, int *height);
+
+/**
+ * Set a list of shared pens for a render area to use
+ * Only relevant for palette-mapped screens
+ * \param gg render area
+ * \param pen_list allocated by ami_AllocMinList()
+ */
+void ami_plot_ra_set_pen_list(struct gui_globals *gg, struct MinList
*pen_list);
+
#endif
+
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 60a84e1..8c85654 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -495,13 +495,10 @@ struct MsgPort *ami_print_get_msgport(void)
bool ami_print_begin(struct print_settings *ps)
{
- ami_print_info.gg = calloc(1, sizeof(struct gui_globals));
- if(!ami_print_info.gg) return false;
-
- ami_init_layers(ami_print_info.gg,
- ami_print_info.PED->ped_MaxXDots,
+ ami_print_info.gg = ami_plot_ra_alloc(ami_print_info.PED->ped_MaxXDots,
ami_print_info.PED->ped_MaxYDots,
- true);
+ true, false);
+ if(!ami_print_info.gg) return false;
ami_print_info.page = 0;
@@ -521,8 +518,7 @@ bool ami_print_next_page(void)
void ami_print_end(void)
{
- ami_free_layers(ami_print_info.gg);
- free(ami_print_info.gg);
+ ami_plot_ra_free(ami_print_info.gg);
DisposeObject(ami_print_info.objects[OID_MAIN]);
ami_print_close_device();
@@ -540,7 +536,7 @@ bool ami_print_dump(void)
ami_print_info.PReq->io_Command = PRD_DUMPRPORT;
ami_print_info.PReq->io_Flags = 0;
ami_print_info.PReq->io_Error = 0;
- ami_print_info.PReq->io_RastPort = ami_print_info.gg->rp;
+ ami_print_info.PReq->io_RastPort =
ami_plot_ra_get_rastport(ami_print_info.gg);
ami_print_info.PReq->io_ColorMap = NULL;
ami_print_info.PReq->io_Modes = 0;
ami_print_info.PReq->io_SrcX = 0;
diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c
index 496fc54..5e4be07 100644
--- a/frontends/amiga/theme.c
+++ b/frontends/amiga/theme.c
@@ -47,6 +47,7 @@
#include "amiga/gui.h"
#include "amiga/drag.h"
#include "amiga/bitmap.h"
+#include "amiga/plotters.h"
#include "amiga/schedule.h"
#include "amiga/theme.h"
#include "amiga/misc.h"
@@ -179,7 +180,8 @@ void ami_theme_throbber_setup(void)
if(throbber_update_interval == 0) throbber_update_interval = 250;
bm = ami_bitmap_from_datatype(throbberfile);
- throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm),
bitmap_get_height(bm), NULL);
+ throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm),
bitmap_get_height(bm),
+ ami_plot_screen_is_palettemapped(), NULL);
throbber_nsbm = bm;
}
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org