From b517cf331aeb2616e216b1a78cc20d0027b4e0b6 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 24 Feb 2012 20:00:51 +0000 Subject: option_screen_compositing to enable switching compositing for NetSurf's own screen on/off. Some experimentation with compositing and simple/smart refresh reveals that simple refresh windows with compositing on for the screen behave the same as smart refresh windows. Smart refresh windows with compositing off use more gfx memory than when compositing is on. Simple refresh windows with compositing off will probably be more memory efficient, as we are using an off-screen bitmap to render the browsing area anyway. However due to this bitmap being re-used over multiple tabs/windows, it does not always reflect what should be on the window, so performing a redraw of damaged areas may be the only option. Need to read damaged regions from layer (probably through struct Region *DamageList) and check on performance vs memory or make the window refresh type configurable. Simple refresh code #ifdefed out for now for further investigation later. svn path=/trunk/netsurf/; revision=13464 --- amiga/Makefile.target | 2 +- amiga/gui.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++---- amiga/options.h | 3 +++ 3 files changed, 66 insertions(+), 5 deletions(-) diff --git a/amiga/Makefile.target b/amiga/Makefile.target index cf3c6a9e3..aa0cef61f 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -5,7 +5,7 @@ CFLAGS += -std=c99 -I . -Dnsamiga ifneq ($(SUBTARGET),os3) - CFLAGS += -N -U__STRICT_ANSI__ -D__USE_INLINE__ -D__USE_BASETYPE__ + CFLAGS += -U__STRICT_ANSI__ -D__USE_INLINE__ -D__USE_BASETYPE__ endif NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE diff --git a/amiga/gui.c b/amiga/gui.c index b21853acb..ef013fe41 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -16,6 +16,9 @@ * along with this program. If not, see . */ +/* define this to use simple (as opposed to smart) refresh windows */ +#undef AMI_SIMPLEREFRESH + /* NetSurf core includes */ #include "content/urldb.h" #include "css/utils.h" @@ -563,6 +566,12 @@ void gui_init(int argc, char** argv) void ami_openscreen(void) { ULONG id = 0; + ULONG compositing; + + if(option_screen_compositing == -1) + compositing = ~0UL; + else compositing = option_screen_compositing; + if(!option_use_pubscreen || option_use_pubscreen[0] == '\0') { if((option_modeid) && (strncmp(option_modeid,"0x",2) == 0)) @@ -595,6 +604,7 @@ void ami_openscreen(void) SA_Type, PUBLICSCREEN, SA_PubName, "NetSurf", SA_LikeWorkbench, TRUE, + SA_Compositing, compositing, TAG_DONE); if(scrn) @@ -2527,7 +2537,6 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, gwin->shared->search_ico_hook.h_Entry = (void *)ami_set_search_ico_render_hook; gwin->shared->search_ico_hook.h_Data = gwin->shared; - if(!option_kiosk_mode) { ULONG addtabclosegadget = TAG_IGNORE; @@ -2659,13 +2668,18 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE | IDCMP_RAWKEY | IDCMP_SIZEVERIFY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE | - IDCMP_ACTIVEWINDOW | // IDCMP_INTUITICKS | - IDCMP_EXTENDEDMOUSE, +#ifdef AMI_SIMPLEREFRESH + IDCMP_REFRESHWINDOW | +#endif + IDCMP_ACTIVEWINDOW | IDCMP_EXTENDEDMOUSE, WINDOW_IconifyGadget, iconifygadget, WINDOW_NewMenu, gwin->shared->menu, WINDOW_VertProp,1, WINDOW_IDCMPHook,&gwin->shared->scrollerhook, - WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE | + WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | +#ifdef AMI_SIMPLEREFRESH + IDCMP_REFRESHWINDOW | +#endif IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY, WINDOW_AppPort, appport, WINDOW_AppWindow,TRUE, @@ -3485,6 +3499,43 @@ void ami_do_redraw(struct gui_window_2 *g) g->new_content = false; } +#if AMI_SIMPLEREFRESH +// simplerefresh only + +void ami_refresh_window(struct gui_window_2 *gwin) +{ + struct IBox *bbox; + int x0, x1, y0, y1; + + GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER], (ULONG *)&bbox); + + BeginRefresh(gwin->win); + +// probably need to trawl through struct Region *DamageList + x0 = gwin->win->RPort->Layer->bounds.MinX; + x1 = gwin->win->RPort->Layer->bounds.MaxX; + y0 = gwin->win->RPort->Layer->bounds.MinY; + y1 = gwin->win->RPort->Layer->bounds.MaxY; + + ami_do_redraw_limits(gwin->bw->window, gwin->bw, x0, y0, x1, y1); + +/* quick refresh - scuppered by shared offscreen bitmap + BltBitMapTags(BLITA_SrcType, BLITT_BITMAP, + BLITA_Source, browserglob.bm, + BLITA_SrcX, 0, + BLITA_SrcY, 0, + BLITA_DestType, BLITT_RASTPORT, + BLITA_Dest, gwin->win->RPort, + BLITA_DestX, bbox->Left, + BLITA_DestY, bbox->Top, + BLITA_Width, bbox->Width, + BLITA_Height, bbox->Height, + TAG_DONE); +*/ + EndRefresh(gwin->win, TRUE); +} +#endif + void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs) { if(gwin->objects[GID_HSCROLL]) @@ -3950,6 +4001,13 @@ void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg case IDCMP_SIZEVERIFY: break; + +#if AMI_SIMPLEREFRESH + case IDCMP_REFRESHWINDOW: +printf("refreshing\n"); + ami_refresh_window(gwin); + break; +#endif } // ReplyMsg((struct Message *)msg); } diff --git a/amiga/options.h b/amiga/options.h index bf4f1f24b..b00838e69 100644 --- a/amiga/options.h +++ b/amiga/options.h @@ -24,6 +24,7 @@ extern char *option_url_file; extern char *option_hotlist_file; extern char *option_use_pubscreen; extern char *option_modeid; +extern int option_screen_compositing; extern int option_cache_bitmaps; extern char *option_theme; extern bool option_utf8_clipboard; @@ -74,6 +75,7 @@ char *option_url_file = 0; \ char *option_hotlist_file = 0; \ char *option_use_pubscreen = 0; \ char *option_modeid = 0; \ +extern int option_screen_compositing = -1; \ int option_cache_bitmaps = 0; \ char *option_theme = 0; \ bool option_utf8_clipboard = false; \ @@ -124,6 +126,7 @@ int option_menu_refresh = 0; \ { "hotlist_file", OPTION_STRING, &option_hotlist_file }, \ { "use_pubscreen", OPTION_STRING, &option_use_pubscreen}, \ { "screen_modeid", OPTION_STRING, &option_modeid}, \ +{ "screen_compositing", OPTION_INTEGER, &option_screen_compositing}, \ { "cache_bitmaps", OPTION_INTEGER, &option_cache_bitmaps}, \ { "theme", OPTION_STRING, &option_theme}, \ { "clipboard_write_utf8", OPTION_BOOL, &option_utf8_clipboard}, \ -- cgit v1.2.3