Lisp_Object
xg_get_page_setup (void)
{
- GtkPageOrientation orientation;
Lisp_Object orientation_symbol;
if (page_setup == NULL)
page_setup = gtk_page_setup_new ();
- orientation = gtk_page_setup_get_orientation (page_setup);
- if (orientation == GTK_PAGE_ORIENTATION_PORTRAIT)
- orientation_symbol = Qportrait;
- else if (orientation == GTK_PAGE_ORIENTATION_LANDSCAPE)
- orientation_symbol = Qlandscape;
- else if (orientation == GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT)
- orientation_symbol = Qreverse_portrait;
- else if (orientation == GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE)
- orientation_symbol = Qreverse_landscape;
+
+ switch (gtk_page_setup_get_orientation (page_setup))
+ {
+ case GTK_PAGE_ORIENTATION_PORTRAIT:
+ orientation_symbol = Qportrait;
+ break;
+ case GTK_PAGE_ORIENTATION_LANDSCAPE:
+ orientation_symbol = Qlandscape;
+ break;
+ case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT:
+ orientation_symbol = Qreverse_portrait;
+ break;
+ case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE:
+ orientation_symbol = Qreverse_landscape;
+ break;
+ default:
+ eassume (false);
+ }
return listn (CONSTYPE_HEAP, 7,
Fcons (Qorientation, orientation_symbol),
#endif /* HAVE_WINDOW_SYSTEM */
#ifdef HAVE_X_WINDOWS
-#define COLOR_TABLE_SUPPORT 1
-
typedef struct x_bitmap_record Bitmap_Record;
#define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y)
#define NO_PIXMAP None
# include "w32.h"
#endif
-/* W32_TODO : Color tables on W32. */
-#undef COLOR_TABLE_SUPPORT
-
typedef struct w32_bitmap_record Bitmap_Record;
#define GET_PIXEL(ximg, x, y) GetPixel (ximg, x, y)
#define NO_PIXMAP 0
#endif /* HAVE_NTGUI */
-#ifdef USE_CAIRO
-#undef COLOR_TABLE_SUPPORT
-#endif
-
#ifdef HAVE_NS
-#undef COLOR_TABLE_SUPPORT
-
typedef struct ns_bitmap_record Bitmap_Record;
#define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y)
#define DefaultDepthOfScreen(screen) x_display_list->n_planes
#endif /* HAVE_NS */
+#if (defined HAVE_X_WINDOWS \
+ && ! (defined HAVE_NTGUI || defined USE_CAIRO || defined HAVE_NS))
+/* W32_TODO : Color tables on W32. */
+# define COLOR_TABLE_SUPPORT 1
+#endif
+
static void x_disable_image (struct frame *, struct image *);
static void x_edge_detection (struct frame *, struct image *, Lisp_Object,
Lisp_Object);
static unsigned long
lookup_rgb_color (struct frame *f, int r, int g, int b)
{
- unsigned long pixel;
-
#ifdef HAVE_NTGUI
- pixel = PALETTERGB (r >> 8, g >> 8, b >> 8);
-#endif /* HAVE_NTGUI */
-
-#ifdef HAVE_NS
- pixel = RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
-#endif /* HAVE_NS */
- return pixel;
+ return PALETTERGB (r >> 8, g >> 8, b >> 8);
+#elif defined HAVE_NS
+ return RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
+#else
+ eassume (false);
+#endif
}
static void
{
unsigned char *data = (unsigned char *) xmalloc (width*height*4);
uint32_t *dataptr = (uint32_t *) data;
- int r, g, b, a;
for (y = 0; y < height; ++y)
{
{
int rc, width, height, x, y, i, j;
ColorMapObject *gif_color_map;
- unsigned long pixel_colors[256];
GifFileType *gif;
gif_memory_source memsrc;
Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL);
Lisp_Object specified_file = image_spec_value (img->spec, QCfile, NULL);
Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL);
- unsigned long bgcolor = 0;
EMACS_INT idx;
int gif_err;
#ifdef USE_CAIRO
unsigned char *data = 0;
#else
+ unsigned long pixel_colors[256];
+ unsigned long bgcolor = 0;
XImagePtr ximg;
#endif
gif_load call to construct and save all animation frames. */
init_color_table ();
+
+#ifndef USE_CAIRO
if (STRINGP (specified_bg))
bgcolor = x_alloc_image_color (f, img, specified_bg,
FRAME_BACKGROUND_PIXEL (f));
+#endif
+
for (j = 0; j <= idx; ++j)
{
/* We use a local variable `raster' here because RasterBits is a
int height;
const guint8 *pixels;
int rowstride;
- XImagePtr ximg;
- Lisp_Object specified_bg;
- XColor background;
- int x;
- int y;
#if ! GLIB_CHECK_VERSION (2, 36, 0)
/* g_type_init is a glib function that must be called prior to
#ifdef USE_CAIRO
{
unsigned char *data = (unsigned char *) xmalloc (width*height*4);
- int y;
uint32_t bgcolor = get_spec_bg_or_alpha_as_argb (img, f);
- for (y = 0; y < height; ++y)
+ for (int y = 0; y < height; ++y)
{
const guchar *iconptr = pixels + y * rowstride;
uint32_t *dataptr = (uint32_t *) (data + y * rowstride);
- int x;
- for (x = 0; x < width; ++x)
+ for (int x = 0; x < width; ++x)
{
if (iconptr[3] == 0)
*dataptr = bgcolor;
}
#else
/* Try to create a x pixmap to hold the svg pixmap. */
+ XImagePtr ximg;
if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
{
g_object_unref (pixbuf);
/* Handle alpha channel by combining the image with a background
color. */
- specified_bg = image_spec_value (img->spec, QCbackground, NULL);
+ XColor background;
+ Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL);
if (!STRINGP (specified_bg)
|| !x_defined_color (f, SSDATA (specified_bg), &background, 0))
x_query_frame_background_color (f, &background);
non-transparent images. Each pixel must be "flattened" by
calculating the resulting color, given the transparency of the
pixel, and the image background color. */
- for (y = 0; y < height; ++y)
+ for (int y = 0; y < height; ++y)
{
- for (x = 0; x < width; ++x)
+ for (int x = 0; x < width; ++x)
{
int red;
int green;
0, 0, img->width, img->height, ~0, ZPixmap);
if (ximg)
{
- int x, y;
-
/* Initialize the color table. */
init_color_table ();
color table. After having done so, the color table will
contain an entry for each color used by the image. */
#ifdef COLOR_TABLE_SUPPORT
- for (y = 0; y < img->height; ++y)
- for (x = 0; x < img->width; ++x)
+ for (int y = 0; y < img->height; ++y)
+ for (int x = 0; x < img->width; ++x)
{
unsigned long pixel = XGetPixel (ximg, x, y);
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
Display *display = FRAME_X_DISPLAY (f);
- Window window = FRAME_X_WINDOW (f);
GC gc = f->output_data.x->normal_gc;
struct face *face = p->face;
#else /* not USE_CAIRO */
if (p->which)
{
+ Window window = FRAME_X_WINDOW (f);
char *bits;
Pixmap pixmap, clipmask = (Pixmap) 0;
int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f));
/* Like XClearArea, but check that WIDTH and HEIGHT are reasonable.
If they are <= 0, this is probably an error. */
-static void
+static ATTRIBUTE_UNUSED void
x_clear_area1 (Display *dpy, Window window,
int x, int y, int width, int height, int exposures)
{
XClearArea (dpy, window, x, y, width, height, exposures);
}
-
void
x_clear_area (struct frame *f, int x, int y, int width, int height)
{