summaryrefslogtreecommitdiff
path: root/image/ico.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-08-31 12:12:41 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-08-31 12:12:41 +0000
commit2348b134924e8b24fba02f068a16c6fb308af88a (patch)
treefbfcb267459fc9b970c3d0c6dc5153c1817e2b32 /image/ico.c
parentd7b46332a8b799848d9c8080509191b6395f17e9 (diff)
downloadnetsurf-2348b134924e8b24fba02f068a16c6fb308af88a.tar.gz
netsurf-2348b134924e8b24fba02f068a16c6fb308af88a.tar.bz2
refactor bitmap out of generic content structure
svn path=/trunk/netsurf/; revision=12686
Diffstat (limited to 'image/ico.c')
-rw-r--r--image/ico.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/image/ico.c b/image/ico.c
index 35c59e2b4..f12e0cccb 100644
--- a/image/ico.c
+++ b/image/ico.c
@@ -41,6 +41,8 @@ typedef struct nsico_content {
struct content base;
struct ico_collection *ico; /** ICO collection data */
+
+ struct bitmap *bitmap; /**< Created NetSurf bitmap */
} nsico_content;
@@ -132,8 +134,8 @@ static bool nsico_convert(struct content *c)
/* exit as a success */
bmp = ico_find(ico->ico, 255, 255);
assert(bmp);
- c->bitmap = bmp->bitmap;
- bitmap_modified(c->bitmap);
+ ico->bitmap = bmp->bitmap;
+ bitmap_modified(ico->bitmap);
content_set_ready(c);
content_set_done(c);
@@ -155,7 +157,7 @@ static bool nsico_redraw(struct content *c, struct content_redraw_data *data,
if (bmp_decode(bmp) != BMP_OK)
return false;
- c->bitmap = bmp->bitmap;
+ ico->bitmap = bmp->bitmap;
if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
@@ -163,7 +165,7 @@ static bool nsico_redraw(struct content *c, struct content_redraw_data *data,
flags |= BITMAPF_REPEAT_Y;
return ctx->plot->bitmap(data->x, data->y, data->width, data->height,
- c->bitmap, data->background_colour, flags);
+ ico->bitmap, data->background_colour, flags);
}
@@ -210,6 +212,13 @@ static nserror nsico_clone(const struct content *old, struct content **newc)
return NSERROR_OK;
}
+static void *nsico_get_internal(const struct content *c, void *context)
+{
+ nsico_content *ico = (nsico_content *) c;
+
+ return ico->bitmap;
+}
+
static content_type nsico_content_type(lwc_string *mime_type)
{
return CONTENT_IMAGE;
@@ -221,6 +230,7 @@ static const content_handler nsico_content_handler = {
.destroy = nsico_destroy,
.redraw = nsico_redraw,
.clone = nsico_clone,
+ .get_internal = nsico_get_internal,
.type = nsico_content_type,
.no_share = false,
};