forked from len0rd/rockbox
Refactor the panning code into separate functions, and correct a comment
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18865 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
106b68e3a7
commit
188e898e3c
1 changed files with 152 additions and 115 deletions
|
@ -463,54 +463,13 @@ int show_menu(void) /* return 1 to quit */
|
||||||
menu_exit(m);
|
menu_exit(m);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* interactively scroll around the image */
|
|
||||||
int scroll_bmp(struct t_disp* pdisp)
|
|
||||||
{
|
|
||||||
int lastbutton = 0;
|
|
||||||
|
|
||||||
while (true)
|
/* Pan the viewing window right - move image to the left and fill in
|
||||||
{
|
the right-hand side */
|
||||||
int button;
|
static void pan_view_right(struct t_disp* pdisp)
|
||||||
|
{
|
||||||
int move;
|
int move;
|
||||||
|
|
||||||
if (slideshow_enabled)
|
|
||||||
button = rb->button_get_w_tmo(jpeg_settings.ss_timeout * HZ);
|
|
||||||
else button = rb->button_get(true);
|
|
||||||
|
|
||||||
running_slideshow = false;
|
|
||||||
|
|
||||||
switch(button)
|
|
||||||
{
|
|
||||||
case JPEG_LEFT:
|
|
||||||
if (!(ds < ds_max) && entries > 0 && jpg.x_size <= MAX_X_SIZE)
|
|
||||||
return change_filename(DIR_PREV);
|
|
||||||
case JPEG_LEFT | BUTTON_REPEAT:
|
|
||||||
move = MIN(HSCROLL, pdisp->x);
|
|
||||||
if (move > 0)
|
|
||||||
{
|
|
||||||
MYXLCD(scroll_right)(move); /* scroll right */
|
|
||||||
pdisp->x -= move;
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
|
||||||
yuv_bitmap_part(
|
|
||||||
pdisp->bitmap, pdisp->csub_x, pdisp->csub_y,
|
|
||||||
pdisp->x, pdisp->y, pdisp->stride,
|
|
||||||
0, MAX(0, (LCD_HEIGHT-pdisp->height)/2), /* x, y */
|
|
||||||
move, MIN(LCD_HEIGHT, pdisp->height), /* w, h */
|
|
||||||
jpeg_settings.colour_mode, jpeg_settings.dither_mode);
|
|
||||||
#else
|
|
||||||
MYXLCD(gray_bitmap_part)(
|
|
||||||
pdisp->bitmap[0], pdisp->x, pdisp->y, pdisp->stride,
|
|
||||||
0, MAX(0, (LCD_HEIGHT-pdisp->height)/2), /* x, y */
|
|
||||||
move, MIN(LCD_HEIGHT, pdisp->height)); /* w, h */
|
|
||||||
#endif
|
|
||||||
MYLCD_UPDATE();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case JPEG_RIGHT:
|
|
||||||
if (!(ds < ds_max) && entries > 0 && jpg.x_size <= MAX_X_SIZE)
|
|
||||||
return change_filename(DIR_NEXT);
|
|
||||||
case JPEG_RIGHT | BUTTON_REPEAT:
|
|
||||||
move = MIN(HSCROLL, pdisp->width - pdisp->x - LCD_WIDTH);
|
move = MIN(HSCROLL, pdisp->width - pdisp->x - LCD_WIDTH);
|
||||||
if (move > 0)
|
if (move > 0)
|
||||||
{
|
{
|
||||||
|
@ -532,10 +491,43 @@ int scroll_bmp(struct t_disp* pdisp)
|
||||||
#endif
|
#endif
|
||||||
MYLCD_UPDATE();
|
MYLCD_UPDATE();
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
|
||||||
|
/* Pan the viewing window left - move image to the right and fill in
|
||||||
|
the left-hand side */
|
||||||
|
static void pan_view_left(struct t_disp* pdisp)
|
||||||
|
{
|
||||||
|
int move;
|
||||||
|
|
||||||
|
move = MIN(HSCROLL, pdisp->x);
|
||||||
|
if (move > 0)
|
||||||
|
{
|
||||||
|
MYXLCD(scroll_right)(move); /* scroll right */
|
||||||
|
pdisp->x -= move;
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
yuv_bitmap_part(
|
||||||
|
pdisp->bitmap, pdisp->csub_x, pdisp->csub_y,
|
||||||
|
pdisp->x, pdisp->y, pdisp->stride,
|
||||||
|
0, MAX(0, (LCD_HEIGHT-pdisp->height)/2), /* x, y */
|
||||||
|
move, MIN(LCD_HEIGHT, pdisp->height), /* w, h */
|
||||||
|
jpeg_settings.colour_mode, jpeg_settings.dither_mode);
|
||||||
|
#else
|
||||||
|
MYXLCD(gray_bitmap_part)(
|
||||||
|
pdisp->bitmap[0], pdisp->x, pdisp->y, pdisp->stride,
|
||||||
|
0, MAX(0, (LCD_HEIGHT-pdisp->height)/2), /* x, y */
|
||||||
|
move, MIN(LCD_HEIGHT, pdisp->height)); /* w, h */
|
||||||
|
#endif
|
||||||
|
MYLCD_UPDATE();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Pan the viewing window up - move image down and fill in
|
||||||
|
the top */
|
||||||
|
static void pan_view_up(struct t_disp* pdisp)
|
||||||
|
{
|
||||||
|
int move;
|
||||||
|
|
||||||
case JPEG_UP:
|
|
||||||
case JPEG_UP | BUTTON_REPEAT:
|
|
||||||
move = MIN(VSCROLL, pdisp->y);
|
move = MIN(VSCROLL, pdisp->y);
|
||||||
if (move > 0)
|
if (move > 0)
|
||||||
{
|
{
|
||||||
|
@ -563,10 +555,14 @@ int scroll_bmp(struct t_disp* pdisp)
|
||||||
#endif
|
#endif
|
||||||
MYLCD_UPDATE();
|
MYLCD_UPDATE();
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
|
||||||
|
/* Pan the viewing window down - move image up and fill in
|
||||||
|
the bottom */
|
||||||
|
static void pan_view_down(struct t_disp* pdisp)
|
||||||
|
{
|
||||||
|
int move;
|
||||||
|
|
||||||
case JPEG_DOWN:
|
|
||||||
case JPEG_DOWN | BUTTON_REPEAT:
|
|
||||||
move = MIN(VSCROLL, pdisp->height - pdisp->y - LCD_HEIGHT);
|
move = MIN(VSCROLL, pdisp->height - pdisp->y - LCD_HEIGHT);
|
||||||
if (move > 0)
|
if (move > 0)
|
||||||
{
|
{
|
||||||
|
@ -609,7 +605,48 @@ int scroll_bmp(struct t_disp* pdisp)
|
||||||
#endif
|
#endif
|
||||||
MYLCD_UPDATE();
|
MYLCD_UPDATE();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* interactively scroll around the image */
|
||||||
|
int scroll_bmp(struct t_disp* pdisp)
|
||||||
|
{
|
||||||
|
int button;
|
||||||
|
int lastbutton = 0;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (slideshow_enabled)
|
||||||
|
button = rb->button_get_w_tmo(jpeg_settings.ss_timeout * HZ);
|
||||||
|
else button = rb->button_get(true);
|
||||||
|
|
||||||
|
running_slideshow = false;
|
||||||
|
|
||||||
|
switch(button)
|
||||||
|
{
|
||||||
|
case JPEG_LEFT:
|
||||||
|
if (!(ds < ds_max) && entries > 0 && jpg.x_size <= MAX_X_SIZE)
|
||||||
|
return change_filename(DIR_PREV);
|
||||||
|
case JPEG_LEFT | BUTTON_REPEAT:
|
||||||
|
pan_view_left(pdisp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case JPEG_RIGHT:
|
||||||
|
if (!(ds < ds_max) && entries > 0 && jpg.x_size <= MAX_X_SIZE)
|
||||||
|
return change_filename(DIR_NEXT);
|
||||||
|
case JPEG_RIGHT | BUTTON_REPEAT:
|
||||||
|
pan_view_right(pdisp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JPEG_UP:
|
||||||
|
case JPEG_UP | BUTTON_REPEAT:
|
||||||
|
pan_view_up(pdisp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JPEG_DOWN:
|
||||||
|
case JPEG_DOWN | BUTTON_REPEAT:
|
||||||
|
pan_view_down(pdisp);
|
||||||
|
break;
|
||||||
|
|
||||||
case BUTTON_NONE:
|
case BUTTON_NONE:
|
||||||
if (!slideshow_enabled)
|
if (!slideshow_enabled)
|
||||||
break;
|
break;
|
||||||
|
@ -1194,8 +1231,8 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
|
||||||
xlcd_init(rb);
|
xlcd_init(rb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* should be ok to just load settings since a parameter is present
|
/* should be ok to just load settings since the plugin itself has
|
||||||
here and the drive should be spinning */
|
just been loaded from disk and the drive should be spinning */
|
||||||
configfile_init(rb);
|
configfile_init(rb);
|
||||||
configfile_load(JPEG_CONFIGFILE, jpeg_config,
|
configfile_load(JPEG_CONFIGFILE, jpeg_config,
|
||||||
ARRAYLEN(jpeg_config), JPEG_SETTINGS_MINVERSION);
|
ARRAYLEN(jpeg_config), JPEG_SETTINGS_MINVERSION);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue