From b53a3273c1eb192b66764e28b192d023388176ea Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 19 Dec 2009 00:39:52 +0000 Subject: Preliminary favicon support - doesn't display properly due to endian issue in libnsbmp svn path=/trunk/netsurf/; revision=9740 --- amiga/gui.c | 41 +++++++++++++++++++++++++++++++++++++++++ amiga/gui.h | 1 + 2 files changed, 42 insertions(+) (limited to 'amiga') diff --git a/amiga/gui.c b/amiga/gui.c index 5ced4ba76..0defc3f2c 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2341,6 +2341,14 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw, ButtonEnd, CHILD_WeightedWidth,0, CHILD_WeightedHeight,0, + LAYOUT_AddChild, gwin->shared->gadgets[GID_ICON] = SpaceObject, + GA_ID, GID_ICON, + SPACE_MinWidth, 16, + SPACE_MinHeight, 16, + SPACE_Transparent, TRUE, + SpaceEnd, + CHILD_WeightedWidth,0, + CHILD_WeightedHeight,0, LAYOUT_AddChild, gwin->shared->gadgets[GID_URL] = NewObject(urlStringClass, NULL, STRINGA_MaxChars, 2000, @@ -3429,6 +3437,39 @@ void gui_window_stop_throbber(struct gui_window *g) */ void gui_window_set_icon(struct gui_window *g, struct content *icon) { + struct BitMap *bm = NULL; + struct IBox *bbox; + + if ((icon != NULL) && (icon->type == CONTENT_ICO)) + { + nsico_set_bitmap_from_size(icon, 16, 16); + } + + if ((icon != NULL) && (icon->bitmap != NULL)) + { + bm = ami_getcachenativebm(icon->bitmap, 16, 16, g->shared->win->RPort->BitMap); + } + + GetAttr(SPACE_AreaBox, g->shared->gadgets[GID_ICON], (ULONG *)&bbox); + + EraseRect(g->shared->win->RPort, bbox->Left, bbox->Top, + bbox->Left+16, bbox->Top+16); + + if(bm) + { + BltBitMapTags(BLITA_SrcX, 0, + BLITA_SrcY, 0, + BLITA_DestX, bbox->Left, + BLITA_DestY, bbox->Top, + BLITA_Width, 16, + BLITA_Height, 16, + BLITA_Source, bm, + BLITA_Dest, g->shared->win->RPort, + BLITA_SrcType, BLITT_BITMAP, + BLITA_DestType, BLITT_RASTPORT, + BLITA_UseSrcAlpha, TRUE, + TAG_DONE); + } } /** diff --git a/amiga/gui.h b/amiga/gui.h index 47aace0db..b606c7f99 100755 --- a/amiga/gui.h +++ b/amiga/gui.h @@ -33,6 +33,7 @@ enum GID_BROWSER, GID_STATUS, GID_URL, + GID_ICON, GID_STOP, GID_RELOAD, GID_HOME, -- cgit v1.2.3