[vte/wip/mosaic: 4/4] draw: Change checkboard pattern
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/mosaic: 4/4] draw: Change checkboard pattern
- Date: Tue, 12 Nov 2019 15:58:51 +0000 (UTC)
commit eab37315db00eeffb7330f648537dccf7de398b1
Author: Christian Persch <chpe src gnome org>
Date: Tue Nov 12 16:54:31 2019 +0100
draw: Change checkboard pattern
Use a checkboard fill pattern, instead of
a fixed 4x4 checkerboard.
doc/boxes.txt | 11 ++++++-----
src/vtedraw.cc | 28 ++++++++++++++++++----------
2 files changed, 24 insertions(+), 15 deletions(-)
---
diff --git a/doc/boxes.txt b/doc/boxes.txt
index 42b65087..c3275d98 100644
--- a/doc/boxes.txt
+++ b/doc/boxes.txt
@@ -168,12 +168,13 @@ Shades.
░ ░░░░░ ▒ ▒▒▒▒▒ ▓ ▓▓▓▓▓ ██▓▓▓▓▓██▓██▒▒▒▒▒██▒██░░░░░██░██
░░░░░ ▒▒▒▒▒ ▓▓▓▓▓ ██▓▓▓▓▓█████▒▒▒▒▒█████░░░░░█████
████████████████████████████████
-Hatchings
-🮘🮘🮘🮘 🮙🮙🮙🮙 🮘🮙🮘🮙
-🮘🮘🮘🮘 🮙🮙🮙🮙 🮙🮘🮙🮘
-🮘🮘🮘🮘 🮙🮙🮙🮙 🮘🮙🮘🮙
-🮘🮘🮘🮘 🮙🮙🮙🮙 🮙🮘🮙🮘
+Hatchings and Checkerboards
+
+🮘🮘🮘🮘 🮙🮙🮙🮙 🮘🮙🮘🮙 🮕🮕🮕🮕 🮖🮖🮖🮖 🮕🮖🮕🮖
+🮘🮘🮘🮘 🮙🮙🮙🮙 🮙🮘🮙🮘 🮕🮕🮕🮕 🮖🮖🮖🮖 🮖🮕🮖🮕
+🮘🮘🮘🮘 🮙🮙🮙🮙 🮘🮙🮘🮙 🮕🮕🮕🮕 🮖🮖🮖🮖 🮕🮖🮕🮖
+🮘🮘🮘🮘 🮙🮙🮙🮙 🮙🮘🮙🮘 🮕🮕🮕🮕 🮖🮖🮖🮖 🮖🮕🮖🮕
🬇🬋🬃 🬦🬹🬓 🬞🬭🬏 🬠🬰🬐 🬁🬂🬀 🬉🬎🬄 🬇🬋🬃
diff --git a/src/vtedraw.cc b/src/vtedraw.cc
index 635d7b67..f4b62852 100644
--- a/src/vtedraw.cc
+++ b/src/vtedraw.cc
@@ -1120,6 +1120,18 @@ static unsigned char const hatching_pattern_rl_data[16] = {
0x00, 0xff, 0x00, 0x00,
0xff, 0x00, 0x00, 0x00,
};
+static unsigned char const checkerboard_pattern_data[16] = {
+ 0xff, 0xff, 0x00, 0x00,
+ 0xff, 0xff, 0x00, 0x00,
+ 0x00, 0x00, 0xff, 0xff,
+ 0x00, 0x00, 0xff, 0xff,
+};
+static unsigned char const checkerboard_reverse_pattern_data[16] = {
+ 0x00, 0x00, 0xff, 0xff,
+ 0x00, 0x00, 0xff, 0xff,
+ 0xff, 0xff, 0x00, 0x00,
+ 0xff, 0xff, 0x00, 0x00,
+};
#define DEFINE_STATIC_PATTERN_FUNC(name,data,width,height,stride) \
static cairo_pattern_t* \
@@ -1145,6 +1157,8 @@ name(void) \
DEFINE_STATIC_PATTERN_FUNC(create_hatching_pattern_lr, hatching_pattern_lr_data, 4, 4, 4)
DEFINE_STATIC_PATTERN_FUNC(create_hatching_pattern_rl, hatching_pattern_rl_data, 4, 4, 4)
+DEFINE_STATIC_PATTERN_FUNC(create_checkerboard_pattern, checkerboard_pattern_data, 4, 4, 4)
+DEFINE_STATIC_PATTERN_FUNC(create_checkerboard_reverse_pattern, checkerboard_reverse_pattern_data, 4, 4, 4)
#undef DEFINE_STATIC_PATTERN_FUNC
@@ -2002,18 +2016,12 @@ _vte_draw_terminal_draw_graphic(struct _vte_draw *draw,
break;
case 0x1fb95:
+ PATTERN(cr, create_checkerboard_pattern(), width, height);
+ break;
+
case 0x1fb96:
- {
- int xi, yi;
- for (yi = 3; yi >= 0; yi--) {
- for (xi = 3; xi >= 0; xi--) {
- if ((xi ^ yi ^ c) & 1) {
- RECTANGLE(cr, x, y, width, height, 4, 4, xi, yi, xi + 1, yi + 1);
- }
- }
- }
+ PATTERN(cr, create_checkerboard_reverse_pattern(), width, height);
break;
- }
case 0x1fb97:
RECTANGLE(cr, x, y, width, height, 1, 4, 0, 1, 1, 2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]