+2006-12-22 Matthew Allum <mallum@openedhand.com>
+
+ * psplash-fb.c:
+ * psplash-fb.h:
+ * psplash.c:
+ Add -angle cmd line arg, hopefully fix rotation
+
2006-12-19 Matthew Allum <mallum@openedhand.com>
* psplash-fb.c:
}
PSplashFB*
-psplash_fb_new (void)
+psplash_fb_new (int angle)
{
struct fb_var_screeninfo fb_var;
struct fb_fix_screeninfo fb_fix;
status = 2;
#endif
+ fb->angle = angle;
+
switch (fb->angle)
{
case 270:
return NULL;
}
+#define OFFSET(fb,x,y) (((y) * (fb)->stride) + ((x) * ((fb)->bpp >> 3)))
+
inline void
psplash_fb_plot_pixel (PSplashFB *fb,
int x,
{
int off;
+ if (x < 0 || x > fb->width-1 || y < 0 || y > fb->height-1)
+ return;
+
switch (fb->angle)
{
case 270:
- off = ((fb->width - x) * fb->stride) + (y * (fb->bpp >> 3));
+ off = OFFSET (fb, fb->real_height - y - 1, x);
break;
case 180:
- off = ((fb->height - y) * fb->stride) + ((fb->width - x) * (fb->bpp >> 3));
+ off = OFFSET (fb, fb->real_width - x - 1, fb->real_height - y - 1);
break;
case 90:
- off = (x * fb->stride) + (y * (fb->bpp >> 3));
+ off = OFFSET (fb, y, fb->real_width - x - 1);
break;
case 0:
default:
- if (x < 0 || x > fb->width-1 || y < 0 || y > fb->height-1)
- return;
- off = (y * fb->stride) + (x * (fb->bpp >> 3));
+ off = OFFSET (fb, x, y);
break;
}
psplash_fb_destroy (PSplashFB *fb);
PSplashFB*
-psplash_fb_new (void);
+psplash_fb_new (int angle);
inline void
psplash_fb_plot_pixel (PSplashFB *fb,
main (int argc, char** argv)
{
char *tmpdir;
- int pipe_fd, i = 0;
+ int pipe_fd, i = 0, angle = 0;
PSplashFB *fb;
bool disable_console_switch = FALSE;
disable_console_switch = TRUE;
continue;
}
- fprintf(stderr, "Usage: %s [-n|--no-console-switch]\n", argv[0]);
+
+ if (!strcmp(argv[i],"-a") || !strcmp(argv[i],"--angle"))
+ {
+ if (++i > argc) goto fail;
+ angle = atoi(argv[0]);
+ continue;
+ }
+
+ fail:
+ fprintf(stderr, "Usage: %s [-n|--no-console-switch] [-a|--angle <0|90|180|270>]\n", argv[0]);
exit(-1);
}
if (!disable_console_switch)
psplash_console_switch ();
- if ((fb = psplash_fb_new()) == NULL)
+ if ((fb = psplash_fb_new(angle)) == NULL)
exit(-1);
/* Clear the background with #ecece1 */