Commit Graph

171 Commits

Author SHA1 Message Date
Julien Danjou 4c76b5a1d5 draw: add support for top and left bg_margin
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-22 11:11:53 +02:00
Julien Danjou a5397fd724 draw: remove useless vars
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-09-02 14:03:27 +02:00
Julien Danjou 99004c3799 draw: wipe text in parser data
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-28 19:34:20 +02:00
Julien Danjou 87a89b6aa1 use xcb_flush; move refresh stuff in common function
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-26 19:35:37 +02:00
Julien Danjou 7309351228 draw: fix extra area computing
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-26 11:23:35 +02:00
Julien Danjou a56997aefb draw: support for top margin
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-19 11:38:57 +02:00
Julien Danjou 65f5f964ef draw: better GError handling
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-18 14:32:05 +02:00
Julien Danjou 8173bd6ea9 draw: stop parsing Pango markup twice, store AttrList
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-18 14:29:50 +02:00
Julien Danjou 4ea0f659e2 draw: do not delete image on text rendering
This is not our job.

Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-14 07:36:34 +02:00
Arnaud Fontaine 193a73c5d9 draw: make xcolor_init() asynchronous. 2008-08-12 14:53:57 +02:00
Julien Danjou c13cffe1eb draw: set_markup wants NONULL arg
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-30 10:35:37 +02:00
Julien Danjou 88e69ba44f draw: export draw_text_markup_expand() and check for data before wipe
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-10 17:09:57 +02:00
Julien Danjou 5fc500a861 draw: draw_text takes len as arg
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-10 15:35:19 +02:00
Julien Danjou 36fd44d1a0 draw: add char len as arg of xcolor_init()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-10 15:30:16 +02:00
Julien Danjou 750040be68 draw: text extents now gets len as arg
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-10 15:06:09 +02:00
Julien Danjou 50ff37a17e draw: remove useless draw_circle
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-10 11:02:11 +02:00
Kanru Chen f22acbf45e draw: fix shadow stroke
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-09 15:23:47 +02:00
Julien Danjou e3bbf3f15d draw: bug fix on bg parsing
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-09 10:38:39 +02:00
Julien Danjou ddae6f76b2 draw: add support for border around text
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-09 10:25:29 +02:00
Julien Danjou 9c495c0dee draw: use only one iconv for all
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-09 08:48:51 +02:00
marco candrian 2b767c2352 widgets: use vector_t for the color-gradients course.
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-02 13:59:30 +02:00
Pierre Habouzit 46ea7c45aa Get rid of the color name, and generate a #RGBA value on the fly if needed.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-02 11:09:10 +02:00
Pierre Habouzit 924078c898 Streamline xcolor_t.
Do not have a ->name char * field, but a char[32] instead.  This isn't a
big problem, the longest color in /etc/X11/rgb.txt is 23 chars long, and
if it becomes a problem one day, one could just strip the name and
generate an hexadecimal representation on the fly instead. But allocating
the name is asking for a lot of trouble.

Since we do not allocate anything anymore, just don't allocate anything
anymore at all, it avoids the mess of xcolor_copy/_wipe and fixes a lot of
sleeping bugs (p_dup were used e.g., which is wrong).

Pass xcolor_t *, xcolor_t becomes too big to be passed by value. Add
consts at some places.

