]> git.eshelyaron.com Git - emacs.git/commitdiff
(lookup_image): Save frame foreground and background colors.
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Wed, 13 Jun 2007 08:22:12 +0000 (08:22 +0000)
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Wed, 13 Jun 2007 08:22:12 +0000 (08:22 +0000)
(search_image_cache): Check if saved and current frame colors match.

src/ChangeLog
src/image.c

index 8ec4efb98522ec58a019168cb3877dd35d73e5bc..06d9b481d169db088b4c6eab66e0e0b1f17e3e45 100644 (file)
@@ -1,3 +1,11 @@
+2007-06-13  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+       * dispextern.h (struct image) [HAVE_WINDOW_SYSTEM]: New members
+       frame_foreground and frame_background.
+
+       * image.c (lookup_image): Save frame foreground and background colors.
+       (search_image_cache): Check if saved and current frame colors match.
+
 2007-06-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * regex.c (regex_compile): Remove the `regnum' counter.
index 9cfcd5a63f8627898f01e41182e26324a5a88811..36e8a2ecb80c14ff2d09b34f12d08f16997ebef1 100644 (file)
@@ -1647,6 +1647,7 @@ search_image_cache (f, spec, hash)
 
   /* 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
@@ -1656,8 +1657,8 @@ search_image_cache (f, spec, hash)
   for (img = c->buckets[i]; img; img = img->next)
     if (img->hash == hash
        && !NILP (Fequal (img->spec, spec))
-       && (STRINGP (specified_bg)
-           || img->background == FRAME_BACKGROUND_PIXEL (f)))
+       && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f)
+       && img->frame_background == FRAME_BACKGROUND_PIXEL (f))
       break;
   return img;
 }
@@ -1929,6 +1930,8 @@ lookup_image (f, spec)
       img = make_image (spec, hash);
       cache_image (f, img);
       img->load_failed_p = img->type->load (f, img) == 0;
+      img->frame_foreground = FRAME_FOREGROUND_PIXEL (f);
+      img->frame_background = FRAME_BACKGROUND_PIXEL (f);
 
       /* If we can't load the image, and we don't have a width and
         height, use some arbitrary width and height so that we can