This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via a9676bd9397ba4a939a11341c66f7fba6a8293a5 (commit) from 144f51ced0bc1c933d15917578e99f6615afc6f9 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/a9676bd9397ba4a939a11341c66f7fba6a829...
commit a9676bd9397ba4a939a11341c66f7fba6a8293a5 Author: Cyril Hrubis metan@ucw.cz Date: Tue May 21 23:30:28 2013 +0200
spiv: Cleanup the progress callback.
Cleanup the code a little, draw better progress.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 87f2e26..5e0352e 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -43,6 +43,7 @@
static GP_Pixel black_pixel; static GP_Pixel white_pixel; +static GP_Pixel gray_pixel;
static GP_Backend *backend = NULL;
@@ -123,17 +124,21 @@ static int image_loader_callback(GP_ProgressCallback *self) (const char*)self->priv, self->percentage);
int align = GP_ALIGN_CENTER|GP_VALIGN_ABOVE; + + size = GP_TextWidth(NULL, buf);
- GP_TextClear(c, NULL, c->w/2, c->h - 4, align, - black_pixel, GP_MAX(size, GP_TextWidth(NULL, buf))); + int start = c->w/2 - size/2 - 10; + int end = c->w/2 + size/2 + 10; + int middle = start + (end - start) * self->percentage / 100; + int top = c->h - GP_TextHeight(NULL) - 11;
- GP_Text(c, NULL, c->w/2, c->h - 4, align, - white_pixel, black_pixel, buf); + GP_FillRectXYXY(c, start, c->h - 1, middle, top, gray_pixel); + GP_FillRectXYXY(c, middle, c->h - 1, end, top, black_pixel);
- size = GP_TextWidth(NULL, buf); + GP_Text(c, NULL, c->w/2, c->h - 5, align, + white_pixel, black_pixel, buf);
- GP_BackendUpdateRect(backend, c->w/2 - size/2 - 1, c->h - 4, - c->w/2 + size/2 + 1, c->h - 4 - GP_TextHeight(NULL)); + GP_BackendUpdateRect(backend, start, c->h - 1, end, top);
return 0; } @@ -932,6 +937,7 @@ int main(int argc, char *argv[])
black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, context); white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, context); + gray_pixel = GP_RGBToContextPixel(0x33, 0x33, 0x33, context);
GP_Fill(context, black_pixel); GP_BackendFlip(backend);
-----------------------------------------------------------------------
Summary of changes: demos/spiv/spiv.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.