summaryrefslogtreecommitdiff
path: root/image/bmp.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/bmp.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/bmp.c')
-rw-r--r--image/bmp.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/image/bmp.c b/image/bmp.c
index 1a4152649..fdf64d9dc 100644
--- a/image/bmp.c
+++ b/image/bmp.c
@@ -43,6 +43,8 @@ typedef struct nsbmp_content {
struct content base;
bmp_image *bmp; /** BMP image data */
+
+ struct bitmap *bitmap; /**< Created NetSurf bitmap */
} nsbmp_content;
static nserror nsbmp_create_bmp_data(nsbmp_content *bmp)
@@ -165,8 +167,8 @@ static bool nsbmp_convert(struct content *c)
c->size += (swidth * bmp->bmp->height) + 16 + 44;
/* exit as a success */
- c->bitmap = bmp->bmp->bitmap;
- bitmap_modified(c->bitmap);
+ bmp->bitmap = bmp->bmp->bitmap;
+ bitmap_modified(bmp->bitmap);
content_set_ready(c);
content_set_done(c);
@@ -186,7 +188,7 @@ static bool nsbmp_redraw(struct content *c, struct content_redraw_data *data,
if (bmp_decode(bmp->bmp) != BMP_OK)
return false;
- c->bitmap = bmp->bmp->bitmap;
+ bmp->bitmap = bmp->bmp->bitmap;
if (data->repeat_x)
flags |= BITMAPF_REPEAT_X;
@@ -194,7 +196,7 @@ static bool nsbmp_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);
+ bmp->bitmap, data->background_colour, flags);
}
@@ -242,6 +244,13 @@ static nserror nsbmp_clone(const struct content *old, struct content **newc)
return NSERROR_OK;
}
+static void *nsbmp_get_internal(const struct content *c, void *context)
+{
+ nsbmp_content *bmp = (nsbmp_content *)c;
+
+ return bmp->bitmap;
+}
+
static content_type nsbmp_content_type(lwc_string *mime_type)
{
return CONTENT_IMAGE;
@@ -254,6 +263,7 @@ static const content_handler nsbmp_content_handler = {
.destroy = nsbmp_destroy,
.redraw = nsbmp_redraw,
.clone = nsbmp_clone,
+ .get_internal = nsbmp_get_internal,
.type = nsbmp_content_type,
.no_share = false,
};