projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/draw: Add transforms to polygon code
[fw/altos]
/
src
/
draw
/
ao_text.c
diff --git
a/src/draw/ao_text.c
b/src/draw/ao_text.c
index be19238838300547236be659398f14c6e1db4547..cb1bc5abce72380b61af9026d7c15f6940370749 100644
(file)
--- a/
src/draw/ao_text.c
+++ b/
src/draw/ao_text.c
@@
-27,12
+27,12
@@
ao_text(const struct ao_bitmap *dst,
uint32_t fill,
uint8_t rop)
{
uint32_t fill,
uint8_t rop)
{
- int
glyph_stride = (font->max_width + 31) / 32
;
+ int
16_t glyph_stride = ao_stride(font->max_width)
;
uint32_t src[glyph_stride * font->max_height];
char c;
int h;
uint32_t src[glyph_stride * font->max_height];
char c;
int h;
- int
8_t x_off, y_off, advance
;
- int
byte_width
;
+ int
16_t x_off = 0, y_off = 0, advance = 0
;
+ int
16_t byte_width = 0
;
struct ao_bitmap src_bitmap = {
.base = src,
struct ao_bitmap src_bitmap = {
.base = src,
@@
-45,11
+45,12
@@
ao_text(const struct ao_bitmap *dst,
if (!font->metrics) {
src_bitmap.width = font->max_width;
if (!font->metrics) {
src_bitmap.width = font->max_width;
- src_bitmap.height = font->max_
width
;
+ src_bitmap.height = font->max_
height
;
src_bitmap.stride = glyph_stride;
x_off = 0;
y_off = font->ascent;
advance = font->max_width;
src_bitmap.stride = glyph_stride;
x_off = 0;
y_off = font->ascent;
advance = font->max_width;
+ byte_width = ao_stride_bytes(font->max_width);
}
while ((c = *string++)) {
const uint8_t *bytes = &font->bytes[font->pos[(uint8_t) c]];
}
while ((c = *string++)) {
const uint8_t *bytes = &font->bytes[font->pos[(uint8_t) c]];
@@
-58,15
+59,15
@@
ao_text(const struct ao_bitmap *dst,
const struct ao_glyph_metrics *m = &font->metrics[(uint8_t) c];
src_bitmap.width = m->width;
src_bitmap.height = m->height;
const struct ao_glyph_metrics *m = &font->metrics[(uint8_t) c];
src_bitmap.width = m->width;
src_bitmap.height = m->height;
- src_bitmap.stride =
(m->width + 31) / 32
;
+ src_bitmap.stride =
ao_stride(m->width)
;
x_off = m->x_off;
y_off = m->y_off;
advance = m->advance;
x_off = m->x_off;
y_off = m->y_off;
advance = m->advance;
- byte_width =
((src_bitmap.width + 7) / 8
);
+ byte_width =
ao_stride_bytes(m->width
);
}
for (h = 0; h < src_bitmap.height; h++)
}
for (h = 0; h < src_bitmap.height; h++)
- memcpy(&src[h * src_bitmap.stride], &bytes[h * byte_width], byte_width);
+ memcpy(&src[h * src_bitmap.stride], &bytes[h * byte_width],
(size_t)
byte_width);
ao_copy(dst,
x + x_off, y - y_off, src_bitmap.width, src_bitmap.height,
ao_copy(dst,
x + x_off, y - y_off, src_bitmap.width, src_bitmap.height,