aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2004-10-27 02:46:40 +0000
committerKeith Packard <keithp@keithp.com>2004-10-27 02:46:40 +0000
commit1b19cddc722e1a4e1d2a7f8d4a8565ee1551d6a9 (patch)
treefd710a56e801c4bc7bd4464a4e7fe3b4175cd1d7
parent89ad67caa2f0e8454ccacb8efa2bd1eee94c0566 (diff)
downloadlibtwin-1b19cddc722e1a4e1d2a7f8d4a8565ee1551d6a9.tar.gz
Paint polygons instead of stroked lines for button edges
Snap origin to pixel grid Strip newline from ctime output
-rw-r--r--ChangeLog11
-rw-r--r--twin_button.c25
-rw-r--r--twin_font.c4
-rw-r--r--twin_hello.c5
4 files changed, 33 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index b192df2..6dd0067 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2004-10-26 Keith Packard <keithp@keithp.com>
+ * twin_button.c: (_twin_button_paint):
+ Paint polygons instead of stroked lines for button edges
+
+ * twin_font.c: (_twin_text_compute_info):
+ Snap origin to pixel grid
+
+ * twin_hello.c: (_twin_hello_timeout):
+ Strip newline from ctime output
+
+2004-10-26 Keith Packard <keithp@keithp.com>
+
* Makefile.am:
* twin_button.c: (_twin_button_paint),
(_twin_button_set_label_offset), (_twin_button_dispatch),
diff --git a/twin_button.c b/twin_button.c
index 2cfa67d..4e44376 100644
--- a/twin_button.c
+++ b/twin_button.c
@@ -35,7 +35,6 @@ _twin_button_paint (twin_button_t *button)
twin_fixed_t wf = twin_int_to_fixed (w);
twin_fixed_t hf = twin_int_to_fixed (h);
twin_fixed_t bf = _twin_button_bw (button);
- twin_fixed_t bh = bf / 2;
twin_argb32_t top_color, bot_color;
twin_pixmap_t *pixmap = button->label.widget.window->pixmap;
@@ -51,15 +50,23 @@ _twin_button_paint (twin_button_t *button)
top_color = 0x80808080;
bot_color = 0x80000000;
}
- twin_path_move (path, bh, hf-bh);
- twin_path_draw (path, bh, bh);
- twin_path_draw (path, wf-bh, bh);
- twin_paint_stroke (pixmap, top_color, path, bf);
+ twin_path_move (path, 0, 0);
+ twin_path_draw (path, wf, 0);
+ twin_path_draw (path, wf-bf, bf);
+ twin_path_draw (path, bf, bf);
+ twin_path_draw (path, bf, hf-bf);
+ twin_path_draw (path, 0, hf);
+ twin_path_close (path);
+ twin_paint_path (pixmap, top_color, path);
twin_path_empty (path);
- twin_path_move (path, bh, hf-bh);
- twin_path_draw (path, wf-bh, hf-bh);
- twin_path_draw (path, wf-bh, bh);
- twin_paint_stroke (pixmap, bot_color, path, bf);
+ twin_path_move (path, bf, hf-bf);
+ twin_path_draw (path, wf-bf, hf-bf);
+ twin_path_draw (path, wf-bf, bf);
+ twin_path_draw (path, wf, 0);
+ twin_path_draw (path, wf, hf);
+ twin_path_draw (path, 0, hf);
+ twin_path_close (path);
+ twin_paint_path (pixmap, bot_color, path);
twin_path_destroy (path);
}
}
diff --git a/twin_font.c b/twin_font.c
index cc8d461..509cc16 100644
--- a/twin_font.c
+++ b/twin_font.c
@@ -79,8 +79,8 @@ _twin_text_compute_info (twin_path_t *path, twin_text_info_t *info)
info->matrix.m[xi][1] = 0;
info->matrix.m[yi][0] = 0;
info->matrix.m[yi][1] = TWIN_FIXED_ONE;
- info->matrix.m[2][0] = twin_sfixed_to_fixed (origin.x);
- info->matrix.m[2][1] = twin_sfixed_to_fixed (origin.y);
+ info->matrix.m[2][0] = SNAPI(twin_sfixed_to_fixed (origin.x));
+ info->matrix.m[2][1] = SNAPI(twin_sfixed_to_fixed (origin.y));
info->scale.x = twin_fixed_mul (path->state.font_size,
path->state.matrix.m[0][xi]);
info->reverse_scale.x = twin_fixed_div (TWIN_FIXED_ONE,
diff --git a/twin_hello.c b/twin_hello.c
index 08b9e0a..d29b6cd 100644
--- a/twin_hello.c
+++ b/twin_hello.c
@@ -24,14 +24,17 @@
#include "twin_hello.h"
#include <time.h>
+#include <string.h>
static twin_time_t
_twin_hello_timeout (twin_time_t now, void *closure)
{
twin_label_t *labelb = closure;
time_t secs = time (0);
+ char *t = ctime(&secs);
- twin_label_set (labelb, ctime (&secs),
+ *strchr(t, '\n') = '\0';
+ twin_label_set (labelb, t,
0xff008000,
twin_int_to_fixed (12),
TWIN_TEXT_OBLIQUE);