diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2005-09-17 19:59:02 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2005-09-17 19:59:02 +0000 |
commit | 98cc71baf621d57c3797ab3904039053aa0783b1 (patch) | |
tree | 7bf7000b407fcef432098d8bee926eaaaa7ad11c | |
parent | 14d159f067f084ce807f4fa0d4666661c9b90dff (diff) | |
download | netsurf-98cc71baf621d57c3797ab3904039053aa0783b1.tar.gz netsurf-98cc71baf621d57c3797ab3904039053aa0783b1.tar.bz2 |
[project @ 2005-09-17 19:59:02 by jmb]
Hack around PNG as object fallback crash.
svn path=/import/netsurf/; revision=1865
-rw-r--r-- | image/mng.c | 29 | ||||
-rw-r--r-- | image/mng.h | 3 |
2 files changed, 29 insertions, 3 deletions
diff --git a/image/mng.c b/image/mng.c index 1c987fa4d..219de6d08 100644 --- a/image/mng.c +++ b/image/mng.c @@ -127,6 +127,8 @@ bool nsmng_create(struct content *c, const char *params[]) { c->data.mng.read_resume = false; c->data.mng.read_size = 0; c->data.mng.waiting = false; + + c->data.mng.displayed = false; return true; } @@ -285,7 +287,18 @@ bool nsmng_convert(struct content *c, int width, int height) { c->size += c->width * c->height * 4 + 100; c->status = CONTENT_STATUS_DONE; - + /* jmb: I'm really not sure that this should be here. + * The *_convert functions are for converting a content into a + * displayable format. They should not, however, do anything which + * could cause the content to be displayed; the content may have + * hidden visibility or be a fallback for an object; this + * information is not available here (nor is there any need for it + * to be). + * The specific issue here is that mng_display calls the display + * callbacks, which include nsmng_refresh. nsmng_refresh forces + * a content to be redrawn regardless of whether it should be + * displayed or not. + */ /* Start displaying */ status = mng_display(c->data.mng.handle); @@ -385,7 +398,15 @@ mng_bool nsmng_refresh(mng_handle mng, mng_uint32 x, mng_uint32 y, mng_uint32 w, data.redraw.object_width = c->width; data.redraw.object_height = c->height; - content_broadcast(c, CONTENT_MSG_REDRAW, data); + /* Only attempt to force the redraw if we've been requested to + * display the image in the first place (i.e. nsmng_redraw has + * been called). This avoids the situation of forcibly redrawing + * an image that shouldn't be shown (e.g. if the image is a fallback + * for an object that can't be rendered) + */ + if (c->data.mng.displayed) + content_broadcast(c, CONTENT_MSG_REDRAW, data); + return MNG_TRUE; } @@ -431,6 +452,10 @@ bool nsmng_redraw(struct content *c, int x, int y, { bool ret; + /* mark image as having been requested to display */ + if (!c->data.mng.displayed) + c->data.mng.displayed = true; + if ((c->bitmap) && (c->data.mng.opaque_test_pending)) { bitmap_set_opaque(c->bitmap, bitmap_test_opaque(c->bitmap)); c->data.mng.opaque_test_pending = false; diff --git a/image/mng.h b/image/mng.h index 7fffd7a78..8f2ca8e76 100644 --- a/image/mng.h +++ b/image/mng.h @@ -18,11 +18,12 @@ struct content; struct content_mng_data { - bool opaque_test_pending; + bool opaque_test_pending; bool read_start; bool read_resume; int read_size; bool waiting; + bool displayed; mng_handle handle; }; |