summaryrefslogtreecommitdiff
path: root/src/haiku_draw_support.cc
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-05-20 02:27:06 +0000
committerPo Lu <luangruo@yahoo.com>2022-05-20 02:28:29 +0000
commit8a7d8bb04b38ba9849b60d63c9fcfd36856eb424 (patch)
treeb105fcf9b03deeae53d07fcbd14ec9d0609bd6ca /src/haiku_draw_support.cc
parent9d557d4d4adf68ca15ca9aaa48470133544ede26 (diff)
downloademacs-8a7d8bb04b38ba9849b60d63c9fcfd36856eb424.tar.gz
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.
Diffstat (limited to 'src/haiku_draw_support.cc')
-rw-r--r--src/haiku_draw_support.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/haiku_draw_support.cc b/src/haiku_draw_support.cc
index 551af51d7c1..f0cc084bb37 100644
--- a/src/haiku_draw_support.cc
+++ b/src/haiku_draw_support.cc
@@ -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);
+}