(search_image_cache): Remove unused variable.
authorChong Yidong <cyd@stupidchicken.com>
Thu, 14 Jun 2007 01:48:01 +0000 (01:48 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Thu, 14 Jun 2007 01:48:01 +0000 (01:48 +0000)
src/image.c

index 36e8a2e..2dd578a 100644 (file)
@@ -1642,21 +1642,26 @@ search_image_cache (f, spec, hash)
 {
   struct image *img;
   struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
-  Lisp_Object specified_bg = image_spec_value (spec, QCbackground, NULL);
   int i = hash % IMAGE_CACHE_BUCKETS_SIZE;
 
   /* If the image spec does not specify a background color, the cached
      image must have the same background color as the current frame.
-     Likewise for the foreground color of the cached monochrome image.
-     The following code be improved.  For example, jpeg does not
-     support transparency, but currently a jpeg image spec won't match
-     a cached spec created with a different frame background.  The
-     extra memory usage is probably negligible in practice.  */
+     The foreground color must also match, for the sake of monochrome
+     images.
+
+     In fact, we could ignore the foreground color matching condition
+     for color images, or if the image spec specifies :foreground;
+     similarly we could ignore the background color matching condition
+     for formats that don't use transparency (such as jpeg), or if the
+     image spec specifies :background.  However, the extra memory
+     usage is probably negligible in practice, so we don't bother.  */
   if (!c) return NULL;
 
   for (img = c->buckets[i]; img; img = img->next)
     if (img->hash == hash
        && !NILP (Fequal (img->spec, spec))
+       /* If the image spec specifies a background, it doesn't matter
+          what the frame background is.  */
        && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f)
        && img->frame_background == FRAME_BACKGROUND_PIXEL (f))
       break;