Don't download image files whose size is specified in <img> tag.
This commit is contained in:
committed by
Tatsuya Kinoshita
parent
08811e76fd
commit
98b4d10ce4
22
image.c
22
image.c
@@ -207,7 +207,7 @@ drawImage()
|
|||||||
if (support_remote_image) {
|
if (support_remote_image) {
|
||||||
#if 0
|
#if 0
|
||||||
fprintf(stderr,"file %s x %d y %d w %d h %d sx %d sy %d sw %d sh %d (ppc %d ppl %d)\n",
|
fprintf(stderr,"file %s x %d y %d w %d h %d sx %d sy %d sw %d sh %d (ppc %d ppl %d)\n",
|
||||||
getenv("WINDOWID") ? i->cache->file : i->cache->url,
|
(getenv("WINDOWID") && i->cache->touch) ? i->cache->file : i->cache->url,
|
||||||
i->x, i->y,
|
i->x, i->y,
|
||||||
i->cache->width > 0 ? i->cache->width : 0,
|
i->cache->width > 0 ? i->cache->width : 0,
|
||||||
i->cache->height > 0 ? i->cache->height : 0,
|
i->cache->height > 0 ? i->cache->height : 0,
|
||||||
@@ -217,7 +217,7 @@ drawImage()
|
|||||||
put_image(
|
put_image(
|
||||||
#if 1
|
#if 1
|
||||||
/* XXX I don't know why but sometimes i->cache->file doesn't exist. */
|
/* XXX I don't know why but sometimes i->cache->file doesn't exist. */
|
||||||
getenv("WINDOWID") && (stat(i->cache->file,&st) == 0) ?
|
(getenv("WINDOWID") && i->cache->touch && stat(i->cache->file,&st) == 0) ?
|
||||||
/* local */ i->cache->file : /* remote */ i->cache->url,
|
/* local */ i->cache->file : /* remote */ i->cache->url,
|
||||||
#else
|
#else
|
||||||
i->cache->url,
|
i->cache->url,
|
||||||
@@ -419,7 +419,7 @@ loadImage(Buffer *buf, int flag)
|
|||||||
}
|
}
|
||||||
for (i = 0; i < n_load_image; i++) {
|
for (i = 0; i < n_load_image; i++) {
|
||||||
cache = image_cache[i];
|
cache = image_cache[i];
|
||||||
if (!cache)
|
if (!cache || !cache->touch)
|
||||||
continue;
|
continue;
|
||||||
if (lstat(cache->touch, &st))
|
if (lstat(cache->touch, &st))
|
||||||
continue;
|
continue;
|
||||||
@@ -450,7 +450,7 @@ loadImage(Buffer *buf, int flag)
|
|||||||
|
|
||||||
for (i = (buf != image_buffer) ? 0 : maxLoadImage; i < n_load_image; i++) {
|
for (i = (buf != image_buffer) ? 0 : maxLoadImage; i < n_load_image; i++) {
|
||||||
cache = image_cache[i];
|
cache = image_cache[i];
|
||||||
if (!cache)
|
if (!cache || !cache->touch)
|
||||||
continue;
|
continue;
|
||||||
if (cache->pid) {
|
if (cache->pid) {
|
||||||
kill(cache->pid, SIGKILL);
|
kill(cache->pid, SIGKILL);
|
||||||
@@ -505,6 +505,9 @@ loadImage(Buffer *buf, int flag)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
image_cache[i] = cache;
|
image_cache[i] = cache;
|
||||||
|
if (!cache->touch) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
flush_tty();
|
flush_tty();
|
||||||
#ifdef DONT_CALL_GC_AFTER_FORK
|
#ifdef DONT_CALL_GC_AFTER_FORK
|
||||||
@@ -585,7 +588,6 @@ getImage(Image * image, ParsedURL *current, int flag)
|
|||||||
cache->url = image->url;
|
cache->url = image->url;
|
||||||
cache->current = current;
|
cache->current = current;
|
||||||
cache->file = tmpfname(TMPF_DFL, image->ext)->ptr;
|
cache->file = tmpfname(TMPF_DFL, image->ext)->ptr;
|
||||||
cache->touch = tmpfname(TMPF_DFL, NULL)->ptr;
|
|
||||||
cache->pid = 0;
|
cache->pid = 0;
|
||||||
cache->index = 0;
|
cache->index = 0;
|
||||||
cache->loaded = IMG_FLAG_UNLOADED;
|
cache->loaded = IMG_FLAG_UNLOADED;
|
||||||
@@ -595,9 +597,15 @@ getImage(Image * image, ParsedURL *current, int flag)
|
|||||||
|
|
||||||
if (image->height > 0 && image->height % pixel_per_line_i > 0)
|
if (image->height > 0 && image->height % pixel_per_line_i > 0)
|
||||||
image->height += (pixel_per_line_i - image->height % pixel_per_line_i);
|
image->height += (pixel_per_line_i - image->height % pixel_per_line_i);
|
||||||
|
if (image->height > 0 && image->width > 0) {
|
||||||
if (! getenv("WINDOWID") && image->height > 0 && image->width > 0)
|
|
||||||
cache->loaded = IMG_FLAG_LOADED;
|
cache->loaded = IMG_FLAG_LOADED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cache->loaded == IMG_FLAG_UNLOADED) {
|
||||||
|
cache->touch = tmpfname(TMPF_DFL, NULL)->ptr;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cache->touch = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cache->width = image->width ;
|
cache->width = image->width ;
|
||||||
|
Reference in New Issue
Block a user