diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2011-08-31 12:12:41 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2011-08-31 12:12:41 +0000 |
commit | 2348b134924e8b24fba02f068a16c6fb308af88a (patch) | |
tree | fbfcb267459fc9b970c3d0c6dc5153c1817e2b32 /content/content.c | |
parent | d7b46332a8b799848d9c8080509191b6395f17e9 (diff) | |
download | netsurf-2348b134924e8b24fba02f068a16c6fb308af88a.tar.gz netsurf-2348b134924e8b24fba02f068a16c6fb308af88a.tar.bz2 |
refactor bitmap out of generic content structure
svn path=/trunk/netsurf/; revision=12686
Diffstat (limited to 'content/content.c')
-rw-r--r-- | content/content.c | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/content/content.c b/content/content.c index f792e794a..db186e8cc 100644 --- a/content/content.c +++ b/content/content.c @@ -103,7 +103,6 @@ nserror content__init(struct content *c, const content_handler *handler, c->available_width = 0; c->quirks = quirks; c->refresh = 0; - c->bitmap = NULL; c->time = wallclock(); c->size = 0; c->title = NULL; @@ -959,6 +958,7 @@ const char *content__get_refresh_url(struct content *c) return c->refresh; } + /** * Retrieve the bitmap contained in an image content * @@ -972,10 +972,56 @@ struct bitmap *content_get_bitmap(hlcache_handle *h) struct bitmap *content__get_bitmap(struct content *c) { - if (c == NULL) - return NULL; + struct bitmap *bitmap = NULL; + + if ((c != NULL) && + (c->handler != NULL) && + (c->handler->type != NULL) && + (c->handler->type(NULL) == CONTENT_IMAGE) && + (c->handler->get_internal != NULL) ) { + bitmap = c->handler->get_internal(c, NULL); + } + + return bitmap; +} + + +/** + * Determine if a content is opaque from handle + * + * \param h high level cache handle to retrieve opacity from. + * \return false if the content is not opaque or information is not + * known else true. + */ +bool content_get_opaque(hlcache_handle *h) +{ + return content__get_opaque(hlcache_handle_get_content(h)); +} + +/** + * Determine if a content is opaque + * + * \param c Content to retrieve opacity from + * \return false if the content is not opaque or information is not + * known else true. + */ +bool content__get_opaque(struct content *c) +{ + bool opaque = false; + + if ((c != NULL) && + (c->handler != NULL) && + (c->handler->type != NULL) && + (c->handler->type(NULL) == CONTENT_IMAGE) && + (c->handler->get_internal != NULL) ) { + struct bitmap *bitmap = NULL; + bitmap = c->handler->get_internal(c, NULL); + if (bitmap != NULL) { + opaque = bitmap_get_opaque(bitmap); + } + } - return c->bitmap; + return opaque; } |