aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-10 16:48:46 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-10 16:48:46 +0000
commit74ab12010185735c6a1afa1029be3824fa56fc92 (patch)
treea51c8c323086e5939c740306829231fd403116f0
parentcell: we only need 4 bytes for the longest utf8 sequence (diff)
terminal: use floats instead of double for colors
We don't need the full resolution a double gives us. Using floats reduces the size of cells greatly, which improves cache usage.
-rw-r--r--terminal.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/terminal.h b/terminal.h
index 16e53f22..fdb86a81 100644
--- a/terminal.h
+++ b/terminal.h
@@ -38,20 +38,13 @@ struct wayland {
bool have_argb8888;
};
-struct rgb { double r, g, b; } __attribute__((packed));
+struct rgb { float r, g, b; } __attribute__((packed));
+/*
+ * Note: we want the cells to be as small as possible. Larger cells
+ * means fewer scrollback lines (or performance drops due to cache
+ * misses) */
struct attributes {
-#if 0
- bool bold;
- bool italic;
- bool underline;
- bool strikethrough;
- bool blink;
- bool conceal;
- bool reverse;
- bool have_foreground;
- bool have_background;
-#else
uint8_t bold:1;
uint8_t italic:1;
uint8_t underline:1;
@@ -61,7 +54,7 @@ struct attributes {
uint8_t reverse:1;
uint8_t have_foreground:1;
uint8_t have_background:1;
-#endif
+
struct rgb foreground; /* Only valid when have_foreground == true */
struct rgb background; /* Only valid when have_background == true */
} __attribute__((packed));