summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2016-01-25 00:01:55 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2016-01-25 00:01:55 +0000
commitc0d031bf735559ad1d49ce4d3773ef4788f5a096 (patch)
treeba668180e6705fd6d82782834ae67d1871454a7e
parent452d8ce5127f60f0d54a504f6fb9fba1846f058f (diff)
downloadnetsurf-c0d031bf735559ad1d49ce4d3773ef4788f5a096.tar.gz
netsurf-c0d031bf735559ad1d49ce4d3773ef4788f5a096.tar.bz2
Make the palette-mapped state relate to the rendering layer rather than globally.
This means we can still render in 32-bit mode internally when the destination isn't the screen. NB: bitmap_render is currently freezing when the screen is in palette-mapped mode (old bug, pre-dates this change), so for now we skip this routine in that scenario.
-rw-r--r--amiga/bitmap.c20
-rw-r--r--amiga/gui.c15
-rw-r--r--amiga/gui.h2
-rwxr-xr-xamiga/history_local.c2
-rw-r--r--amiga/plotters.c34
-rw-r--r--amiga/plotters.h3
-rw-r--r--amiga/print.c3
-rw-r--r--amiga/tree.c2
8 files changed, 43 insertions, 38 deletions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index ae9479d26..dd6a91b67 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -534,11 +534,7 @@ struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
{
- int plot_width;
- int plot_height;
- struct MinList shared_pens;
- struct gui_globals bm_globals;
- struct gui_globals *temp_gg = glob;
+ if(ami_plot_screen_is_palettemapped() == true) return NSERROR_OK;
struct redraw_context ctx = {
.interactive = false,
@@ -546,13 +542,18 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
.plot = &amiplot
};
+ int plot_width;
+ int plot_height;
+ struct gui_globals bm_globals;
+ struct gui_globals *temp_gg = glob;
+// struct MinList *shared_pens = ami_AllocMinList();
+
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);
- ami_NewMinList(&shared_pens);
- bm_globals.shared_pens = &shared_pens;
+ ami_init_layers(&bm_globals, bitmap->width, bitmap->height, true);
+// bm_globals.shared_pens = shared_pens;
glob = &bm_globals;
ami_clearclipreg(&bm_globals);
@@ -582,7 +583,8 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
to try to avoid re-conversion (at the expense of memory) */
ami_free_layers(&bm_globals);
- ami_plot_release_pens(&shared_pens);
+// ami_plot_release_pens(shared_pens);
+// FreeVec(shared_pens);
amiga_bitmap_set_opaque(bitmap, true);
/* Restore previous render area. This is set when plotting starts,
diff --git a/amiga/gui.c b/amiga/gui.c
index efb825272..fab5d14d5 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -809,7 +809,7 @@ static void ami_openscreen(void)
static void ami_openscreenfirst(void)
{
ami_openscreen();
- if(!browserglob.bm) ami_init_layers(&browserglob, 0, 0);
+ if(!browserglob.bm) ami_init_layers(&browserglob, 0, 0, false);
ami_theme_throbber_setup();
}
@@ -2859,7 +2859,7 @@ void ami_switch_tab(struct gui_window_2 *gwin, bool redraw)
return;
}
- ami_plot_release_pens(&gwin->shared_pens);
+ ami_plot_release_pens(gwin->shared_pens);
ami_update_buttons(gwin);
ami_menu_update_disabled(gwin->gw, browser_window_get_content(gwin->gw->bw));
@@ -3495,7 +3495,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?? */
+ browserglob.shared_pens = gwin->shared_pens; /* do we need this?? */
if(top < 0) {
height += top;
@@ -3869,7 +3869,7 @@ gui_window_create(struct browser_window *bw,
return NULL;
}
- ami_NewMinList(&g->shared->shared_pens);
+ g->shared->shared_pens = ami_AllocMinList();
g->shared->scrollerhook.h_Entry = (void *)ami_scroller_hook;
g->shared->scrollerhook.h_Data = g->shared;
@@ -4492,7 +4492,8 @@ static void gui_window_destroy(struct gui_window *g)
return;
}
- ami_plot_release_pens(&g->shared->shared_pens);
+ ami_plot_release_pens(g->shared->shared_pens);
+ FreeVec(g->shared->shared_pens);
ami_schedule_redraw_remove(g->shared);
ami_schedule(-1, ami_gui_refresh_favicon, g->shared);
@@ -4831,7 +4832,7 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
}
else
{
- browserglob.shared_pens = &gwin->shared_pens;
+ browserglob.shared_pens = gwin->shared_pens;
temprp = browserglob.rp;
browserglob.rp = gwin->win->RPort;
clip.x0 = bbox->Left;
@@ -5202,7 +5203,7 @@ static void gui_window_new_content(struct gui_window *g)
g->shared->oldh = 0;
g->shared->oldv = 0;
g->favicon = NULL;
- ami_plot_release_pens(&g->shared->shared_pens);
+ ami_plot_release_pens(g->shared->shared_pens);
ami_menu_update_disabled(g, c);
ami_gui_update_hotlist_button(g->shared);
ami_gui_scroller_update(g->shared);
diff --git a/amiga/gui.h b/amiga/gui.h
index 436991936..38eee52bf 100644
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -138,7 +138,7 @@ struct gui_window_2 {
gui_drag_type drag_op;
struct IBox *ptr_lock;
struct AppWindow *appwin;
- struct MinList shared_pens;
+ struct MinList *shared_pens;
gui_pointer_shape mouse_pointer;
struct Menu *imenu; /* Intuition menu */
struct VisualInfo *vi; /* For GadTools menu */
diff --git a/amiga/history_local.c b/amiga/history_local.c
index 20d54386f..f11c78473 100755
--- a/amiga/history_local.c
+++ b/amiga/history_local.c
@@ -117,7 +117,7 @@ void ami_history_open(struct gui_window *gw)
{
gw->hw = ami_misc_allocvec_clear(sizeof(struct history_window), 0);
- ami_init_layers(&gw->hw->gg, scrn->Width, scrn->Height);
+ ami_init_layers(&gw->hw->gg, scrn->Width, scrn->Height, false);
gw->hw->gw = gw;
browser_window_history_size(gw->bw, &width, &height);
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 95c285c60..bb69dce24 100644
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -70,7 +70,6 @@ struct bez_point {
float y;
};
-static bool palette_mapped = false;
static int init_layers_count = 0;
static APTR pool_pens = NULL;
@@ -90,7 +89,7 @@ static APTR pool_pens = NULL;
/* Define the below to get additional debug */
#undef AMI_PLOTTER_DEBUG
-void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height)
+void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool force32bit)
{
/* init shared bitmaps *
* Height is set to screen width to give enough space for thumbnails *
@@ -99,22 +98,23 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height)
int depth = 32;
struct BitMap *friend = NULL;
- depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH);
+ if(force32bit == false) depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH);
LOG("Screen depth = %d", depth);
if(depth < 16) {
- palette_mapped = true;
+ gg->palette_mapped = true;
} else {
- palette_mapped = false;
+ gg->palette_mapped = false;
}
#ifndef __amigaos4__
#warning OS3 locked to palette-mapped modes
- palette_mapped = true;
+ gg->palette_mapped = true;
if(depth > 8) depth = 8;
#endif
- if(palette_mapped == true) nsoption_set_bool(font_antialiasing, false);
+ /* Probably need to fix this next line */
+ if(gg->palette_mapped == true) nsoption_set_bool(font_antialiasing, false);
if(!width) width = nsoption_int(redraw_tile_size_x);
if(!height) height = nsoption_int(redraw_tile_size_y);
@@ -146,7 +146,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height)
}
#endif
- if(palette_mapped == true) {
+ if(gg->palette_mapped == true) {
gg->bm = AllocBitMap(width, height, depth, 0, friend);
} else {
#ifdef __amigaos4__
@@ -184,7 +184,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height)
InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height);
- if((palette_mapped == true) && (pool_pens == NULL)) {
+ if((gg->palette_mapped == true) && (pool_pens == NULL)) {
pool_pens = ami_misc_itempool_create(sizeof(struct ami_plot_pen));
}
@@ -210,7 +210,7 @@ void ami_free_layers(struct gui_globals *gg)
FreeVec(gg->tmprasbuf);
FreeVec(gg->areabuf);
DisposeLayerInfo(gg->layerinfo);
- if(palette_mapped == false) {
+ if(gg->palette_mapped == false) {
if(gg->bm) ami_rtg_freebitmap(gg->bm);
} else {
if(gg->bm) FreeBitMap(gg->bm);
@@ -273,7 +273,7 @@ void ami_plot_release_pens(struct MinList *shared_pens)
static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
{
#ifdef __amigaos4__
- if(palette_mapped == false) {
+ if(glob->palette_mapped == false) {
SetRPAttrs(rp, RPTAG_APenColor,
ns_color_to_nscss(colr),
TAG_DONE);
@@ -288,7 +288,7 @@ static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
static void ami_plot_setopen(struct RastPort *rp, ULONG colr)
{
#ifdef __amigaos4__
- if(palette_mapped == false) {
+ if(glob->palette_mapped == false) {
SetRPAttrs(rp, RPTAG_OPenColor,
ns_color_to_nscss(colr),
TAG_DONE);
@@ -537,7 +537,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
#endif
#ifdef __amigaos4__
- if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) && (palette_mapped == false) &&
+ if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) && (glob->palette_mapped == false) &&
(nsoption_bool(direct_render) == false), 1)) {
uint32 comptype = COMPOSITE_Src_Over_Dest;
uint32 compflags = COMPFLAG_IgnoreDestAlpha;
@@ -564,7 +564,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
{
ULONG tag, tag_data, minterm = 0xc0;
- if(palette_mapped == false) {
+ if(glob->palette_mapped == false) {
tag = BLITA_UseSrcAlpha;
tag_data = !bitmap->opaque;
minterm = 0xc0;
@@ -715,7 +715,7 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage
for (yf = -bfbm->offsety; yf < msg->Bounds.MaxY; yf += bfbm->height) {
#ifdef __amigaos4__
if(__builtin_expect((GfxBase->LibNode.lib_Version >= 53) &&
- (palette_mapped == false), 1)) {
+ (glob->palette_mapped == false), 1)) {
CompositeTags(COMPOSITE_Src_Over_Dest, bfbm->bm, rp->BitMap,
COMPTAG_Flags, COMPFLAG_IgnoreDestAlpha,
COMPTAG_DestX, msg->Bounds.MinX,
@@ -734,7 +734,7 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage
{
ULONG tag, tag_data, minterm = 0xc0;
- if(palette_mapped == false) {
+ if(glob->palette_mapped == false) {
tag = BLITA_UseSrcAlpha;
tag_data = TRUE;
minterm = 0xc0;
@@ -876,7 +876,7 @@ static bool ami_path(const float *p, unsigned int n, colour fill, float width,
bool ami_plot_screen_is_palettemapped(void)
{
- return palette_mapped;
+ return glob->palette_mapped;
}
struct plotter_table plot;
diff --git a/amiga/plotters.h b/amiga/plotters.h
index 49afbe177..841700e4a 100644
--- a/amiga/plotters.h
+++ b/amiga/plotters.h
@@ -33,13 +33,14 @@ struct gui_globals
APTR tmprasbuf;
struct Rectangle rect;
struct MinList *shared_pens;
+ bool palette_mapped;
int width; /* size of bm and */
int height; /* associated memory */
};
extern const struct plotter_table amiplot;
-void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height);
+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);
diff --git a/amiga/print.c b/amiga/print.c
index 25230112f..84cca8fac 100644
--- a/amiga/print.c
+++ b/amiga/print.c
@@ -481,7 +481,8 @@ bool ami_print_begin(struct print_settings *ps)
ami_init_layers(ami_print_info.gg,
ami_print_info.PED->ped_MaxXDots,
- ami_print_info.PED->ped_MaxYDots);
+ ami_print_info.PED->ped_MaxYDots,
+ true);
ami_print_info.page = 0;
diff --git a/amiga/tree.c b/amiga/tree.c
index 8a35a4453..54082099f 100644
--- a/amiga/tree.c
+++ b/amiga/tree.c
@@ -734,7 +734,7 @@ void ami_tree_open(struct treeview_window *twin,int type)
twin->scrollerhook.h_Entry = (void *)ami_tree_scroller_hook;
twin->scrollerhook.h_Data = twin;
- ami_init_layers(&twin->globals, 0, 0);
+ ami_init_layers(&twin->globals, 0, 0, false);
ami_tree_menu(twin);
if(type == AMI_TREE_SSLCERT)