summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/fltkimgbuf.cc10
-rw-r--r--dw/image.cc6
-rw-r--r--src/dicache.c6
-rw-r--r--src/html.cc4
-rw-r--r--src/image.cc6
5 files changed, 20 insertions, 12 deletions
diff --git a/dw/fltkimgbuf.cc b/dw/fltkimgbuf.cc
index 26b46969..01bce455 100644
--- a/dw/fltkimgbuf.cc
+++ b/dw/fltkimgbuf.cc
@@ -80,7 +80,7 @@ FltkImgbuf::FltkImgbuf (Type type, int width, int height, double gamma)
{
DBG_OBJ_CREATE ("dw::fltk::FltkImgbuf");
- _MSG("FltkImgbuf: new root %p\n", this);
+ _MSG ("FltkImgbuf::FltkImgbuf: new root %p\n", this);
init (type, width, height, gamma, NULL);
}
@@ -89,7 +89,7 @@ FltkImgbuf::FltkImgbuf (Type type, int width, int height, double gamma,
{
DBG_OBJ_CREATE ("dw::fltk::FltkImgbuf");
- _MSG("FltkImgbuf: new scaled %p, root is %p\n", this, root);
+ _MSG ("FltkImgbuf::FltkImgbuf: new scaled %p, root is %p\n", this, root);
init (type, width, height, gamma, root);
}
@@ -135,8 +135,8 @@ void FltkImgbuf::init (Type type, int width, int height, double gamma,
case RGB: bpp = 3; break;
default: bpp = 1; break;
}
- _MSG("FltkImgbuf::init width=%d height=%d bpp=%d gamma=%g\n",
- width, height, bpp, gamma);
+ _MSG("FltkImgbuf::init this=%p width=%d height=%d bpp=%d gamma=%g\n",
+ this, width, height, bpp, gamma);
rawdata = new uchar[bpp * width * height];
// Set light-gray as interim background color.
memset(rawdata, 222, width*height*bpp);
@@ -163,6 +163,8 @@ void FltkImgbuf::init (Type type, int width, int height, double gamma,
FltkImgbuf::~FltkImgbuf ()
{
+ _MSG ("FltkImgbuf::~FltkImgbuf\n");
+
if (!isRoot())
root->detachScaledBuf (this);
diff --git a/dw/image.cc b/dw/image.cc
index 74f96e57..5df6b93e 100644
--- a/dw/image.cc
+++ b/dw/image.cc
@@ -428,8 +428,10 @@ void Image::setBuffer (core::Imgbuf *buffer, bool resize)
if (resize)
queueResize (0, true);
- if (wasAllocated () && getContentWidth () > 0 && getContentHeight () > 0) {
- // Only scale when both dimensions are known.
+ if (wasAllocated () && needsResize () &&
+ getContentWidth () > 0 && getContentHeight () > 0) {
+ // Don't create a new buffer for the transition from alt text to img,
+ // and only scale when both dimensions are known.
this->buffer =
buffer->getScaledBuf (getContentWidth (), getContentHeight ());
} else {
diff --git a/src/dicache.c b/src/dicache.c
index db3b86b2..b63e9d3b 100644
--- a/src/dicache.c
+++ b/src/dicache.c
@@ -256,7 +256,9 @@ void a_Dicache_invalidate_entry(const DilloUrl *Url)
/*
* Set image's width, height & type
- * (By now, we'll use the image information despite the html tags --Jcid)
+ * - 'width' and 'height' come from the image data.
+ * - HTML width and height attrs are handled with setNonCssHint.
+ * - CSS sizing is handled by the CSS engine.
*/
void a_Dicache_set_parms(DilloUrl *url, int version, DilloImage *Image,
uint_t width, uint_t height, DilloImgType type,
@@ -269,7 +271,7 @@ void a_Dicache_set_parms(DilloUrl *url, int version, DilloImage *Image,
/* Find the DicEntry for this Image */
DicEntry = a_Dicache_get_entry(url, version);
dReturn_if_fail ( DicEntry != NULL );
- /* Parameters already set? */
+ /* Parameters already set? Don't do it twice. */
dReturn_if_fail ( DicEntry->State < DIC_SetParms );
_MSG(" RefCount=%d version=%d\n", DicEntry->RefCount, DicEntry->version);
diff --git a/src/html.cc b/src/html.cc
index 096437c6..f8734444 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -1804,8 +1804,8 @@ static void Html_tag_open_style(DilloHtml *html, const char *tag, int tagsize)
static void Html_tag_close_style(DilloHtml *html)
{
if (prefs.parse_embedded_css && html->loadCssFromStash)
- html->styleEngine->parse(html, html->base_url, html->Stash->str, html->Stash->len,
- CSS_ORIGIN_AUTHOR);
+ html->styleEngine->parse(html, html->base_url, html->Stash->str,
+ html->Stash->len, CSS_ORIGIN_AUTHOR);
}
/*
diff --git a/src/image.cc b/src/image.cc
index 9915023a..97270eef 100644
--- a/src/image.cc
+++ b/src/image.cc
@@ -106,9 +106,11 @@ void a_Image_set_parms(DilloImage *Image, void *v_imgbuf, DilloUrl *url,
int version, uint_t width, uint_t height,
DilloImgType type)
{
- _MSG("a_Image_set_parms: width=%d height=%d\n", width, height);
+ _MSG("a_Image_set_parms: width=%d height=%d iw=%d ih=%d\n",
+ width, height, Image->width, Image->height);
- bool resize = (Image->width != width || Image->height != height);
+ /* Resize from 0,0 to width,height */
+ bool resize = true;
I2IR(Image)->setBuffer((Imgbuf*)v_imgbuf, resize);
if (!Image->BitVec)