[vte] draw: Change checkboard pattern



commit a782f9663890e12c1643199c4c274394e0da298a
Author: Christian Persch <chpe src gnome org>
Date:   Thu Nov 21 20:52:27 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 19d6ba78..e6401438 100644
--- a/src/vtedraw.cc
+++ b/src/vtedraw.cc
@@ -1139,6 +1139,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* \
@@ -1164,6 +1176,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
 
@@ -2021,18 +2035,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]