2010-10-31 14:14:26 +03:00
|
|
|
/*
|
2010-10-30 18:23:38 +04:00
|
|
|
* Copyright 2010 Chris Young <chris@unsatisfactorysoftware.co.uk>
|
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Content for image/x-amiga-icon (icon.library implementation).
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "utils/config.h"
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2010-10-31 14:14:26 +03:00
|
|
|
#include <proto/exec.h>
|
2010-10-30 18:23:38 +04:00
|
|
|
#include <proto/icon.h>
|
|
|
|
|
2010-10-31 14:14:26 +03:00
|
|
|
#include <datatypes/pictureclass.h>
|
2011-01-07 02:17:17 +03:00
|
|
|
#ifdef __amigaos4__
|
2010-10-31 14:14:26 +03:00
|
|
|
#include <graphics/blitattr.h>
|
2011-01-07 02:17:17 +03:00
|
|
|
#endif
|
2010-10-30 18:23:38 +04:00
|
|
|
#include <workbench/icon.h>
|
|
|
|
|
2011-01-09 02:00:33 +03:00
|
|
|
#include "amiga/os3support.h"
|
2010-10-31 14:14:26 +03:00
|
|
|
#include "amiga/bitmap.h"
|
|
|
|
#include "amiga/icon.h"
|
2010-10-30 18:23:38 +04:00
|
|
|
#include "desktop/plotters.h"
|
|
|
|
#include "image/bitmap.h"
|
|
|
|
#include "content/content_protected.h"
|
|
|
|
#include "utils/log.h"
|
|
|
|
#include "utils/messages.h"
|
2011-05-07 00:40:09 +04:00
|
|
|
#include "utils/talloc.h"
|
2010-10-30 18:23:38 +04:00
|
|
|
#include "utils/utils.h"
|
|
|
|
#include "utils/url.h"
|
|
|
|
|
2010-10-31 14:14:26 +03:00
|
|
|
ULONG *amiga_icon_convertcolouricon32(UBYTE *icondata, ULONG width, ULONG height,
|
|
|
|
ULONG trans, ULONG pals1, struct ColorRegister *pal1, int alpha);
|
|
|
|
|
|
|
|
#ifdef WITH_AMIGA_ICON
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
typedef struct amiga_icon_content {
|
|
|
|
struct content base;
|
|
|
|
} amiga_icon_content;
|
|
|
|
|
|
|
|
static nserror amiga_icon_create(const content_handler *handler,
|
|
|
|
lwc_string *imime_type, const http_parameter *params,
|
|
|
|
llcache_handle *llcache, const char *fallback_charset,
|
|
|
|
bool quirks, struct content **c);
|
|
|
|
static bool amiga_icon_convert(struct content *c);
|
|
|
|
static void amiga_icon_destroy(struct content *c);
|
|
|
|
static bool amiga_icon_redraw(struct content *c, int x, int y,
|
|
|
|
int width, int height, const struct rect *clip,
|
2011-05-09 02:18:28 +04:00
|
|
|
float scale, colour background_colour,
|
|
|
|
bool repeat_x, bool repeat_y);
|
2011-05-07 00:40:09 +04:00
|
|
|
static nserror amiga_icon_clone(const struct content *old,
|
|
|
|
struct content **newc);
|
|
|
|
static content_type amiga_icon_content_type(lwc_string *mime_type);
|
|
|
|
|
|
|
|
static const content_handler amiga_icon_content_handler = {
|
2011-05-09 19:32:34 +04:00
|
|
|
.create = amiga_icon_create,
|
|
|
|
.data_complete = amiga_icon_convert,
|
|
|
|
.destroy = amiga_icon_destroy,
|
|
|
|
.redraw = amiga_icon_redraw,
|
|
|
|
.clone = amiga_icon_clone,
|
|
|
|
.type = amiga_icon_content_type,
|
|
|
|
.no_share = false,
|
2011-05-07 00:40:09 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
static const char *amiga_icon_types[] = {
|
|
|
|
"image/x-amiga-icon"
|
|
|
|
};
|
|
|
|
|
|
|
|
static lwc_string *amiga_icon_mime_types[NOF_ELEMENTS(amiga_icon_types)];
|
|
|
|
|
|
|
|
nserror amiga_icon_init(void)
|
|
|
|
{
|
|
|
|
uint32_t i;
|
|
|
|
lwc_error lerror;
|
|
|
|
nserror error;
|
|
|
|
|
|
|
|
for (i = 0; i < NOF_ELEMENTS(amiga_icon_mime_types); i++) {
|
|
|
|
lerror = lwc_intern_string(amiga_icon_types[i],
|
|
|
|
strlen(amiga_icon_types[i]),
|
|
|
|
&amiga_icon_mime_types[i]);
|
|
|
|
if (lerror != lwc_error_ok) {
|
|
|
|
error = NSERROR_NOMEM;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
error = content_factory_register_handler(
|
|
|
|
amiga_icon_mime_types[i],
|
|
|
|
&amiga_icon_content_handler);
|
|
|
|
if (error != NSERROR_OK)
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
|
|
|
|
error:
|
|
|
|
amiga_icon_fini();
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
void amiga_icon_fini(void)
|
|
|
|
{
|
|
|
|
uint32_t i;
|
|
|
|
|
|
|
|
for (i = 0; i < NOF_ELEMENTS(amiga_icon_mime_types); i++) {
|
|
|
|
if (amiga_icon_mime_types[i] != NULL)
|
|
|
|
lwc_string_unref(amiga_icon_mime_types[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nserror amiga_icon_create(const content_handler *handler,
|
|
|
|
lwc_string *imime_type, const http_parameter *params,
|
|
|
|
llcache_handle *llcache, const char *fallback_charset,
|
|
|
|
bool quirks, struct content **c)
|
|
|
|
{
|
|
|
|
amiga_icon_content *ai;
|
|
|
|
nserror error;
|
|
|
|
|
|
|
|
ai = talloc_zero(0, amiga_icon_content);
|
|
|
|
if (ai == NULL)
|
|
|
|
return NSERROR_NOMEM;
|
|
|
|
|
|
|
|
error = content__init(&ai->base, handler, imime_type, params,
|
|
|
|
llcache, fallback_charset, quirks);
|
|
|
|
if (error != NSERROR_OK) {
|
|
|
|
talloc_free(ai);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
*c = (struct content *) ai;
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
2010-10-30 18:23:38 +04:00
|
|
|
/**
|
|
|
|
* Convert a CONTENT_AMIGA_ICON for display.
|
|
|
|
*
|
|
|
|
* No conversion is necessary. We merely read the icon dimensions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool amiga_icon_convert(struct content *c)
|
|
|
|
{
|
|
|
|
union content_msg_data msg_data;
|
|
|
|
struct DiskObject *dobj;
|
|
|
|
ULONG *imagebuf;
|
|
|
|
unsigned char *imagebufptr = NULL;
|
|
|
|
ULONG size;
|
|
|
|
int width = 0, height = 0;
|
|
|
|
long format = 0;
|
|
|
|
int err = 0;
|
|
|
|
uint8 r, g, b, a;
|
|
|
|
ULONG offset;
|
2011-05-07 00:40:09 +04:00
|
|
|
const char *url;
|
2010-10-30 18:23:38 +04:00
|
|
|
char *filename;
|
|
|
|
char *p;
|
2010-10-31 14:14:26 +03:00
|
|
|
ULONG trans, pals1;
|
|
|
|
struct ColorRegister *pal1;
|
2010-10-30 18:23:38 +04:00
|
|
|
|
|
|
|
url = content__get_url(c);
|
|
|
|
filename = url_to_path(url);
|
|
|
|
|
|
|
|
/* This loader will only work on local files, so fail if not a local path */
|
|
|
|
if(filename == NULL)
|
|
|
|
{
|
|
|
|
msg_data.error = messages_get("NoMemory");
|
|
|
|
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
p = strstr(filename, ".info");
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
dobj = GetIconTagList(filename, NULL);
|
|
|
|
|
|
|
|
if(dobj == NULL)
|
|
|
|
{
|
|
|
|
msg_data.error = messages_get("NoMemory");
|
|
|
|
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = IconControl(dobj,
|
|
|
|
ICONCTRLA_GetImageDataFormat,&format,
|
|
|
|
ICONCTRLA_GetWidth,&width,
|
|
|
|
ICONCTRLA_GetHeight,&height,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2010-10-31 14:14:26 +03:00
|
|
|
/* Check icon is direct mapped (truecolour) or palette-mapped colour.
|
|
|
|
We need additional code to handle planar icons */
|
2011-01-08 03:08:47 +03:00
|
|
|
if((format != IDFMT_DIRECTMAPPED) && (format==IDFMT_PALETTEMAPPED)) {
|
|
|
|
if(dobj) FreeDiskObject(dobj);
|
2010-10-31 14:14:26 +03:00
|
|
|
return false;
|
2011-01-08 03:08:47 +03:00
|
|
|
}
|
2010-10-30 18:23:38 +04:00
|
|
|
|
|
|
|
c->bitmap = bitmap_create(width, height, BITMAP_NEW);
|
|
|
|
if (!c->bitmap) {
|
|
|
|
msg_data.error = messages_get("NoMemory");
|
|
|
|
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
2010-10-31 14:14:26 +03:00
|
|
|
if(dobj) FreeDiskObject(dobj);
|
2010-10-30 18:23:38 +04:00
|
|
|
return false;
|
|
|
|
}
|
2011-05-07 00:40:09 +04:00
|
|
|
imagebuf = (ULONG *) bitmap_get_buffer(c->bitmap);
|
2010-10-30 18:23:38 +04:00
|
|
|
if (!imagebuf) {
|
|
|
|
msg_data.error = messages_get("NoMemory");
|
|
|
|
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
2010-10-31 14:14:26 +03:00
|
|
|
if(dobj) FreeDiskObject(dobj);
|
2010-10-30 18:23:38 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = IconControl(dobj,
|
|
|
|
ICONCTRLA_GetImageData1, &imagebufptr,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2010-10-31 14:14:26 +03:00
|
|
|
if(format==IDFMT_PALETTEMAPPED)
|
|
|
|
{
|
|
|
|
IconControl(dobj, ICONCTRLA_GetTransparentColor1, &trans,
|
|
|
|
ICONCTRLA_GetPalette1, &pal1,
|
|
|
|
ICONCTRLA_GetPaletteSize1, &pals1,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
imagebufptr = (unsigned char *) amiga_icon_convertcolouricon32((UBYTE *)imagebufptr,
|
2010-10-31 14:14:26 +03:00
|
|
|
width, height, trans, pals1, pal1, 0xff);
|
|
|
|
}
|
|
|
|
|
2010-10-30 18:23:38 +04:00
|
|
|
/* Decoded data is ARGB, so ensure correct byte order */
|
|
|
|
|
|
|
|
size = width * height * 4;
|
|
|
|
|
|
|
|
for (offset = 0; offset < size; offset += 4) {
|
|
|
|
b = imagebufptr[offset+3];
|
|
|
|
g = imagebufptr[offset+2];
|
|
|
|
r = imagebufptr[offset+1];
|
|
|
|
a = imagebufptr[offset];
|
|
|
|
|
|
|
|
*imagebuf = r << 24 | g << 16 | b << 8 | a;
|
|
|
|
imagebuf++;
|
|
|
|
}
|
|
|
|
|
|
|
|
c->width = width;
|
|
|
|
c->height = height;
|
|
|
|
|
|
|
|
bitmap_modified(c->bitmap);
|
2011-02-27 23:11:39 +03:00
|
|
|
content_set_ready(c);
|
|
|
|
content_set_done(c);
|
2010-10-30 18:23:38 +04:00
|
|
|
content_set_status(c, "");
|
2010-10-31 14:14:26 +03:00
|
|
|
|
|
|
|
if(dobj) FreeDiskObject(dobj);
|
|
|
|
|
2011-01-08 03:08:47 +03:00
|
|
|
if(format==IDFMT_PALETTEMAPPED)
|
|
|
|
FreeVec(imagebufptr);
|
|
|
|
|
2010-10-30 18:23:38 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroy a CONTENT_AMIGA_ICON and free all resources it owns.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void amiga_icon_destroy(struct content *c)
|
|
|
|
{
|
|
|
|
if (c->bitmap != NULL)
|
|
|
|
bitmap_destroy(c->bitmap);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Redraw a CONTENT_AMIGA_ICON.
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool amiga_icon_redraw(struct content *c, int x, int y,
|
2011-02-14 22:17:08 +03:00
|
|
|
int width, int height, const struct rect *clip,
|
2011-05-09 02:18:28 +04:00
|
|
|
float scale, colour background_colour,
|
|
|
|
bool repeat_x, bool repeat_y)
|
2010-10-30 18:23:38 +04:00
|
|
|
{
|
2011-05-09 02:18:28 +04:00
|
|
|
bitmap_flags_t flags = BITMAPF_NONE;
|
|
|
|
|
|
|
|
if (repeat_x)
|
|
|
|
flags |= BITMAPF_REPEAT_X;
|
|
|
|
if (repeat_y)
|
|
|
|
flags |= BITMAPF_REPEAT_Y;
|
|
|
|
|
2010-10-30 18:23:38 +04:00
|
|
|
return plot.bitmap(x, y, width, height,
|
2011-05-09 02:18:28 +04:00
|
|
|
c->bitmap, background_colour, flags);
|
2010-10-30 18:23:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
nserror amiga_icon_clone(const struct content *old, struct content **newc)
|
2010-10-30 18:23:38 +04:00
|
|
|
{
|
2011-05-07 00:40:09 +04:00
|
|
|
amiga_icon_content *ai;
|
|
|
|
nserror error;
|
|
|
|
|
|
|
|
ai = talloc_zero(0, amiga_icon_content);
|
|
|
|
if (ai == NULL)
|
|
|
|
return NSERROR_NOMEM;
|
|
|
|
|
|
|
|
error = content__clone(old, &ai->base);
|
|
|
|
if (error != NSERROR_OK) {
|
|
|
|
content_destroy(&ai->base);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2010-10-30 18:23:38 +04:00
|
|
|
/* Simply replay convert */
|
|
|
|
if (old->status == CONTENT_STATUS_READY ||
|
|
|
|
old->status == CONTENT_STATUS_DONE) {
|
2011-05-07 00:40:09 +04:00
|
|
|
if (amiga_icon_convert(&ai->base) == false) {
|
|
|
|
content_destroy(&ai->base);
|
|
|
|
return NSERROR_CLONE_FAILED;
|
|
|
|
}
|
2010-10-30 18:23:38 +04:00
|
|
|
}
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
*newc = (struct content *) ai;
|
|
|
|
|
|
|
|
return NSERROR_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
content_type amiga_icon_content_type(lwc_string *mime_type)
|
|
|
|
{
|
|
|
|
return CONTENT_IMAGE;
|
2010-10-30 18:23:38 +04:00
|
|
|
}
|
2010-10-31 14:14:26 +03:00
|
|
|
|
2011-01-08 03:08:47 +03:00
|
|
|
#endif /* WITH_AMIGA_ICON */
|
|
|
|
|
2010-10-31 14:14:26 +03:00
|
|
|
ULONG *amiga_icon_convertcolouricon32(UBYTE *icondata, ULONG width, ULONG height,
|
|
|
|
ULONG trans, ULONG pals1, struct ColorRegister *pal1, int alpha)
|
|
|
|
{
|
|
|
|
ULONG *argbicon;
|
|
|
|
struct ColorRegister *colour;
|
|
|
|
struct ColorMap *cmap;
|
|
|
|
int i;
|
|
|
|
ULONG a,r,g,b;
|
|
|
|
|
|
|
|
if (alpha==0) alpha=0xff;
|
|
|
|
|
|
|
|
argbicon = (ULONG *)AllocVec(width*height*4,MEMF_CLEAR);
|
|
|
|
if (!argbicon) return(NULL);
|
|
|
|
|
|
|
|
cmap=GetColorMap(pals1);
|
|
|
|
if(!cmap) return(NULL);
|
|
|
|
|
|
|
|
for(i=0;i<(width*height);i++)
|
|
|
|
{
|
|
|
|
colour = &pal1[icondata[i]];
|
|
|
|
|
|
|
|
if(icondata[i] == trans)
|
|
|
|
{
|
|
|
|
a=0x00;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
a=alpha;
|
|
|
|
}
|
|
|
|
|
|
|
|
r = colour->red;
|
|
|
|
g = colour->green;
|
|
|
|
b = colour->blue;
|
|
|
|
|
|
|
|
argbicon[i] = (a << 24) +
|
|
|
|
(r << 16) +
|
|
|
|
(g << 8) +
|
|
|
|
(b);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(argbicon);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ami_superimpose_favicon(char *path, struct hlcache_handle *icon, char *type)
|
|
|
|
{
|
|
|
|
struct DiskObject *dobj = NULL;
|
|
|
|
struct BitMap *bm = NULL;
|
|
|
|
ULONG *icondata1, *icondata2;
|
|
|
|
ULONG width, height;
|
|
|
|
long format = 0;
|
|
|
|
int err = 0;
|
2011-01-08 03:08:47 +03:00
|
|
|
ULONG trans1, pals1;
|
|
|
|
ULONG trans2, pals2;
|
|
|
|
struct ColorRegister *pal1;
|
|
|
|
struct ColorRegister *pal2;
|
2010-10-31 14:14:26 +03:00
|
|
|
|
|
|
|
if(!type)
|
|
|
|
{
|
|
|
|
dobj = GetIconTags(NULL,
|
|
|
|
ICONGETA_GetDefaultType, WBDRAWER,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dobj = GetIconTags(NULL, ICONGETA_GetDefaultName, type,
|
|
|
|
ICONGETA_GetDefaultType, WBPROJECT,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
|
2011-01-08 03:08:47 +03:00
|
|
|
if(dobj == NULL) return;
|
|
|
|
|
2010-10-31 14:14:26 +03:00
|
|
|
err = IconControl(dobj,
|
|
|
|
ICONCTRLA_GetImageDataFormat,&format,
|
|
|
|
ICONCTRLA_GetImageData1,&icondata1,
|
|
|
|
ICONCTRLA_GetImageData2,&icondata2,
|
|
|
|
ICONCTRLA_GetWidth,&width,
|
|
|
|
ICONCTRLA_GetHeight,&height,
|
|
|
|
TAG_DONE);
|
|
|
|
|
2011-01-08 03:08:47 +03:00
|
|
|
/* If we have a palette-mapped icon, convert it to a 32-bit one */
|
|
|
|
if(format == IDFMT_PALETTEMAPPED)
|
|
|
|
{
|
|
|
|
IconControl(dobj, ICONCTRLA_GetTransparentColor1, &trans1,
|
|
|
|
ICONCTRLA_GetPalette1, &pal1,
|
|
|
|
ICONCTRLA_GetPaletteSize1, &pals1,
|
|
|
|
ICONCTRLA_GetTransparentColor2, &trans2,
|
|
|
|
ICONCTRLA_GetPalette2, &pal2,
|
|
|
|
ICONCTRLA_GetPaletteSize2, &pals2,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
icondata1 = amiga_icon_convertcolouricon32((UBYTE *)icondata1,
|
|
|
|
width, height, trans1, pals1, pal1, 0xff);
|
|
|
|
|
|
|
|
icondata2 = amiga_icon_convertcolouricon32((UBYTE *)icondata2,
|
|
|
|
width, height, trans2, pals2, pal2, 0xff);
|
|
|
|
|
|
|
|
err = IconControl(dobj,
|
|
|
|
ICONCTRLA_SetImageDataFormat, IDFMT_DIRECTMAPPED,
|
|
|
|
ICONCTRLA_SetImageData1, icondata1,
|
|
|
|
ICONCTRLA_SetImageData2, icondata2,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if((format == IDFMT_DIRECTMAPPED) || (format == IDFMT_PALETTEMAPPED))
|
2010-10-31 14:14:26 +03:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PutIconTags(path, dobj,
|
|
|
|
ICONPUTA_NotifyWorkbench, TRUE, TAG_DONE);
|
2011-01-08 03:08:47 +03:00
|
|
|
|
|
|
|
FreeDiskObject(dobj);
|
|
|
|
|
|
|
|
if(format == IDFMT_PALETTEMAPPED)
|
|
|
|
{
|
|
|
|
/* Free the 32-bit data we created */
|
|
|
|
FreeVec(icondata1);
|
|
|
|
FreeVec(icondata2);
|
|
|
|
}
|
|
|
|
|
2010-10-31 14:14:26 +03:00
|
|
|
}
|