aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2018-08-04 00:11:42 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2018-09-27 10:29:07 +0000
commitbb3bc00f304cb4f0611d45555d124221d365bdce (patch)
tree1f96878a551b23276542247f90cd195fc4754643 /main/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch
parent4ecb921f61d14dab2ac6ed518325df376138aa9b (diff)
main/busybox: upgrade to 1.29.3
* Remove all patches already applied upstream * 0001-ash-add-support-for-command_not_found_handle-hook-fu.patch * 0001-cat-fix-cat-e-and-cat-v-erroneously-numbering-1st-li.patch * 0001-wget-emit-a-message-that-certificate-verification-is.patch * 0015-ash-introduce-a-config-option-to-search-current-dire.patch * 0016-top-handle-much-larger-VSZ-values.patch * 0017-ifupdown-do-not-fail-if-interface-disappears-during-.patch * Rename config option for command_not_found hook * upstream patch adding this hook slightly differs from our downstream patch in this regard * Rebase some patches manually: * external_ssl_client.patch * 0006-ping-make-ping-work-without-root-privileges.patch * 0007-fbsplash-support-image-and-bar-alignment-and-positio.patch * Add support for `-e` to our ssl_client * See https://git.busybox.net/busybox/commit/?id=403f2999f94937ba3f37db6d093832f636815bb9 * Update the configuration file * Regenerate all patches using `git format-patch --no-numbered --no-signature` to reduce the diff for future upgrades.
Diffstat (limited to 'main/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch')
-rw-r--r--main/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch119
1 files changed, 57 insertions, 62 deletions
diff --git a/main/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch b/main/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch
index b0cb5cc3d46..ab3421e22ad 100644
--- a/main/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch
+++ b/main/busybox/0008-fbsplash-support-image-and-bar-alignment-and-positio.patch
@@ -1,34 +1,31 @@
-From 97fcb49bfbe74fa17a52e63b2196d8a5c3b27d93 Mon Sep 17 00:00:00 2001
+From cc005e48ebd831199789d9dfb1a9307e743ecdaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Fri, 21 Nov 2014 16:06:34 +0200
-Subject: [PATCH 08/16] fbsplash: support image and bar alignment and
- positioning
+Subject: [PATCH] fbsplash: support image and bar alignment and positioning
+Needed to center a splash screen image in the initramfs.
---
- miscutils/fbsplash.c | 91 +++++++++++++++++++++++++++++++++++++++++++---------
- 1 file changed, 76 insertions(+), 15 deletions(-)
+ miscutils/fbsplash.c | 93 ++++++++++++++++++++++++++++++++------------
+ 1 file changed, 69 insertions(+), 24 deletions(-)
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
-index bc80f728c..9089131b8 100644
+index 1c206ef53..500e04fcc 100644
--- a/miscutils/fbsplash.c
+++ b/miscutils/fbsplash.c
-@@ -53,6 +53,7 @@
- //usage: "\n -c Hide cursor"
+@@ -54,7 +54,7 @@
//usage: "\n -d Framebuffer device (default /dev/fb0)"
//usage: "\n -i Config file (var=value):"
-+//usage: "\n IMAGE_ALIGN"
//usage: "\n BAR_LEFT,BAR_TOP,BAR_WIDTH,BAR_HEIGHT"
- //usage: "\n BAR_R,BAR_G,BAR_B"
+-//usage: "\n BAR_R,BAR_G,BAR_B,IMG_LEFT,IMG_TOP"
++//usage: "\n BAR_R,BAR_G,BAR_B,IMG_LEFT,IMG_TOP,IMG_ALIGN"
//usage: "\n -f Control pipe (else exit after drawing image)"
-@@ -73,13 +74,38 @@
+ //usage: "\n commands: 'NN' (% for progress bar) or 'exit'"
+ //usage: "\n -T Switch to TTY to hide all console messages"
+@@ -73,13 +73,39 @@
#define ESC "\033"
+enum {
-+ image_align,
-+
-+ image_posx,
-+ image_posy,
+ bar_width,
+ bar_height,
+ bar_posx,
@@ -36,11 +33,13 @@ index bc80f728c..9089131b8 100644
+ bar_colr,
+ bar_colg,
+ bar_colb,
-+
-+ debug
++ nimg_posx,
++ nimg_posy,
++ nimg_align,
++ num_ns_opts,
++ debug = num_ns_opts,
+};
+
-+#define nimage_align ns[image_align]
+#define nbar_width ns[bar_width]
+#define nbar_height ns[bar_height]
+#define nbar_posx ns[bar_posx]
@@ -48,6 +47,9 @@ index bc80f728c..9089131b8 100644
+#define nbar_colr ns[bar_colr]
+#define nbar_colg ns[bar_colg]
+#define nbar_colb ns[bar_colb]
++#define img_posx ns[nimg_posx]
++#define img_posy ns[nimg_posy]
++#define img_align ns[nimg_align]
+
struct globals {
#if DEBUG
@@ -55,12 +57,12 @@ index bc80f728c..9089131b8 100644
FILE *logfile_fd; // log file
#endif
unsigned char *addr; // pointer to framebuffer memory
-- unsigned ns[7]; // n-parameters
-+ unsigned ns[debug+1]; // n-parameters
+- unsigned ns[9]; // n-parameters
++ unsigned ns[num_ns_opts]; // n-parameters
const char *image_filename;
int silent_tty, fd_tty_s;
bool do_not_draw;
-@@ -96,14 +122,6 @@ struct globals {
+@@ -96,16 +122,6 @@ struct globals {
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
} while (0)
@@ -71,11 +73,13 @@ index bc80f728c..9089131b8 100644
-#define nbar_colr ns[4] // progress bar color red component
-#define nbar_colg ns[5] // progress bar color green component
-#define nbar_colb ns[6] // progress bar color blue component
+-#define img_posx ns[7] // image horizontal position
+-#define img_posy ns[8] // image vertical position
-
#if DEBUG
#define DEBUG_MESSAGE(strMessage, args...) \
if (G.bdebug_messages) { \
-@@ -384,7 +402,7 @@ static void fb_drawimage(void)
+@@ -386,7 +402,7 @@ static void fb_drawimage(void)
FILE *theme_file;
char *read_ptr;
unsigned char *pixline;
@@ -84,56 +88,54 @@ index bc80f728c..9089131b8 100644
if (LONE_DASH(G.image_filename)) {
theme_file = stdin;
-@@ -434,18 +452,46 @@ static void fb_drawimage(void)
+@@ -436,18 +452,39 @@ static void fb_drawimage(void)
line_size = width*3;
pixline = xmalloc(line_size);
-+#if 0
- if (width > G.scr_var.xres)
- width = G.scr_var.xres;
- if (height > G.scr_var.yres)
- height = G.scr_var.yres;
+- if ((width + G.img_posx) > G.scr_var.xres)
+- width = G.scr_var.xres - G.img_posx;
+- if ((height + G.img_posy) > G.scr_var.yres)
+- height = G.scr_var.yres - G.img_posy;
- for (j = 0; j < height; j++) {
-+#endif
-+
-+ xoffs = yoffs = 0;
-+ switch (G.nimage_align % 3) {
-+ case 1: xoffs = (G.scr_var.xres - width) / 2; break;
-+ case 2: xoffs = G.scr_var.xres - width; break;
++ xoffs = G.img_posx;
++ switch (G.img_align % 3) {
++ case 1: xoffs += (G.scr_var.xres - width) / 2; break;
++ case 2: xoffs += G.scr_var.xres - width; break;
+ }
+ xstart = 0;
+ if (xoffs < 0) {
+ xstart = -xoffs;
-+ width -= xstart;
+ xoffs = 0;
+ }
-+ xoffs *= G.bytes_per_pixel;
-+ if (width > G.scr_var.xres)
-+ width = G.scr_var.xres;
++ if ((width + xoffs) > G.scr_var.xres)
++ width = G.scr_var.xres - xoffs;
+
-+ switch (G.nimage_align / 3) {
-+ case 1: yoffs = (G.scr_var.yres - height) / 2; break;
-+ case 2: yoffs = G.scr_var.yres - height; break;
++ yoffs = G.img_posy;
++ switch (G.img_align / 3) {
++ case 1: yoffs += (G.scr_var.yres - height) / 2; break;
++ case 2: yoffs += G.scr_var.yres - height; break;
+ }
++ if ((height + yoffs) > G.scr_var.yres)
++ height = G.scr_var.yres - yoffs;
+
-+ for (j = 0; j < height && yoffs < G.scr_var.yres; j++, yoffs++) {
++ for (j = 0; j < height; j++, yoffs++) {
unsigned char *pixel;
unsigned char *src;
if (fread(pixline, 1, line_size, theme_file) != line_size)
bb_error_msg_and_die("bad PPM file '%s'", G.image_filename);
+- pixel = pixline;
+- src = G.addr + (G.img_posy + j) * G.scr_fix.line_length + G.img_posx * G.bytes_per_pixel;
+
+ if (yoffs < 0)
+ continue;
+
- pixel = pixline;
-- src = G.addr + j * G.scr_fix.line_length;
-+ src = G.addr + yoffs * G.scr_fix.line_length + xoffs;
-+
++ pixel = pixline + xstart * 3;
++ src = G.addr + yoffs * G.scr_fix.line_length + xoffs * G.bytes_per_pixel;
for (i = 0; i < width; i++) {
unsigned thispix = fb_pixel_value(pixel[0], pixel[1], pixel[2]);
fb_write_pixel(src, thispix);
-@@ -464,9 +510,17 @@ static void fb_drawimage(void)
+@@ -466,11 +503,15 @@ static void fb_drawimage(void)
*/
static void init(const char *cfg_filename)
{
@@ -142,40 +144,33 @@ index bc80f728c..9089131b8 100644
+ "LM\0" "CM\0" "RM\0"
+ "LB\0" "CB\0" "RB\0";
static const char param_names[] ALIGN1 =
-+ "IMAGE_ALIGN\0"
-+
-+ "IMAGE_X\0" "IMAGE_Y\0"
"BAR_WIDTH\0" "BAR_HEIGHT\0"
"BAR_LEFT\0" "BAR_TOP\0"
-+
"BAR_R\0" "BAR_G\0" "BAR_B\0"
+- "IMG_LEFT\0" "IMG_TOP\0"
++ "IMG_LEFT\0" "IMG_TOP\0" "IMG_ALIGN\0"
#if DEBUG
"DEBUG\0"
-@@ -476,14 +530,21 @@ static void init(const char *cfg_filename)
+ #endif
+@@ -479,14 +520,18 @@ static void init(const char *cfg_filename)
parser_t *parser = config_open2(cfg_filename, xfopen_stdin);
while (config_read(parser, token, 2, 2, "#=",
(PARSE_NORMAL | PARSE_MIN_DIE) & ~(PARSE_TRIM | PARSE_COLLAPSE))) {
- unsigned val = xatoi_positive(token[1]);
+ unsigned val;
int i = index_in_strings(param_names, token[0]);
-+
if (i < 0)
bb_error_msg_and_die("syntax error: %s", token[0]);
-- if (i >= 0 && i < 7)
-+
-+ if (i <= image_align)
+- if (i >= 0 && i < 9)
++ if (i == nimg_align)
+ val = index_in_strings(align_names, token[1]);
+ else
+ val = xatoi_positive(token[1]);
-+
-+ if (i < debug)
++ if (i < num_ns_opts)
G.ns[i] = val;
#if DEBUG
-- if (i == 7) {
+- if (i == 9) {
+ if (i == debug) {
G.bdebug_messages = val;
if (G.bdebug_messages)
G.logfile_fd = xfopen_for_write("/tmp/fbsplash.log");
---
-2.16.2
-