Daniel Eklöf
d6898dcc42
box-drawing: use pixman_image_fill_boxes() for rect()
2021-05-17 17:58:29 +02:00
Daniel Eklöf
e05a510a7c
box-drawing: implement LIGHT diagonal lines using pixman
...
Use trapezoids to rasterize the diagonal lines.
2021-05-17 17:58:29 +02:00
Daniel Eklöf
19fa1b30b8
box-drawing: rect(): implement using pixman
...
Use pixman_image_fill_rectangles() to render rectangles. Duh!
2021-05-17 17:58:29 +02:00
Daniel Eklöf
155537c2de
box-drawing: {h,v}line: implement using pixman
...
Use pixman_image_fill_rectangles() to render horizontal and vertical
lines.
Despite the name, this *is* the appropriate function to use, since our
lines *do* have a thickness, and thus *are* rectangles.
2021-05-17 17:58:29 +02:00
Daniel Eklöf
e03257d342
box-drawing: U+256C - BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL: add missing corner
...
The inner corner, where the upper/left lines meet, were missing
2021-05-17 17:58:29 +02:00
Daniel Eklöf
8d09ba5bd2
box-drawing: include pixman image in the buffer we’re passing around
2021-05-17 17:58:29 +02:00
Daniel Eklöf
9e5d740422
box-drawing: add Unicode 13 U+1FB70 - U+1FB8B
...
Part of #471
2021-05-04 10:47:36 +02:00
Craig Barnes
e56136ce11
debug: rename assert() to xassert(), to avoid clashing with <assert.h>
2021-01-16 20:16:00 +00:00
Craig Barnes
dad0549f2e
box-drawing: use enum constants in draw_sextant() instead of #define
...
Both are functionally equivalent here, but the former is also properly
scoped, can be naturally indented and has a less repetitive syntax.
2021-01-15 16:07:51 +00:00
Daniel Eklöf
14ce8fd872
box-drawing: line thickness now depends on both DPI and cell size
...
Cell size is defined as the length of the diagonal of the cell.
2021-01-12 17:31:55 +01:00
Daniel Eklöf
f1b4bf1275
box-drawing: LIGHT ARC: ensure row+col are within range
2021-01-12 17:31:55 +01:00
Daniel Eklöf
4bb056bb4b
box-drawing: {h,v}line() + rect(): ensure *end* row/col is >= 0
2021-01-12 17:31:47 +01:00
Daniel Eklöf
25c2379d5f
box-drawing: x/y offsets: use pre-calculated offset values from term struct
2021-01-11 09:31:09 +01:00
Daniel Eklöf
a6fc8b5da4
config: line-height, letter-spacing: values are in pt by default, but we allow px
...
If the value is specified without a unit, then the value is assumed to
be in points, subject to DPI scaling.
The value can optionally have a ‘px’ suffix, in which case the value
is treated as a raw pixel count.
2021-01-11 09:31:08 +01:00
Daniel Eklöf
389570b274
box-drawing: compensate for non-zero {horizontal,vertical}-letter-offsets
...
Box drawing characters should always cover the entire cell. No more,
no less.
2021-01-11 09:31:06 +01:00
Craig Barnes
39b2e46e72
Use wrappers from macros.h instead of bare GCC attributes/pragmas
2021-01-03 08:56:47 +00:00
Daniel Eklöf
0861e8d377
box-drawing: drop ‘pragma GCC optimize(“Os”)’
...
“The optimize attribute should be used for debugging purposes
only. It is not suitable in production code.”
Luckily, it seems it really isn’t needed anymore; with all the other
size optimizations that has been done since this was introduced, there
is no longer any difference with or without this pragma.
2021-01-02 17:47:47 +01:00
Daniel Eklöf
c7a611fdf3
box-drawing: codespell: assymetrical -> asymmetrical
2021-01-02 12:35:53 +01:00
Daniel Eklöf
e353edaf41
box-drawing: add macros for {h,v}line_middle_mixed()
...
Mixed here refers to mixed thickness - the lines thickness doesn’t
match the thickness of an abstract, orthogonal line going through the
middle of the cell.
2021-01-02 12:28:03 +01:00
Daniel Eklöf
5a5134e9bd
box-drawing: LIGHT ARC: simpler way to adjust for asymmetrical arc when mirroring
...
When mirroring an arc, we need to adjust the mirrored position if the
arc’s position in the cell is asymmetrical. This happens when *either*
the line is odd sized, *or* the cell is. But not when both are.
Thus, we can simply do a ‘thickness % 2 ^ width % 2’ when adjusting
the position.
Describe this in a comment.
2021-01-02 12:09:00 +01:00
Daniel Eklöf
66497cfd4d
box-drawing: LIGHT ARC: use min/max instead of checking range inside loop
2021-01-02 12:08:32 +01:00
Daniel Eklöf
d8e40cf5d4
box-drawing: LIGHT ARC: fix alignment of arcs when thickness is > 1px
2021-01-02 02:26:12 +01:00
Daniel Eklöf
87dcdc2b3b
box-drawing: LIGHT ARC: test using a circle equation instead of a bezier curve
2021-01-02 00:52:02 +01:00
Daniel Eklöf
128883fa05
box-drawing: guard GCC pragma with #if defined(__GNUC__)
2021-01-01 23:35:55 +01:00
Daniel Eklöf
a20c6bd667
box-drawing: do not inline any of the utility functions
2021-01-01 22:29:26 +01:00
Daniel Eklöf
fc79dbb5a3
box-drawing: dedicated functions to draw a full horizontal/vertical line
2021-01-01 22:24:52 +01:00
Daniel Eklöf
068f93d226
box-drawing: convert {h,v}line_middle_{left,right,up,down}() macros to functions
...
This greatly reduces the size of the foot binary
2021-01-01 22:12:40 +01:00
Daniel Eklöf
d1993f1f91
box-drawing: sextants: convert sextant_*() macros to functions
...
While this doesn’t really reduce foot’s size, it is cleaner
2021-01-01 22:01:09 +01:00
Daniel Eklöf
f7669c1e24
box-drawing: quadrants: convert quad_*() macros to functions
...
This reduces the size of the foot binary by ~4K; all the quad
macros called ceil() and floor() twice per macro, which caused many
float -> int -> float conversions in the expanded code.
By using functions instead, there’s no expansion - the conversion only
happens in one (well, four) places.
2021-01-01 21:56:53 +01:00
Daniel Eklöf
c75192b4f8
box-drawing: reduce number of function arguments
...
We were using so many function arguments that a lot of the emitted
code was just stack push and pops to pass around arguments.
Bundle the buffer data, width, height, stride, and current DPI, into a
single ‘buf’ argument. This greatly reduces the number of arguments to
all functions.
2021-01-01 21:47:05 +01:00
Daniel Eklöf
25f21d4202
box-drawing: force minsize optimization
2021-01-01 21:28:12 +01:00
Daniel Eklöf
11d4e9ee53
box-drawing: disable debug output
2021-01-01 21:27:53 +01:00
Daniel Eklöf
81ac95995a
box-drawing: LIGHT DIAGONALs
...
* U+2571
* U+2572
* U+2573
2021-01-01 21:09:39 +01:00
Daniel Eklöf
ca423bcb01
box-drawing: silence variable-may-not-be-initialized warnings
2021-01-01 21:09:38 +01:00
Daniel Eklöf
ebb5e9eeae
box-drawing: LIGHT/HEAVY DOUBLE/TRIPLE/QUADRUPLE VERTICAL
...
Also combine the HORIZONTAL versions into a single draw function.
* U+2506
* U+2507
* U+250A
* U+250B
* U+254E
* U+254F
2021-01-01 21:09:38 +01:00
Daniel Eklöf
34360fbb7d
box-drawing: LIGHT/HEAVY DOUBLE/TRIPLE/QUADRUPLE HORIZONTAL
...
*U+2504
*U+2505
*U+2508
*U+2509
*U+254C
*U+254D
2021-01-01 21:09:38 +01:00
Daniel Eklöf
848bd27dd5
box-drawing: LIGHT ARC: improve symmetry when cell width is even
2021-01-01 21:09:38 +01:00
Daniel Eklöf
167078c076
box-drawing: LIGHT ARC: no need to do floating point since we’re truncating
2021-01-01 21:09:38 +01:00
Daniel Eklöf
56e947bb44
box-drawing: LIGHT ARC: pixel-perfect
...
At least in odd-sized cells, with a thickness of 1 pixel.
2021-01-01 21:09:38 +01:00
Daniel Eklöf
c120e0c84f
box-drawing: wip: LIGHT ARC: U+256d-U+2570
2021-01-01 21:09:37 +01:00
Daniel Eklöf
bd42986a8b
box-drawing: {h,v}line(): handle both start/end point being too small *and* too large
2021-01-01 21:09:37 +01:00
Daniel Eklöf
a8496eef03
box-drawing: thickness(): ensure thickness is *at least* 1px
2021-01-01 21:09:37 +01:00
Daniel Eklöf
878adb970e
box-drawing: make sure we never walk outside the (image) buffer
2021-01-01 21:09:37 +01:00
Daniel Eklöf
b5ec34ca12
box-drawing: wrap {h,v}hline() functions in macros, to shorten argument list
...
Rename the *function* {h,v}line() to _{h,v}line(), and add two new
macros: hline() and vline().
This allows us to shorten the argument list by removing the ‘buf’ and
‘stride’ arguments.
2021-01-01 21:09:37 +01:00
Daniel Eklöf
25d2b03a5c
box-drawing: SEXTANTS, U+1fb00-1fb3b
2021-01-01 21:09:37 +01:00
Daniel Eklöf
00d0e53a95
box-drawing: oops - remove accidental ‘x’
2021-01-01 21:09:37 +01:00
Daniel Eklöf
4ac33f4f4e
box-drawing: remove LOG_WARN from U+259x range - all codepoints have been implemented
2021-01-01 21:09:36 +01:00
Daniel Eklöf
705cb9cfb0
box_drawing(): mark function as ‘cold’
2021-01-01 21:09:36 +01:00
Daniel Eklöf
5b167bd185
box-drawing: remove __attribute__((__const__)) from thickness()
...
thickness() is a static function and thus ‘const’ is not necessary.
2021-01-01 21:09:36 +01:00
Daniel Eklöf
cf0270c1ea
box-drawing: make ‘term’ parameter const
2021-01-01 21:09:36 +01:00