xcolor_new allocates nothing, hence is renamed xcolor_init, has xcolor_t
as a first argument (OO-style, this is self), and doesn't touch the
structure at all if it returns false, which allow us to skip a lot of
intermediates values.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-02 10:36:46 +02:00
Julien Danjou 48111308a0 draw: add draw_align_tostr()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-01 16:29:50 +02:00
Julien Danjou 4e2e8a3653 draw: len is mandatory
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-01 15:05:00 +02:00
Julien Danjou 9b74cdbc0a draw: iso2utf now gets len as arg
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-01 14:44:19 +02:00
Julien Danjou 35e948f53b draw: xcolor_t store color name
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-28 13:30:17 +02:00
Julien Danjou 0fddca87c3 draw: stop leaking image on double parsing
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-27 10:08:22 +02:00
Julien Danjou 0012b8dfc0 draw: honor bg_resize
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-26 16:49:16 +02:00
Julien Danjou 7dbd06c8ca draw: markup bg image do not change the size
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-26 16:49:05 +02:00
Julien Danjou 68f0eda193 iconbox: remove
This can be replaced by textbox.

Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-25 16:37:16 +02:00
Pierre Habouzit b19aace542 Fix draw_align_fromstr calls.
Note that it's undefined to have side effects on an argument and pass this
argument again to another function.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-24 22:40:34 +02:00
Julien Danjou a055634d4e draw: use len param in draw_align_fromstr()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-24 20:34:02 +02:00
Julien Danjou fdcc507329 draw: add resize for bg
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 18:07:47 +02:00
Julien Danjou 9caa9fc96f draw: add background alignment
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 18:01:15 +02:00
Julien Danjou 236ccc165c placement: fix smart
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 17:30:35 +02:00
Pierre Habouzit 3116c0d381 Add draw_parser_data_{init,wipe}.
Use it everywhere needed instead of wrong p_clear's, this fixes memory
leaks.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-23 15:23:49 +02:00
Julien Danjou ab5119732d use more tokenizer, with len
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 14:01:33 +02:00
Julien Danjou 7803225553 draw: use tokenize() in markup parsing
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 13:39:47 +02:00
Julien Danjou 7dd1fa0e0b draw: rename on_event() to on_element()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 13:32:22 +02:00
Julien Danjou 7aab504350 draw: store parser_data made by extents call
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 13:09:42 +02:00
Julien Danjou 00b119c1ac draw: remove draw_get_image_size()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 12:44:01 +02:00
Pierre Habouzit c2df807ede Use gperf to tokenize some strings.
This makes the code way more readable, and also avoids a lot of strcmps.

Use it for draw_align_get_from_str as a proof of concept.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-23 07:41:22 +02:00
Julien Danjou 46f03fd6a6 area_t: make it smaller, use arrays instead of lists.
Make area_t smaller so that it fits in an uint64_t using 4 {u,}int16_t's
for it. Note that xcb uses the very same structure, so we aren't loosing
any information while remaining very small.

This is better to use arrays in term of:
* memory access when iterating over area_t's;
* allocation because area_t's have no *next/*prev members anymore, which
  makes it a tiny structure (8 octets);
* allocation because we allocate area_t's by vector of'em rather than one
  by one.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 22:09:48 +02:00
Pierre Habouzit b4b381e947 Finish markup parsing rewrite to avoid mallocs.
For that matter, use elements as a filter for elements we care about, and
let the hook implement whatever it needs without duplicating everything.

The resulting algorithm is still O(n²) where n is the number of filtered
elements (3 at most right now), which isn't bad if we don't need to get
too many elements, but at least it's not quadratic in the number of
attributes anymore.

Speedup improvements could be done using gperf btw.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 17:45:45 +02:00
Pierre Habouzit 943e2035fa Rework the markup_parser_* allocation API.
We have a stack, don't be ashamed to use it.

Instead of:

    foo_t *foo;

    foo = foo_new();
    /* work with foo */
    foo_delete(&foo);

It's way better to:

    foo_t foo;

    foo_init(&foo);
    /* work with &foo */
    foo_wipe(&foo);

Remember: more mallocs == more fragmentation.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 16:17:12 +02:00
Pierre Habouzit 0ad600ef0a And use a buffer in the drawing stuff.
So that we don't stupidly call even more strlen's.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 15:27:06 +02:00
Pierre Habouzit 3fb0b5127e Remove lots and lots of useless mallocs.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 15:20:55 +02:00
Pierre Habouzit 5c601dfd19 Use extensible buffers in markup parsing.
This should avoid quite a few malloc calls.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-22 15:12:42 +02:00
Byron Clark 7106c9bcad Stop spamming the log when there is no image present.
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-22 09:46:58 +02:00