return Qnil;
}
-static int
+static size_t
image_frame_cache_size (struct frame *f)
{
- int total = 0;
-#ifdef USE_CAIRO
+ size_t total = 0;
+#if defined USE_CAIRO
struct image_cache *c = FRAME_IMAGE_CACHE (f);
if (!c)
total += img->pixmap->width * img->pixmap->height *
img->pixmap->bits_per_pixel / 8;
}
+#elif defined HAVE_NTGUI
+ struct image_cache *c = FRAME_IMAGE_CACHE (f);
+
+ if (!c)
+ return 0;
+
+ for (ptrdiff_t i = 0; i < c->used; ++i)
+ {
+ struct image *img = c->images[i];
+
+ if (img && img->pixmap && img->pixmap != NO_PIXMAP)
+ total += w32_image_size (img);
+ }
#endif
return total;
}
(void)
{
Lisp_Object tail, frame;
- int total = 0;
+ size_t total = 0;
FOR_EACH_FRAME (tail, frame)
if (FRAME_WINDOW_P (XFRAME (frame)))
Lisp_Object spec_file, Lisp_Object spec_data);
extern bool w32_can_use_native_image_api (Lisp_Object);
extern void w32_gdiplus_shutdown (void);
+extern size_t w32_image_size (struct image *);
#define FACE_DEFAULT (~0)
RestoreDC (s->hdc ,-1);
}
+size_t
+w32_image_size (struct image *img)
+{
+ BITMAP bm_info;
+ size_t rv = 0;
+
+ if (GetObject (img->pixmap, sizeof (BITMAP), &bm_info))
+ rv = bm_info.bmWidth * bm_info.bmHeight * bm_info.bmBitsPixel / 8;
+ return rv;
+}
+
/* Draw a relief around the image glyph string S. */