[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/X_Typedefs 94b5d24 7/7: Introduce Emacs_Pix_Contai
From: |
Alexander Gramiak |
Subject: |
[Emacs-diffs] scratch/X_Typedefs 94b5d24 7/7: Introduce Emacs_Pix_Container and Emacs_Pix_Context typedefs |
Date: |
Mon, 13 May 2019 13:52:45 -0400 (EDT) |
branch: scratch/X_Typedefs
commit 94b5d24a60f7ceadaa974259aaea71cc1625f741
Author: Alexander Gramiak <address@hidden>
Commit: Alexander Gramiak <address@hidden>
Introduce Emacs_Pix_Container and Emacs_Pix_Context typedefs
Emacs_Pix_Container is a pointer to a struct representing pixmap data
on the backend. Emacs_Pix_Context is the context for the
bitmap/pixmap on the backend. Only w32 currently makes this
distinction; they are otherwise the same type.
* src/dispextern.h: Remove XImagePtr in favor of
using XImage* directly. Rename XImagePtr_or_DC to Emacs_Pix_Context.
[HAVE_X_WINDOWS] Alias Emacs_Pix_Container and
Emacs_Pix_Context to XImage*.
[HAVE_NS] Alias Emacs_Pix_Container and Emacs_Pix_Context to trivial
Emacs_Pixmap definition.
[HAVE_NTGUI]: Alias Emacs_Pix_Container to XImage* and
Emacs_Pix_Context to HDC.
* src/dispextern.h:
* src/image.c: Use Emacs_Pix_Container over XImagePtr and
Emacs_Pix_Context over XImagePtr_or_DC.
---
src/dispextern.h | 18 ++--
src/image.c | 253 ++++++++++++++++++++++++++++---------------------------
2 files changed, 138 insertions(+), 133 deletions(-)
diff --git a/src/dispextern.h b/src/dispextern.h
index 5349bec..7a6cd2f 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -92,16 +92,16 @@ xstrcasecmp (char const *a, char const *b)
#ifdef HAVE_X_WINDOWS
#include <X11/Xresource.h> /* for XrmDatabase */
typedef struct x_display_info Display_Info;
-typedef XImage * XImagePtr;
-typedef XImagePtr XImagePtr_or_DC;
+typedef XImage *Emacs_Pix_Container;
+typedef XImage *Emacs_Pix_Context;
#define NativeRectangle XRectangle
#endif
#ifdef HAVE_NTGUI
#include "w32gui.h"
typedef struct w32_display_info Display_Info;
-typedef XImage *XImagePtr;
-typedef HDC XImagePtr_or_DC;
+typedef XImage *Emacs_Pix_Container;
+typedef HDC Emacs_Pix_Context;
#endif
#ifdef HAVE_NS
@@ -109,8 +109,8 @@ typedef HDC XImagePtr_or_DC;
#define FACE_COLOR_TO_PIXEL(face_color, frame)
ns_color_index_to_rgba(face_color, frame)
/* Following typedef needed to accommodate the MSDOS port, believe it or not.
*/
typedef struct ns_display_info Display_Info;
-typedef Emacs_Pixmap XImagePtr;
-typedef XImagePtr XImagePtr_or_DC;
+typedef Emacs_Pixmap Emacs_Pix_Container;
+typedef Emacs_Pixmap Emacs_Pix_Context;
#else
#define FACE_COLOR_TO_PIXEL(face_color, frame) face_color
#endif
@@ -2993,7 +2993,7 @@ struct image
Non-NULL means it and its Pixmap counterpart may be out of sync
and the latter is outdated. NULL means the X image has been
synchronized to Pixmap. */
- XImagePtr ximg, mask_img;
+ XImage* ximg, *mask_img;
# ifdef HAVE_NATIVE_SCALING
/* Picture versions of pixmap and mask for compositing. */
@@ -3414,9 +3414,9 @@ ptrdiff_t lookup_image (struct frame *, Lisp_Object);
#endif
RGB_PIXEL_COLOR image_background (struct image *, struct frame *,
- XImagePtr_or_DC ximg);
+ Emacs_Pix_Context img);
int image_background_transparent (struct image *, struct frame *,
- XImagePtr_or_DC mask);
+ Emacs_Pix_Context mask);
int image_ascent (struct image *, struct face *, struct glyph_slice *);
diff --git a/src/image.c b/src/image.c
index f34d884..c26ed1c 100644
--- a/src/image.c
+++ b/src/image.c
@@ -132,17 +132,17 @@ static unsigned long *colors_in_color_table (int *n);
#ifdef HAVE_NS
/* Use with images created by ns_image_for_XPM. */
static unsigned long
-XGetPixel (XImagePtr ximage, int x, int y)
+XGetPixel (Emacs_Pix_Container image, int x, int y)
{
- return ns_get_pixel (ximage, x, y);
+ return ns_get_pixel (image, x, y);
}
/* Use with images created by ns_image_for_XPM; alpha set to 1;
pixel is assumed to be in RGB form. */
static void
-XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel)
+XPutPixel (Emacs_Pix_Container image, int x, int y, unsigned long pixel)
{
- ns_put_pixel (ximage, x, y, pixel);
+ ns_put_pixel (image, x, y, pixel);
}
#endif /* HAVE_NS */
@@ -412,18 +412,19 @@ typedef void Picture;
#endif
static bool image_create_x_image_and_pixmap_1 (struct frame *, int, int, int,
- XImagePtr *, Emacs_Pixmap *,
- Picture *);
-static void image_destroy_x_image (XImagePtr ximg);
+ Emacs_Pix_Container *,
+ Emacs_Pixmap *, Picture *);
+static void image_destroy_x_image (Emacs_Pix_Container);
#ifdef HAVE_NTGUI
-static XImagePtr_or_DC image_get_x_image_or_dc (struct frame *, struct image *,
- bool, HGDIOBJ *);
-static void image_unget_x_image_or_dc (struct image *, bool, XImagePtr_or_DC,
- HGDIOBJ);
+static HDC image_get_x_image_or_dc (struct frame *, struct image *,
+ bool, HGDIOBJ *);
+static void image_unget_x_image_or_dc (struct image *, bool,
+ HDC, HGDIOBJ);
#else
-static XImagePtr image_get_x_image (struct frame *, struct image *, bool);
-static void image_unget_x_image (struct image *, bool, XImagePtr);
+static Emacs_Pix_Container image_get_x_image (struct frame *, struct image *,
+ bool);
+static void image_unget_x_image (struct image *, bool, Emacs_Pix_Container);
#define image_get_x_image_or_dc(f, img, mask_p, dummy) \
image_get_x_image (f, img, mask_p)
#define image_unget_x_image_or_dc(img, mask_p, ximg, dummy) \
@@ -437,7 +438,7 @@ static void image_sync_to_pixmaps (struct frame *, struct
image *);
/* Useful functions defined in the section
`Image type independent image structures' below. */
-static unsigned long four_corners_best (XImagePtr ximg,
+static unsigned long four_corners_best (XImage *ximg,
int *corners,
unsigned long width,
unsigned long height);
@@ -450,7 +451,7 @@ void
x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
{
Pixmap pixmap, mask;
- XImagePtr ximg, mask_img;
+ XImage *ximg, *mask_img;
unsigned long width, height;
bool result;
unsigned long bg;
@@ -1180,10 +1181,10 @@ set_cairo_image_surface (struct image *img,
cairo_surface_t *surface)
/* Image background colors. */
/* Find the "best" corner color of a bitmap.
- On W32, XIMG is assumed to a device context with the bitmap selected. */
+ On W32, PIMG is assumed to a device context with the bitmap selected. */
static RGB_PIXEL_COLOR
-four_corners_best (XImagePtr_or_DC ximg, int *corners,
+four_corners_best (Emacs_Pix_Context pimg, int *corners,
unsigned long width, unsigned long height)
{
RGB_PIXEL_COLOR corner_pixels[4];
@@ -1192,19 +1193,19 @@ four_corners_best (XImagePtr_or_DC ximg, int *corners,
if (corners && corners[BOT_CORNER] >= 0)
{
- /* Get the colors at the corner_pixels of ximg. */
- corner_pixels[0] = GET_PIXEL (ximg, corners[LEFT_CORNER],
corners[TOP_CORNER]);
- corner_pixels[1] = GET_PIXEL (ximg, corners[RIGHT_CORNER] - 1,
corners[TOP_CORNER]);
- corner_pixels[2] = GET_PIXEL (ximg, corners[RIGHT_CORNER] - 1,
corners[BOT_CORNER] - 1);
- corner_pixels[3] = GET_PIXEL (ximg, corners[LEFT_CORNER],
corners[BOT_CORNER] - 1);
+ /* Get the colors at the corner_pixels of pimg. */
+ corner_pixels[0] = GET_PIXEL (pimg, corners[LEFT_CORNER],
corners[TOP_CORNER]);
+ corner_pixels[1] = GET_PIXEL (pimg, corners[RIGHT_CORNER] - 1,
corners[TOP_CORNER]);
+ corner_pixels[2] = GET_PIXEL (pimg, corners[RIGHT_CORNER] - 1,
corners[BOT_CORNER] - 1);
+ corner_pixels[3] = GET_PIXEL (pimg, corners[LEFT_CORNER],
corners[BOT_CORNER] - 1);
}
else
{
- /* Get the colors at the corner_pixels of ximg. */
- corner_pixels[0] = GET_PIXEL (ximg, 0, 0);
- corner_pixels[1] = GET_PIXEL (ximg, width - 1, 0);
- corner_pixels[2] = GET_PIXEL (ximg, width - 1, height - 1);
- corner_pixels[3] = GET_PIXEL (ximg, 0, height - 1);
+ /* Get the colors at the corner_pixels of pimg. */
+ corner_pixels[0] = GET_PIXEL (pimg, 0, 0);
+ corner_pixels[1] = GET_PIXEL (pimg, width - 1, 0);
+ corner_pixels[2] = GET_PIXEL (pimg, width - 1, height - 1);
+ corner_pixels[3] = GET_PIXEL (pimg, 0, height - 1);
}
/* Choose the most frequently found color as background. */
for (i = best_count = 0; i < 4; ++i)
@@ -1224,27 +1225,27 @@ four_corners_best (XImagePtr_or_DC ximg, int *corners,
/* Return the `background' field of IMG. If IMG doesn't have one yet,
it is guessed heuristically. If non-zero, XIMG is an existing
- XImage object (or device context with the image selected on W32) to
- use for the heuristic. */
+ Emacs_Pix_Context object (device context with the image selected on
+ W32) to use for the heuristic. */
RGB_PIXEL_COLOR
-image_background (struct image *img, struct frame *f, XImagePtr_or_DC ximg)
+image_background (struct image *img, struct frame *f, Emacs_Pix_Context pimg)
{
if (! img->background_valid)
/* IMG doesn't have a background yet, try to guess a reasonable value. */
{
- bool free_ximg = !ximg;
+ bool free_pimg = !pimg;
#ifdef HAVE_NTGUI
HGDIOBJ prev;
#endif /* HAVE_NTGUI */
- if (free_ximg)
- ximg = image_get_x_image_or_dc (f, img, 0, &prev);
+ if (free_pimg)
+ pimg = image_get_x_image_or_dc (f, img, 0, &prev);
- img->background = four_corners_best (ximg, img->corners, img->width,
img->height);
+ img->background = four_corners_best (pimg, img->corners, img->width,
img->height);
- if (free_ximg)
- image_unget_x_image_or_dc (img, 0, ximg, prev);
+ if (free_pimg)
+ image_unget_x_image_or_dc (img, 0, pimg, prev);
img->background_valid = 1;
}
@@ -1254,10 +1255,12 @@ image_background (struct image *img, struct frame *f,
XImagePtr_or_DC ximg)
/* Return the `background_transparent' field of IMG. If IMG doesn't
have one yet, it is guessed heuristically. If non-zero, MASK is an
- existing XImage object to use for the heuristic. */
+ existing Emacs_Pix_Context (XImage* on X) object to use for the
+ heuristic. */
int
-image_background_transparent (struct image *img, struct frame *f,
XImagePtr_or_DC mask)
+image_background_transparent (struct image *img, struct frame *f,
+ Emacs_Pix_Context mask)
{
if (! img->background_transparent_valid)
/* IMG doesn't have a background yet, try to guess a reasonable value. */
@@ -2060,7 +2063,7 @@ mark_image_cache (struct image_cache *c)
WIDTH and HEIGHT must both be positive.
If XIMG is null, assume it is a bitmap. */
static bool
-image_check_image_size (XImagePtr ximg, int width, int height)
+image_check_image_size (Emacs_Pix_Container ximg, int width, int height)
{
#ifdef HAVE_X_WINDOWS
/* Respect Xlib's limits: it cannot deal with images that have more
@@ -2094,19 +2097,20 @@ image_check_image_size (XImagePtr ximg, int width, int
height)
#endif
}
-/* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on
- frame F. Set *XIMG and *PIXMAP to the XImage and Emacs_Pixmap
- created. Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels
- allocated via xmalloc. Print error messages via image_error if an
- error occurs. Value is true if successful.
+/* Create an Emacs_Pix_Container and a pixmap of size WIDTH x
+ HEIGHT for use on frame F. Set *PIMG and *PIXMAP to the
+ Emacs_Pix_Container and Emacs_Pixmap created. Set (*PIMG)->data
+ to a raster of WIDTH x HEIGHT pixels allocated via xmalloc. Print
+ error messages via image_error if an error occurs. Value is true
+ if successful.
On W32, a DEPTH of zero signifies a 24 bit image, otherwise DEPTH
should indicate the bit depth of the image. */
static bool
image_create_x_image_and_pixmap_1 (struct frame *f, int width, int height, int
depth,
- XImagePtr *ximg, Emacs_Pixmap *pixmap,
- Picture *picture)
+ Emacs_Pix_Container *pimg,
+ Emacs_Pixmap *pixmap, Picture *picture)
{
#ifdef HAVE_X_WINDOWS
Display *display = FRAME_X_DISPLAY (f);
@@ -2117,33 +2121,33 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int
width, int height, int d
if (depth <= 0)
depth = DefaultDepthOfScreen (screen);
- *ximg = XCreateImage (display, DefaultVisualOfScreen (screen),
+ *pimg = XCreateImage (display, DefaultVisualOfScreen (screen),
depth, ZPixmap, 0, NULL, width, height,
depth > 16 ? 32 : depth > 8 ? 16 : 8, 0);
- if (*ximg == NULL)
+ if (*pimg == NULL)
{
image_error ("Unable to allocate X image");
return 0;
}
- if (! image_check_image_size (*ximg, width, height))
+ if (! image_check_image_size (*pimg, width, height))
{
- image_destroy_x_image (*ximg);
- *ximg = NULL;
+ image_destroy_x_image (*pimg);
+ *pimg = NULL;
image_error ("Image too large (%dx%d)",
make_fixnum (width), make_fixnum (height));
return 0;
}
/* Allocate image raster. */
- (*ximg)->data = xmalloc ((*ximg)->bytes_per_line * height);
+ (*pimg)->data = xmalloc ((*pimg)->bytes_per_line * height);
/* Allocate a pixmap of the same size. */
*pixmap = XCreatePixmap (display, drawable, width, height, depth);
if (*pixmap == NO_PIXMAP)
{
- image_destroy_x_image (*ximg);
- *ximg = NULL;
+ image_destroy_x_image (*pimg);
+ *pimg = NULL;
image_error ("Unable to create X pixmap");
return 0;
}
@@ -2210,10 +2214,10 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int
width, int height, int d
if (depth < 16)
palette_colors = 1 << (depth - 1);
- *ximg = xmalloc (sizeof (XImage) + palette_colors * sizeof (RGBQUAD));
+ *pimg = xmalloc (sizeof (XImage) + palette_colors * sizeof (RGBQUAD));
- header = &(*ximg)->info.bmiHeader;
- memset (&(*ximg)->info, 0, sizeof (BITMAPINFO));
+ header = &(*pimg)->info.bmiHeader;
+ memset (&(*pimg)->info, 0, sizeof (BITMAPINFO));
header->biSize = sizeof (*header);
header->biWidth = width;
header->biHeight = -height; /* negative indicates a top-down bitmap. */
@@ -2225,10 +2229,10 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int
width, int height, int d
/* TODO: fill in palette. */
if (depth == 1)
{
- (*ximg)->info.bmiColors[0].rgbBlue = 0;
- (*ximg)->info.bmiColors[0].rgbGreen = 0;
- (*ximg)->info.bmiColors[0].rgbRed = 0;
- (*ximg)->info.bmiColors[0].rgbReserved = 0;
+ (*pimg)->info.bmiColors[0].rgbBlue = 0;
+ (*pimg)->info.bmiColors[0].rgbGreen = 0;
+ (*pimg)->info.bmiColors[0].rgbRed = 0;
+ (*pimg)->info.bmiColors[0].rgbReserved = 0;
/* bmiColors is a variable-length array declared by w32api
headers as bmiColors[1], which triggers a warning under
-Warray-bounds; shut that up. */
@@ -2236,10 +2240,10 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int
width, int height, int d
# pragma GCC push_options
# pragma GCC diagnostic ignored "-Warray-bounds"
# endif
- (*ximg)->info.bmiColors[1].rgbBlue = 255;
- (*ximg)->info.bmiColors[1].rgbGreen = 255;
- (*ximg)->info.bmiColors[1].rgbRed = 255;
- (*ximg)->info.bmiColors[1].rgbReserved = 0;
+ (*pimg)->info.bmiColors[1].rgbBlue = 255;
+ (*pimg)->info.bmiColors[1].rgbGreen = 255;
+ (*pimg)->info.bmiColors[1].rgbRed = 255;
+ (*pimg)->info.bmiColors[1].rgbReserved = 0;
# if GNUC_PREREQ (4, 4, 0)
# pragma GCC pop_options
# endif
@@ -2249,10 +2253,10 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int
width, int height, int d
/* Create a DIBSection and raster array for the bitmap,
and store its handle in *pixmap. */
- *pixmap = CreateDIBSection (hdc, &((*ximg)->info),
+ *pixmap = CreateDIBSection (hdc, &((*pimg)->info),
(depth < 16) ? DIB_PAL_COLORS : DIB_RGB_COLORS,
/* casting avoids a GCC warning */
- (void **)&((*ximg)->data), NULL, 0);
+ (void **)&((*pimg)->data), NULL, 0);
/* Realize display palette and garbage all frames. */
release_frame_dc (f, hdc);
@@ -2264,8 +2268,8 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int
width, int height, int d
/* All system errors are < 10000, so the following is safe. */
XSETINT (errcode, err);
image_error ("Unable to create bitmap, error code %d", errcode);
- image_destroy_x_image (*ximg);
- *ximg = NULL;
+ image_destroy_x_image (*pimg);
+ *pimg = NULL;
return 0;
}
@@ -2277,69 +2281,70 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int
width, int height, int d
*pixmap = ns_image_for_XPM (width, height, depth);
if (*pixmap == 0)
{
- *ximg = NULL;
+ *pimg = NULL;
image_error ("Unable to allocate NSImage for XPM pixmap");
return 0;
}
- *ximg = *pixmap;
+ *pimg = *pixmap;
return 1;
#endif
}
-/* Destroy XImage XIMG. Free XIMG->data. */
+/* Destroy Emacs_Pix_Container PIMG. Free data associated with PIMG. */
static void
-image_destroy_x_image (XImagePtr ximg)
+image_destroy_x_image (Emacs_Pix_Container pimg)
{
eassert (input_blocked_p ());
- if (ximg)
+ if (pimg)
{
#ifdef HAVE_X_WINDOWS
- xfree (ximg->data);
- ximg->data = NULL;
- XDestroyImage (ximg);
+ xfree (pimg->data);
+ pimg->data = NULL;
+ XDestroyImage (pimg);
#endif /* HAVE_X_WINDOWS */
#ifdef HAVE_NTGUI
/* Data will be freed by DestroyObject. */
- ximg->data = NULL;
- xfree (ximg);
+ pimg->data = NULL;
+ xfree (pimg);
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
- ns_release_object (ximg);
+ ns_release_object (pimg);
#endif /* HAVE_NS */
}
}
-/* Put XImage XIMG into pixmap PIXMAP on frame F. WIDTH and HEIGHT
- are width and height of both the image and pixmap. */
+/* Put Emacs_Pix_Container PIMG into pixmap PIXMAP on frame F.
+ WIDTH and HEIGHT are width and height of both the image and
+ pixmap. */
static void
-gui_put_x_image (struct frame *f, XImagePtr ximg, Emacs_Pixmap pixmap,
- int width, int height)
+gui_put_x_image (struct frame *f, Emacs_Pix_Container pimg,
+ Emacs_Pixmap pixmap, int width, int height)
{
#ifdef HAVE_X_WINDOWS
GC gc;
eassert (input_blocked_p ());
gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL);
- XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0,
- ximg->width, ximg->height);
+ XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, pimg, 0, 0, 0, 0,
+ pimg->width, pimg->height);
XFreeGC (FRAME_X_DISPLAY (f), gc);
#endif /* HAVE_X_WINDOWS */
#ifdef HAVE_NTGUI
#if 0 /* I don't think this is necessary looking at where it is used. */
HDC hdc = get_frame_dc (f);
- SetDIBits (hdc, pixmap, 0, height, ximg->data, &(ximg->info),
DIB_RGB_COLORS);
+ SetDIBits (hdc, pixmap, 0, height, pimg->data, &(pimg->info),
DIB_RGB_COLORS);
release_frame_dc (f, hdc);
#endif
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
- eassert (ximg == pixmap);
- ns_retain_object (ximg);
+ eassert (pimg == pixmap);
+ ns_retain_object (pimg);
#endif
}
@@ -2349,7 +2354,7 @@ gui_put_x_image (struct frame *f, XImagePtr ximg,
Emacs_Pixmap pixmap,
static bool
image_create_x_image_and_pixmap (struct frame *f, struct image *img,
int width, int height, int depth,
- XImagePtr *ximg, bool mask_p)
+ Emacs_Pix_Container *ximg, bool mask_p)
{
eassert ((!mask_p ? img->pixmap : img->mask) == NO_PIXMAP);
@@ -2362,14 +2367,14 @@ image_create_x_image_and_pixmap (struct frame *f,
struct image *img,
picture);
}
-/* Put X image XIMG into image IMG on frame F, as a mask if and only
- if MASK_P. On X, this simply records XIMG on a member of IMG, so
+/* Put pixel image PIMG into image IMG on frame F, as a mask if and only
+ if MASK_P. On X, this simply records PIMG on a member of IMG, so
it can be put into the pixmap afterwards via image_sync_to_pixmaps.
- On the other platforms, it puts XIMG into the pixmap, then frees
- the X image and its buffer. */
+ On the other platforms, it puts PIMG into the pixmap, then frees
+ the pixel image and its buffer. */
static void
-image_put_x_image (struct frame *f, struct image *img, XImagePtr ximg,
+image_put_x_image (struct frame *f, struct image *img, Emacs_Pix_Container
ximg,
bool mask_p)
{
#ifdef HAVE_X_WINDOWS
@@ -2417,12 +2422,12 @@ image_sync_to_pixmaps (struct frame *f, struct image
*img)
currently selected GDI object into *PREV for future restoration by
image_unget_x_image_or_dc. */
-static XImagePtr_or_DC
+static HDC
image_get_x_image_or_dc (struct frame *f, struct image *img, bool mask_p,
HGDIOBJ *prev)
{
HDC frame_dc = get_frame_dc (f);
- XImagePtr_or_DC ximg = CreateCompatibleDC (frame_dc);
+ HDC ximg = CreateCompatibleDC (frame_dc);
release_frame_dc (f, frame_dc);
*prev = SelectObject (ximg, !mask_p ? img->pixmap : img->mask);
@@ -2432,7 +2437,7 @@ image_get_x_image_or_dc (struct frame *f, struct image
*img, bool mask_p,
static void
image_unget_x_image_or_dc (struct image *img, bool mask_p,
- XImagePtr_or_DC ximg, HGDIOBJ prev)
+ HDC ximg, HGDIOBJ prev)
{
SelectObject (ximg, prev);
DeleteDC (ximg);
@@ -2441,11 +2446,11 @@ image_unget_x_image_or_dc (struct image *img, bool
mask_p,
/* Get the X image for IMG on frame F. The resulting X image data
should be treated as read-only at least on X. */
-static XImagePtr
+static Emacs_Pix_Container
image_get_x_image (struct frame *f, struct image *img, bool mask_p)
{
#ifdef HAVE_X_WINDOWS
- XImagePtr ximg_in_img = !mask_p ? img->ximg : img->mask_img;
+ XImage *ximg_in_img = !mask_p ? img->ximg : img->mask_img;
if (ximg_in_img)
return ximg_in_img;
@@ -2453,7 +2458,7 @@ image_get_x_image (struct frame *f, struct image *img,
bool mask_p)
return XGetImage (FRAME_X_DISPLAY (f), !mask_p ? img->pixmap : img->mask,
0, 0, img->width, img->height, ~0, ZPixmap);
#elif defined (HAVE_NS)
- XImagePtr pixmap = !mask_p ? img->pixmap : img->mask;
+ Emacs_Pix_Container pixmap = !mask_p ? img->pixmap : img->mask;
ns_retain_object (pixmap);
return pixmap;
@@ -2461,10 +2466,10 @@ image_get_x_image (struct frame *f, struct image *img,
bool mask_p)
}
static void
-image_unget_x_image (struct image *img, bool mask_p, XImagePtr ximg)
+image_unget_x_image (struct image *img, bool mask_p, Emacs_Pix_Container ximg)
{
#ifdef HAVE_X_WINDOWS
- XImagePtr ximg_in_img = !mask_p ? img->ximg : img->mask_img;
+ XImage *ximg_in_img = !mask_p ? img->ximg : img->mask_img;
if (ximg_in_img)
eassert (ximg == ximg_in_img);
@@ -4300,7 +4305,7 @@ xpm_load_image (struct frame *f,
#ifndef HAVE_NS
bool have_mask = false;
#endif
- XImagePtr ximg = NULL, mask_img = NULL;
+ Emacs_Pix_Container ximg = NULL, mask_img = NULL;
#define match() \
LA1 = xpm_scan (&s, end, &beg, &len)
@@ -4882,7 +4887,7 @@ image_to_emacs_colors (struct frame *f, struct image
*img, bool rgb_p)
{
int x, y;
Emacs_Color *colors, *p;
- XImagePtr_or_DC ximg;
+ Emacs_Pix_Context ximg;
ptrdiff_t nbytes;
#ifdef HAVE_NTGUI
HGDIOBJ prev;
@@ -4938,7 +4943,7 @@ image_to_emacs_colors (struct frame *f, struct image
*img, bool rgb_p)
stored in ximg->data. */
static void
-XPutPixel (XImagePtr ximg, int x, int y, COLORREF color)
+XPutPixel (XImage *ximg, int x, int y, COLORREF color)
{
int width = ximg->info.bmiHeader.biWidth;
unsigned char * pixel;
@@ -4985,7 +4990,7 @@ static void
image_from_emacs_colors (struct frame *f, struct image *img, Emacs_Color
*colors)
{
int x, y;
- XImagePtr oimg = NULL;
+ Emacs_Pix_Container oimg = NULL;
Emacs_Color *p;
init_color_table ();
@@ -5257,13 +5262,13 @@ static void
image_build_heuristic_mask (struct frame *f, struct image *img,
Lisp_Object how)
{
- XImagePtr_or_DC ximg;
+ Emacs_Pix_Context ximg;
#ifdef HAVE_NTGUI
HGDIOBJ prev;
char *mask_img;
int row_width;
#elif !defined HAVE_NS
- XImagePtr mask_img;
+ Emacs_Pix_Container mask_img;
#endif
int x, y;
bool use_img_background;
@@ -5515,7 +5520,7 @@ pbm_load (struct frame *f, struct image *img)
char *contents = NULL;
char *end, *p;
#ifndef USE_CAIRO
- XImagePtr ximg;
+ Emacs_Pix_Container ximg;
#endif
specified_file = image_spec_value (img->spec, QCfile, NULL);
@@ -5815,7 +5820,7 @@ pbm_load (struct frame *f, struct image *img)
#else
if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
/* Casting avoids a GCC warning. */
- IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
/* Put ximg into the image. */
image_put_x_image (f, img, ximg, 0);
@@ -6160,7 +6165,7 @@ png_load_body (struct frame *f, struct image *img, struct
png_load_context *c)
cairo_surface_t *surface;
uint32_t *dataptr;
#else
- XImagePtr ximg, mask_img = NULL;
+ Emacs_Pix_Container ximg, mask_img = NULL;
#endif
/* Find out what file to load. */
@@ -6473,7 +6478,7 @@ png_load_body (struct frame *f, struct image *img, struct
png_load_context *c)
#else
/* Maybe fill in the background field while we have ximg handy.
Casting avoids a GCC warning. */
- IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
/* Put ximg into the image. */
image_put_x_image (f, img, ximg, 0);
@@ -6483,7 +6488,7 @@ png_load_body (struct frame *f, struct image *img, struct
png_load_context *c)
{
/* Fill in the background_transparent field while we have the
mask handy. Casting avoids a GCC warning. */
- image_background_transparent (img, f, (XImagePtr_or_DC)mask_img);
+ image_background_transparent (img, f, (Emacs_Pix_Context)mask_img);
image_put_x_image (f, img, mask_img, 1);
}
@@ -6924,7 +6929,7 @@ jpeg_load_body (struct frame *f, struct image *img,
int i, ir, ig, ib;
#ifndef USE_CAIRO
unsigned long *colors;
- XImagePtr ximg = NULL;
+ Emacs_Pix_Container ximg = NULL;
#endif
/* Open the JPEG file. */
@@ -7114,7 +7119,7 @@ jpeg_load_body (struct frame *f, struct image *img,
/* Maybe fill in the background field while we have ximg handy. */
if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
/* Casting avoids a GCC warning. */
- IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
/* Put ximg into the image. */
image_put_x_image (f, img, ximg, 0);
@@ -7435,7 +7440,7 @@ tiff_load (struct frame *f, struct image *img)
int width, height, x, y, count;
uint32 *buf;
int rc;
- XImagePtr ximg;
+ Emacs_Pix_Container ximg;
tiff_memory_source memsrc;
Lisp_Object image;
@@ -7605,7 +7610,7 @@ tiff_load (struct frame *f, struct image *img)
/* Maybe fill in the background field while we have ximg handy. */
if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
/* Casting avoids a GCC warning on W32. */
- IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
/* Put ximg into the image. */
image_put_x_image (f, img, ximg, 0);
@@ -8031,7 +8036,7 @@ gif_load (struct frame *f, struct image *img)
}
#else
/* Create the X image and pixmap. */
- XImagePtr ximg;
+ Emacs_Pix_Container ximg;
if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
{
gif_close (gif, NULL);
@@ -8261,7 +8266,7 @@ gif_load (struct frame *f, struct image *img)
/* Maybe fill in the background field while we have ximg handy. */
if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
/* Casting avoids a GCC warning. */
- IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
/* Put ximg into the image. */
image_put_x_image (f, img, ximg, 0);
@@ -8668,7 +8673,7 @@ imagemagick_load_image (struct frame *f, struct image
*img,
size_t image_width, image_height;
MagickBooleanType status;
#ifndef USE_CAIRO
- XImagePtr ximg;
+ Emacs_Pix_Container ximg;
#endif
int x, y;
MagickWand *image_wand;
@@ -9523,7 +9528,7 @@ svg_load_image (struct frame *f, struct image *img, char
*contents,
g_object_unref (pixbuf);
#else
/* Try to create a x pixmap to hold the svg pixmap. */
- XImagePtr ximg;
+ Emacs_Pix_Container ximg;
if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
{
g_object_unref (pixbuf);
@@ -9590,7 +9595,7 @@ svg_load_image (struct frame *f, struct image *img, char
*contents,
/* Maybe fill in the background field while we have ximg handy.
Casting avoids a GCC warning. */
- IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ IMAGE_BACKGROUND (img, f, (Emacs_Pix_Context)ximg);
/* Put ximg into the image. */
image_put_x_image (f, img, ximg, 0);
@@ -9844,7 +9849,7 @@ x_kill_gs_process (Emacs_Pixmap pixmap, struct frame *f)
img->pixmap. */
if (x_mutable_colormap (FRAME_X_VISUAL (f)))
{
- XImagePtr ximg;
+ XImage *ximg;
block_input ();
- [Emacs-diffs] branch scratch/X_Typedefs created (now 94b5d24), Alexander Gramiak, 2019/05/13
- [Emacs-diffs] scratch/X_Typedefs 8e8290d 2/7: Introduce Emacs_Cursor typedef, Alexander Gramiak, 2019/05/13
- [Emacs-diffs] scratch/X_Typedefs 38a5217 3/7: Introduce Emacs_Pixmap typedef, Alexander Gramiak, 2019/05/13
- [Emacs-diffs] scratch/X_Typedefs 668ee43 4/7: Introduce Emacs_Rectangle struct and typedef, Alexander Gramiak, 2019/05/13
- [Emacs-diffs] scratch/X_Typedefs 09c65d6 5/7: Introduce Emacs_GC struct and typedef, Alexander Gramiak, 2019/05/13
- [Emacs-diffs] scratch/X_Typedefs 187bb8a 1/7: Introduce Emacs_Color struct and typedef, Alexander Gramiak, 2019/05/13
- [Emacs-diffs] scratch/X_Typedefs c0f62cb 6/7: Replace XChar2b with unsigned short in all font backends, Alexander Gramiak, 2019/05/13
- [Emacs-diffs] scratch/X_Typedefs 94b5d24 7/7: Introduce Emacs_Pix_Container and Emacs_Pix_Context typedefs,
Alexander Gramiak <=