mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 20:16:54 +03:00
Add favicon to iconification icon
svn path=/trunk/netsurf/; revision=12995
This commit is contained in:
parent
443dce6e80
commit
39b490d1f0
@ -192,8 +192,7 @@ void ami_drag_save(struct Window *win)
|
||||
save_complete(c,path);
|
||||
SetComment(path, nsurl_access(content_get_url(c)));
|
||||
}
|
||||
ami_superimpose_favicon(path,
|
||||
drag_save_gui->favicon, NULL);
|
||||
amiga_icon_superimpose_favicon(path, drag_save_gui->favicon, NULL);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1619,6 +1619,8 @@ void ami_handle_msg(void)
|
||||
bm = urldb_get_thumbnail(nsurl_access(content_get_url(gwin->bw->current_content)));
|
||||
if(!bm) bm = content_get_bitmap(gwin->bw->current_content);
|
||||
gwin->dobj = amiga_icon_from_bitmap(bm);
|
||||
amiga_icon_superimpose_favicon_internal(gwin->bw->window->favicon,
|
||||
gwin->dobj);
|
||||
HideWindow(gwin->win);
|
||||
gwin->appicon = AddAppIcon((ULONG)gwin->objects[OID_MAIN], 0,
|
||||
gwin->win->Title, appport, 0,
|
||||
|
99
amiga/icon.c
99
amiga/icon.c
@ -360,7 +360,65 @@ ULONG *amiga_icon_convertcolouricon32(UBYTE *icondata, ULONG width, ULONG height
|
||||
|
||||
}
|
||||
|
||||
void ami_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type)
|
||||
void amiga_icon_superimpose_favicon_internal(struct hlcache_handle *icon, struct DiskObject *dobj)
|
||||
{
|
||||
struct BitMap *bm = NULL;
|
||||
ULONG *icondata1, *icondata2;
|
||||
ULONG width, height;
|
||||
long format = 0;
|
||||
int err = 0;
|
||||
|
||||
if(dobj == NULL) return;
|
||||
|
||||
err = IconControl(dobj,
|
||||
ICONCTRLA_GetImageDataFormat,&format,
|
||||
ICONCTRLA_GetImageData1,&icondata1,
|
||||
ICONCTRLA_GetImageData2,&icondata2,
|
||||
ICONCTRLA_GetWidth,&width,
|
||||
ICONCTRLA_GetHeight,&height,
|
||||
TAG_DONE);
|
||||
|
||||
if(format != IDFMT_DIRECTMAPPED) return;
|
||||
{
|
||||
if ((icon != NULL) && (content_get_bitmap(icon) != NULL))
|
||||
{
|
||||
bm = ami_getcachenativebm(content_get_bitmap(icon), 16, 16, NULL);
|
||||
}
|
||||
|
||||
if(bm)
|
||||
{
|
||||
BltBitMapTags(BLITA_SrcX, 0,
|
||||
BLITA_SrcY, 0,
|
||||
BLITA_DestX, width - 16,
|
||||
BLITA_DestY, height - 16,
|
||||
BLITA_Width, 16,
|
||||
BLITA_Height, 16,
|
||||
BLITA_Source, bm,
|
||||
BLITA_Dest, icondata1,
|
||||
BLITA_SrcType, BLITT_BITMAP,
|
||||
BLITA_DestType, BLITT_ARGB32,
|
||||
BLITA_DestBytesPerRow, width * 4,
|
||||
BLITA_UseSrcAlpha, TRUE,
|
||||
TAG_DONE);
|
||||
|
||||
BltBitMapTags(BLITA_SrcX, 0,
|
||||
BLITA_SrcY, 0,
|
||||
BLITA_DestX, width - 16,
|
||||
BLITA_DestY, height - 16,
|
||||
BLITA_Width, 16,
|
||||
BLITA_Height, 16,
|
||||
BLITA_Source, bm,
|
||||
BLITA_Dest, icondata2,
|
||||
BLITA_SrcType, BLITT_BITMAP,
|
||||
BLITA_DestType, BLITT_ARGB32,
|
||||
BLITA_DestBytesPerRow, width * 4,
|
||||
BLITA_UseSrcAlpha, TRUE,
|
||||
TAG_DONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void amiga_icon_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type)
|
||||
{
|
||||
struct DiskObject *dobj = NULL;
|
||||
struct BitMap *bm = NULL;
|
||||
@ -421,43 +479,7 @@ void ami_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type
|
||||
}
|
||||
|
||||
if((format == IDFMT_DIRECTMAPPED) || (format == IDFMT_PALETTEMAPPED))
|
||||
{
|
||||
if ((icon != NULL) && (content_get_bitmap(icon) != NULL))
|
||||
{
|
||||
bm = ami_getcachenativebm(content_get_bitmap(icon), 16, 16, NULL);
|
||||
}
|
||||
|
||||
if(bm)
|
||||
{
|
||||
BltBitMapTags(BLITA_SrcX, 0,
|
||||
BLITA_SrcY, 0,
|
||||
BLITA_DestX, width - 16,
|
||||
BLITA_DestY, height - 16,
|
||||
BLITA_Width, 16,
|
||||
BLITA_Height, 16,
|
||||
BLITA_Source, bm,
|
||||
BLITA_Dest, icondata1,
|
||||
BLITA_SrcType, BLITT_BITMAP,
|
||||
BLITA_DestType, BLITT_ARGB32,
|
||||
BLITA_DestBytesPerRow, width * 4,
|
||||
BLITA_UseSrcAlpha, TRUE,
|
||||
TAG_DONE);
|
||||
|
||||
BltBitMapTags(BLITA_SrcX, 0,
|
||||
BLITA_SrcY, 0,
|
||||
BLITA_DestX, width - 16,
|
||||
BLITA_DestY, height - 16,
|
||||
BLITA_Width, 16,
|
||||
BLITA_Height, 16,
|
||||
BLITA_Source, bm,
|
||||
BLITA_Dest, icondata2,
|
||||
BLITA_SrcType, BLITT_BITMAP,
|
||||
BLITA_DestType, BLITT_ARGB32,
|
||||
BLITA_DestBytesPerRow, width * 4,
|
||||
BLITA_UseSrcAlpha, TRUE,
|
||||
TAG_DONE);
|
||||
}
|
||||
}
|
||||
amiga_icon_superimpose_favicon_internal(icon, dobj);
|
||||
|
||||
PutIconTags(path, dobj,
|
||||
ICONPUTA_NotifyWorkbench, TRUE, TAG_DONE);
|
||||
@ -470,7 +492,6 @@ void ami_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type
|
||||
FreeVec(icondata1);
|
||||
FreeVec(icondata2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
|
||||
|
@ -40,7 +40,8 @@ void amiga_icon_fini(void);
|
||||
|
||||
struct hlcache_handle;
|
||||
|
||||
void ami_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type);
|
||||
void amiga_icon_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type);
|
||||
void amiga_icon_superimpose_favicon_internal(struct hlcache_handle *icon, struct DiskObject *dobj);
|
||||
struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm);
|
||||
void amiga_icon_free(struct DiskObject *dobj);
|
||||
#endif
|
||||
|
@ -581,7 +581,7 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
|
||||
UnLock(lock);
|
||||
save_complete(gwin->bw->current_content,fname);
|
||||
SetComment(fname,nsurl_access(content_get_url(gwin->bw->current_content)));
|
||||
ami_superimpose_favicon(fname,
|
||||
amiga_icon_superimpose_favicon(fname,
|
||||
gwin->bw->window->favicon, NULL);
|
||||
}
|
||||
}
|
||||
@ -603,7 +603,7 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
|
||||
if(save_as_pdf(gwin->bw->current_content,fname))
|
||||
{
|
||||
SetComment(fname, nsurl_access(content_get_url(gwin->bw->current_content)));
|
||||
ami_superimpose_favicon(fname,
|
||||
amiga_icon_superimpose_favicon(fname,
|
||||
gwin->bw->window->favicon, "pdf");
|
||||
}
|
||||
ami_update_pointer(gwin->win,GUI_POINTER_DEFAULT);
|
||||
|
Loading…
Reference in New Issue
Block a user