@@ -118,3 +118,73 @@ psplash_plot_pixel(PSplashCanvas *canvas,
}
}
}
+
+void
+psplash_draw_rect(PSplashCanvas *canvas,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint8 red,
+ uint8 green,
+ uint8 blue)
+{
+ int dx, dy;
+
+ for (dy=0; dy < height; dy++)
+ for (dx=0; dx < width; dx++)
+ psplash_plot_pixel(canvas, x+dx, y+dy, red, green, blue);
+}
+
+void
+psplash_draw_image(PSplashCanvas *canvas,
+ int x,
+ int y,
+ int img_width,
+ int img_height,
+ int img_bytes_per_pixel,
+ int img_rowstride,
+ uint8 *rle_data)
+{
+ uint8 *p = rle_data;
+ int dx = 0, dy = 0, total_len;
+ unsigned int len;
+
+ total_len = img_rowstride * img_height;
+
+ /* FIXME: Optimise, check for over runs ... */
+ while ((p - rle_data) < total_len)
+ {
+ len = *(p++);
+
+ if (len & 128)
+ {
+ len -= 128;
+
+ if (len == 0) break;
+
+ do
+ {
+ if ((img_bytes_per_pixel < 4 || *(p+3)) && dx < img_width)
+ psplash_plot_pixel(canvas, x+dx, y+dy, *(p), *(p+1), *(p+2));
+ if (++dx * img_bytes_per_pixel >= img_rowstride) { dx=0; dy++; }
+ }
+ while (--len);
+
+ p += img_bytes_per_pixel;
+ }
+ else
+ {
+ if (len == 0) break;
+
+ do
+ {
+ if ((img_bytes_per_pixel < 4 || *(p+3)) && dx < img_width)
+ psplash_plot_pixel(canvas, x+dx, y+dy, *(p), *(p+1), *(p+2));
+ if (++dx * img_bytes_per_pixel >= img_rowstride) { dx=0; dy++; }
+ p += img_bytes_per_pixel;
+ }
+ while (--len && (p - rle_data) < total_len);
+ }
+ }
+}
@@ -48,4 +48,24 @@ psplash_plot_pixel(PSplashCanvas *canvas,
uint8 green,
uint8 blue);
+void
+psplash_draw_rect(PSplashCanvas *canvas,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint8 red,
+ uint8 green,
+ uint8 blue);
+
+void
+psplash_draw_image(PSplashCanvas *canvas,
+ int x,
+ int y,
+ int img_width,
+ int img_height,
+ int img_bytes_per_pixel,
+ int img_rowstride,
+ uint8 *rle_data);
+
#endif
@@ -339,76 +339,6 @@ psplash_fb_new (int angle, int fbdev_id)
return NULL;
}
-void
-psplash_fb_draw_rect (PSplashFB *fb,
- int x,
- int y,
- int width,
- int height,
- uint8 red,
- uint8 green,
- uint8 blue)
-{
- int dx, dy;
-
- for (dy=0; dy < height; dy++)
- for (dx=0; dx < width; dx++)
- psplash_plot_pixel(&fb->canvas, x+dx, y+dy, red, green, blue);
-}
-
-void
-psplash_fb_draw_image (PSplashFB *fb,
- int x,
- int y,
- int img_width,
- int img_height,
- int img_bytes_per_pixel,
- int img_rowstride,
- uint8 *rle_data)
-{
- uint8 *p = rle_data;
- int dx = 0, dy = 0, total_len;
- unsigned int len;
-
- total_len = img_rowstride * img_height;
-
- /* FIXME: Optimise, check for over runs ... */
- while ((p - rle_data) < total_len)
- {
- len = *(p++);
-
- if (len & 128)
- {
- len -= 128;
-
- if (len == 0) break;
-
- do
- {
- if ((img_bytes_per_pixel < 4 || *(p+3)) && dx < img_width)
- psplash_plot_pixel(&fb->canvas, x+dx, y+dy, *(p), *(p+1), *(p+2));
- if (++dx * img_bytes_per_pixel >= img_rowstride) { dx=0; dy++; }
- }
- while (--len);
-
- p += img_bytes_per_pixel;
- }
- else
- {
- if (len == 0) break;
-
- do
- {
- if ((img_bytes_per_pixel < 4 || *(p+3)) && dx < img_width)
- psplash_plot_pixel(&fb->canvas, x+dx, y+dy, *(p), *(p+1), *(p+2));
- if (++dx * img_bytes_per_pixel >= img_rowstride) { dx=0; dy++; }
- p += img_bytes_per_pixel;
- }
- while (--len && (p - rle_data) < total_len);
- }
- }
-}
-
/* Font rendering code based on BOGL by Ben Pfaff */
static int
@@ -40,26 +40,6 @@ psplash_fb_destroy (PSplashFB *fb);
PSplashFB*
psplash_fb_new (int angle, int fbdev_id);
-void
-psplash_fb_draw_rect (PSplashFB *fb,
- int x,
- int y,
- int width,
- int height,
- uint8 red,
- uint8 green,
- uint8 blue);
-
-void
-psplash_fb_draw_image (PSplashFB *fb,
- int x,
- int y,
- int img_width,
- int img_height,
- int img_bytes_pre_pixel,
- int img_rowstride,
- uint8 *rle_data);
-
void
psplash_fb_text_size (int *width,
int *height,
@@ -47,7 +47,7 @@ psplash_draw_msg (PSplashFB *fb, const char *msg)
/* Clear */
- psplash_fb_draw_rect (fb,
+ psplash_draw_rect(&fb->canvas,
0,
SPLIT_LINE_POS(fb) - h,
fb->canvas.width,
@@ -77,19 +77,19 @@ psplash_draw_progress (PSplashFB *fb, int value)
if (value > 0)
{
barwidth = (CLAMP(value,0,100) * width) / 100;
- psplash_fb_draw_rect (fb, x + barwidth, y,
+ psplash_draw_rect(&fb->canvas, x + barwidth, y,
width - barwidth, height,
PSPLASH_BAR_BACKGROUND_COLOR);
- psplash_fb_draw_rect (fb, x, y, barwidth,
+ psplash_draw_rect(&fb->canvas, x, y, barwidth,
height, PSPLASH_BAR_COLOR);
}
else
{
barwidth = (CLAMP(-value,0,100) * width) / 100;
- psplash_fb_draw_rect (fb, x, y,
+ psplash_draw_rect(&fb->canvas, x, y,
width - barwidth, height,
PSPLASH_BAR_BACKGROUND_COLOR);
- psplash_fb_draw_rect (fb, x + width - barwidth,
+ psplash_draw_rect(&fb->canvas, x + width - barwidth,
y, barwidth, height,
PSPLASH_BAR_COLOR);
}
@@ -301,11 +301,11 @@ main (int argc, char** argv)
#endif
/* Clear the background with #ecece1 */
- psplash_fb_draw_rect (fb, 0, 0, fb->canvas.width, fb->canvas.height,
+ psplash_draw_rect(&fb->canvas, 0, 0, fb->canvas.width, fb->canvas.height,
PSPLASH_BACKGROUND_COLOR);
/* Draw the Poky logo */
- psplash_fb_draw_image (fb,
+ psplash_draw_image(&fb->canvas,
(fb->canvas.width - POKY_IMG_WIDTH)/2,
#if PSPLASH_IMG_FULLSCREEN
(fb->canvas.height - POKY_IMG_HEIGHT)/2,
@@ -321,7 +321,7 @@ main (int argc, char** argv)
#ifdef PSPLASH_SHOW_PROGRESS_BAR
/* Draw progress bar border */
- psplash_fb_draw_image (fb,
+ psplash_draw_image(&fb->canvas,
(fb->canvas.width - BAR_IMG_WIDTH)/2,
SPLIT_LINE_POS(fb),
BAR_IMG_WIDTH,
Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> --- psplash-draw.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ psplash-draw.h | 20 +++++++++++++++ psplash-fb.c | 70 -------------------------------------------------- psplash-fb.h | 20 --------------- psplash.c | 16 ++++++------ 5 files changed, 98 insertions(+), 98 deletions(-)