diff options
| author | Paul Eggert | 2012-06-22 14:17:42 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-06-22 14:17:42 -0700 |
| commit | d35af63cd671563fd188c3b0a1ef30067027c7aa (patch) | |
| tree | c9e01847ccf788e23794684da9331c3e0defd0d3 /src/image.c | |
| parent | f143bfe38b43ad0a9d817f05c25e418982dca06f (diff) | |
| download | emacs-d35af63cd671563fd188c3b0a1ef30067027c7aa.tar.gz emacs-d35af63cd671563fd188c3b0a1ef30067027c7aa.zip | |
Support higher-resolution time stamps.
Fixes: debbugs:9000
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/image.c b/src/image.c index 103f0a7feb6..47b14a333e9 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1062,11 +1062,8 @@ check_image_size (struct frame *f, int width, int height) | |||
| 1062 | void | 1062 | void |
| 1063 | prepare_image_for_display (struct frame *f, struct image *img) | 1063 | prepare_image_for_display (struct frame *f, struct image *img) |
| 1064 | { | 1064 | { |
| 1065 | EMACS_TIME t; | ||
| 1066 | |||
| 1067 | /* We're about to display IMG, so set its timestamp to `now'. */ | 1065 | /* We're about to display IMG, so set its timestamp to `now'. */ |
| 1068 | EMACS_GET_TIME (t); | 1066 | EMACS_GET_TIME (img->timestamp); |
| 1069 | img->timestamp = EMACS_SECS (t); | ||
| 1070 | 1067 | ||
| 1071 | /* If IMG doesn't have a pixmap yet, load it now, using the image | 1068 | /* If IMG doesn't have a pixmap yet, load it now, using the image |
| 1072 | type dependent loader function. */ | 1069 | type dependent loader function. */ |
| @@ -1514,8 +1511,8 @@ clear_image_cache (struct frame *f, Lisp_Object filter) | |||
| 1514 | else if (INTEGERP (Vimage_cache_eviction_delay)) | 1511 | else if (INTEGERP (Vimage_cache_eviction_delay)) |
| 1515 | { | 1512 | { |
| 1516 | /* Free cache based on timestamp. */ | 1513 | /* Free cache based on timestamp. */ |
| 1517 | EMACS_TIME t; | 1514 | EMACS_TIME old, t; |
| 1518 | double old, delay; | 1515 | double delay; |
| 1519 | ptrdiff_t nimages = 0; | 1516 | ptrdiff_t nimages = 0; |
| 1520 | 1517 | ||
| 1521 | for (i = 0; i < c->used; ++i) | 1518 | for (i = 0; i < c->used; ++i) |
| @@ -1530,12 +1527,12 @@ clear_image_cache (struct frame *f, Lisp_Object filter) | |||
| 1530 | delay = max (delay, 1); | 1527 | delay = max (delay, 1); |
| 1531 | 1528 | ||
| 1532 | EMACS_GET_TIME (t); | 1529 | EMACS_GET_TIME (t); |
| 1533 | old = EMACS_SECS (t) - delay; | 1530 | EMACS_SUB_TIME (old, t, EMACS_TIME_FROM_DOUBLE (delay)); |
| 1534 | 1531 | ||
| 1535 | for (i = 0; i < c->used; ++i) | 1532 | for (i = 0; i < c->used; ++i) |
| 1536 | { | 1533 | { |
| 1537 | struct image *img = c->images[i]; | 1534 | struct image *img = c->images[i]; |
| 1538 | if (img && img->timestamp < old) | 1535 | if (img && EMACS_TIME_LT (img->timestamp, old)) |
| 1539 | { | 1536 | { |
| 1540 | free_image (f, img); | 1537 | free_image (f, img); |
| 1541 | ++nfreed; | 1538 | ++nfreed; |
| @@ -1708,7 +1705,6 @@ lookup_image (struct frame *f, Lisp_Object spec) | |||
| 1708 | { | 1705 | { |
| 1709 | struct image *img; | 1706 | struct image *img; |
| 1710 | EMACS_UINT hash; | 1707 | EMACS_UINT hash; |
| 1711 | EMACS_TIME now; | ||
| 1712 | 1708 | ||
| 1713 | /* F must be a window-system frame, and SPEC must be a valid image | 1709 | /* F must be a window-system frame, and SPEC must be a valid image |
| 1714 | specification. */ | 1710 | specification. */ |
| @@ -1802,8 +1798,7 @@ lookup_image (struct frame *f, Lisp_Object spec) | |||
| 1802 | } | 1798 | } |
| 1803 | 1799 | ||
| 1804 | /* We're using IMG, so set its timestamp to `now'. */ | 1800 | /* We're using IMG, so set its timestamp to `now'. */ |
| 1805 | EMACS_GET_TIME (now); | 1801 | EMACS_GET_TIME (img->timestamp); |
| 1806 | img->timestamp = EMACS_SECS (now); | ||
| 1807 | 1802 | ||
| 1808 | /* Value is the image id. */ | 1803 | /* Value is the image id. */ |
| 1809 | return img->id; | 1804 | return img->id; |