mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-01 09:51:22 -08:00
Implement `cross-disabled-images' on Haiku
* src/haiku_draw_support.cc (be_draw_cross_on_pixmap_1) (be_draw_cross_on_pixmap): New functions. * src/haiku_support.h: Update prototypes. * src/image.c (image_pixmap_draw_cross, image_disable_image): Implement drawing cross on Haiku.
This commit is contained in:
parent
9d557d4d4a
commit
8a7d8bb04b
3 changed files with 49 additions and 10 deletions
|
|
@ -503,3 +503,40 @@ BView_InvertRect (void *view, int x, int y, int width, int height)
|
|||
|
||||
vw->InvertRect (BRect (x, y, x + width - 1, y + height - 1));
|
||||
}
|
||||
|
||||
static void
|
||||
be_draw_cross_on_pixmap_1 (BBitmap *bitmap, int x, int y, int width,
|
||||
int height, uint32_t color)
|
||||
{
|
||||
BBitmap dest (bitmap->Bounds (),
|
||||
bitmap->ColorSpace (),
|
||||
true, false);
|
||||
BView view (bitmap->Bounds (), NULL, B_FOLLOW_NONE, 0);
|
||||
rgb_color high_color;
|
||||
|
||||
rgb32_to_rgb_color (color, &high_color);
|
||||
dest.ImportBits (bitmap);
|
||||
|
||||
if (!dest.Lock ())
|
||||
return;
|
||||
|
||||
dest.AddChild (&view);
|
||||
|
||||
view.SetHighColor (high_color);
|
||||
view.StrokeLine (BPoint (x, y),
|
||||
BPoint (x + width - 1, y + height - 1));
|
||||
view.StrokeLine (BPoint (x, y + height - 1),
|
||||
BPoint (x + width - 1, y));
|
||||
view.RemoveSelf ();
|
||||
bitmap->ImportBits (&dest);
|
||||
}
|
||||
|
||||
void
|
||||
be_draw_cross_on_pixmap (void *bitmap, int x, int y, int width,
|
||||
int height, uint32_t color)
|
||||
{
|
||||
BBitmap *target = (BBitmap *) bitmap;
|
||||
|
||||
be_draw_cross_on_pixmap_1 (target, x, y, width, height,
|
||||
color);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -484,6 +484,8 @@ extern void hsl_color_rgb (double, double, double, uint32_t *);
|
|||
extern void *BBitmap_new (int, int, int);
|
||||
extern void *BBitmap_data (void *);
|
||||
extern int BBitmap_convert (void *, void **);
|
||||
extern void be_draw_cross_on_pixmap (void *, int, int, int, int,
|
||||
uint32_t);
|
||||
|
||||
extern void BBitmap_free (void *);
|
||||
|
||||
|
|
|
|||
20
src/image.c
20
src/image.c
|
|
@ -6307,7 +6307,7 @@ image_edge_detection (struct frame *f, struct image *img,
|
|||
}
|
||||
|
||||
|
||||
#if defined HAVE_X_WINDOWS || defined USE_CAIRO
|
||||
#if defined HAVE_X_WINDOWS || defined USE_CAIRO || defined HAVE_HAIKU
|
||||
static void
|
||||
image_pixmap_draw_cross (struct frame *f, Emacs_Pixmap pixmap,
|
||||
int x, int y, unsigned int width, unsigned int height,
|
||||
|
|
@ -6341,9 +6341,11 @@ image_pixmap_draw_cross (struct frame *f, Emacs_Pixmap pixmap,
|
|||
XDrawLine (dpy, pixmap, gc, x, y, x + width - 1, y + height - 1);
|
||||
XDrawLine (dpy, pixmap, gc, x, y + height - 1, x + width - 1, y);
|
||||
XFreeGC (dpy, gc);
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
#elif HAVE_HAIKU
|
||||
be_draw_cross_on_pixmap (pixmap, x, y, width, height, color);
|
||||
#endif
|
||||
}
|
||||
#endif /* HAVE_X_WINDOWS || USE_CAIRO */
|
||||
#endif /* HAVE_X_WINDOWS || USE_CAIRO || HAVE_HAIKU */
|
||||
|
||||
/* Transform image IMG on frame F so that it looks disabled. */
|
||||
|
||||
|
|
@ -6385,25 +6387,23 @@ image_disable_image (struct frame *f, struct image *img)
|
|||
{
|
||||
#ifndef HAVE_NTGUI
|
||||
#ifndef HAVE_NS /* TODO: NS support, however this not needed for toolbars */
|
||||
#ifndef HAVE_HAIKU
|
||||
|
||||
#ifndef USE_CAIRO
|
||||
#if !defined USE_CAIRO && !defined HAVE_HAIKU
|
||||
#define CrossForeground(f) BLACK_PIX_DEFAULT (f)
|
||||
#define MaskForeground(f) WHITE_PIX_DEFAULT (f)
|
||||
#else /* USE_CAIRO */
|
||||
#else /* USE_CAIRO || HAVE_HAIKU */
|
||||
#define CrossForeground(f) 0
|
||||
#define MaskForeground(f) PIX_MASK_DRAW
|
||||
#endif /* USE_CAIRO */
|
||||
#endif /* USE_CAIRO || HAVE_HAIKU */
|
||||
|
||||
#ifndef USE_CAIRO
|
||||
#if !defined USE_CAIRO && !defined HAVE_HAIKU
|
||||
image_sync_to_pixmaps (f, img);
|
||||
#endif /* !USE_CAIRO */
|
||||
#endif /* !USE_CAIRO && !HAVE_HAIKU */
|
||||
image_pixmap_draw_cross (f, img->pixmap, 0, 0, img->width, img->height,
|
||||
CrossForeground (f));
|
||||
if (img->mask)
|
||||
image_pixmap_draw_cross (f, img->mask, 0, 0, img->width, img->height,
|
||||
MaskForeground (f));
|
||||
#endif /* !HAVE_HAIKU */
|
||||
#endif /* !HAVE_NS */
|
||||
#else
|
||||
HDC hdc, bmpdc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue