[Splashy-devel] Pixel-Precise Patch.
Pat Suwalski
pats at xandros.com
Tue Feb 28 17:35:29 UTC 2006
Hello,
I wrote a pixel-precise patch that allows perfect placement of the
progressbar based on the background resolution but independent of screen
resolution.
This patch is on old source and conflicts with the border patch I sent
in last week, but it's only about 10 lines so it shouldn't be hard to merge.
It works as follows:
<background>
<boot>...</boot>
<...>
<width>1024</width>
<height>768</height>
</background>
If <width> and <height> are not specified, it falls back to percentages.
It's simple and I'm rather happy with how it works.
--Pat
-------------- next part --------------
--- video.c.orig 2006-02-28 11:26:56.000000000 -0500
+++ video.c 2006-02-28 11:37:39.000000000 -0500
@@ -148,18 +148,39 @@
video_draw_progressbar (splashy_video_t * video, DFBRectangle * progressbar)
{
gint screen_width, screen_height;
+
+ /* Source image width and height */
+ gint sourceWidth, sourceHeight, dividerW, dividerH;
+
guint rectangle_red, rectangle_green, rectangle_blue, rectangle_alpha;
+ /* If a source image width and height is specified, assume
+ * pixel-precise placement of progress bar rather than percentage. */
+ sourceWidth = xml_parser_get_int("/splashy/background/width", 10);
+ sourceHeight = xml_parser_get_int("/splashy/background/height", 10);
+
+ if (sourceWidth > 0 && sourceHeight > 0)
+ {
+ /* The value is based on specified units */
+ dividerW = sourceWidth;
+ dividerH = sourceHeight;
+ }
+ else
+ {
+ /* The value is based on percentage */
+ dividerW = dividerH = 100;
+ }
+
video->surface->GetSize (video->surface, &screen_width, &screen_height);
progressbar->x = screen_width *
- xml_parser_get_int ("/splashy/progressbar/x", 10) / 100;
+ xml_parser_get_int ("/splashy/progressbar/x", 10) / dividerW;
progressbar->y = screen_height *
- xml_parser_get_int ("/splashy/progressbar/y", 10) / 100;
+ xml_parser_get_int ("/splashy/progressbar/y", 10) / dividerH;
progressbar->w = screen_width *
- xml_parser_get_int ("/splashy/progressbar/width", 10) / 100;
+ xml_parser_get_int ("/splashy/progressbar/width", 10) / dividerW;
progressbar->h = screen_height *
- xml_parser_get_int ("/splashy/progressbar/height", 10) / 100;
+ xml_parser_get_int ("/splashy/progressbar/height", 10) / dividerH;
if (progressbar->x < 0 ||
progressbar->y < 0 || progressbar->w < 0 || progressbar->h < 0)
More information about the Splashy-devel
mailing list