From 9542471f7d166458a31220a33e4bd53769a695fc Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Sat, 26 Jan 2008 01:34:23 +0000 Subject: * Add mktccboot to svn:ignore for tools/ * Rename the resize_test plugin to test_resize for consistency. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16170 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/resize_test.c | 127 --------------------------------------------- apps/plugins/test_resize.c | 127 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 127 deletions(-) delete mode 100644 apps/plugins/resize_test.c create mode 100644 apps/plugins/test_resize.c diff --git a/apps/plugins/resize_test.c b/apps/plugins/resize_test.c deleted file mode 100644 index 8583613d99..0000000000 --- a/apps/plugins/resize_test.c +++ /dev/null @@ -1,127 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2007 Jonas Hurrelmann - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -/* Resizing test plugin. Loads /test.bmp (max 100x100) and displays a resized - * version. Use the scrollwheel or the left/right keys to change the size of - * the resizded version. - */ - -#include "plugin.h" -#include "pluginlib_actions.h" -#include "bmp.h" - -PLUGIN_HEADER - -static struct plugin_api* rb; - -const struct button_mapping *plugin_contexts[] -= {generic_actions, generic_directions}; - -#define NB_ACTION_CONTEXTS sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) - -/* Key assignement */ -#if (CONFIG_KEYPAD == IPOD_1G2G_PAD) \ - || (CONFIG_KEYPAD == IPOD_3G_PAD) \ - || (CONFIG_KEYPAD == IPOD_4G_PAD) \ - || (CONFIG_KEYPAD == SANSA_E200_PAD) -#define SIZE_INCREASE PLA_UP -#define SIZE_INCREASE_REPEAT PLA_UP_REPEAT -#define SIZE_DECREASE PLA_DOWN -#define SIZE_DECREASE_REPEAT PLA_DOWN_REPEAT -#else -#define SIZE_INCREASE PLA_RIGHT -#define SIZE_INCREASE_REPEAT PLA_RIGHT_REPEAT -#define SIZE_DECREASE PLA_LEFT -#define SIZE_DECREASE_REPEAT PLA_LEFT_REPEAT -#endif -#define BUTTON_QUIT PLA_QUIT - -#define MAX_OUTPUT_WIDTH 200 -#define MAX_OUTPUT_HEIGHT 200 - -static fb_data *b; - -static struct bitmap input_bmp; -static struct bitmap output_bmp; - -static fb_data input_bmp_data[100*100]; -static fb_data output_bmp_data[MAX_OUTPUT_WIDTH*MAX_OUTPUT_HEIGHT]; - - -/* this is the plugin entry point */ -enum plugin_status plugin_start(struct plugin_api* api, void* parameter) -{ - (void)parameter; - - rb = api; - b = rb->lcd_framebuffer; - - rb->lcd_set_background(LCD_RGBPACK(0,0,0)); - rb->lcd_clear_display(); // TODO: Optimizes this by e.g. invalidating rects - - input_bmp.data = (char*)input_bmp_data; - output_bmp.data = (char*)output_bmp_data; - - int ret = rb->read_bmp_file("/test.bmp", &input_bmp, sizeof(input_bmp_data), - FORMAT_NATIVE); - - if (ret < 0) { - rb->splash(HZ, "Could not load /test.bmp"); - return PLUGIN_ERROR; - } - - int button; - output_bmp.width = 50; - output_bmp.height = 50; - - DEBUGF("input_bmp_data starts at %p\n", input_bmp_data); - DEBUGF("output_bmp_data starts at %p\n", output_bmp_data); - - while(1) { - rb->lcd_clear_display(); - rb->lcd_bitmap(input_bmp_data, 0, 0, input_bmp.width, input_bmp.height); - - simple_resize_bitmap(&input_bmp, &output_bmp); - - rb->lcd_bitmap(output_bmp_data, 0, 100, output_bmp.width, - output_bmp.height); - - rb->lcd_update(); - button = pluginlib_getaction(rb, HZ, - plugin_contexts, NB_ACTION_CONTEXTS); - switch (button) { - case BUTTON_QUIT: - return PLUGIN_OK; - case SIZE_INCREASE: - case SIZE_INCREASE_REPEAT: - if (output_bmp.width < MAX_OUTPUT_WIDTH - 2) - output_bmp.width += 2; - if (output_bmp.height < MAX_OUTPUT_HEIGHT - 2) - output_bmp.height += 2; - break; - - case SIZE_DECREASE: - case SIZE_DECREASE_REPEAT: - if (output_bmp.width >= 2) output_bmp.width -= 2; - if (output_bmp.height >= 2) output_bmp.height -= 2; - break; - } - } - return PLUGIN_OK; -} diff --git a/apps/plugins/test_resize.c b/apps/plugins/test_resize.c new file mode 100644 index 0000000000..8583613d99 --- /dev/null +++ b/apps/plugins/test_resize.c @@ -0,0 +1,127 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2007 Jonas Hurrelmann + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +/* Resizing test plugin. Loads /test.bmp (max 100x100) and displays a resized + * version. Use the scrollwheel or the left/right keys to change the size of + * the resizded version. + */ + +#include "plugin.h" +#include "pluginlib_actions.h" +#include "bmp.h" + +PLUGIN_HEADER + +static struct plugin_api* rb; + +const struct button_mapping *plugin_contexts[] += {generic_actions, generic_directions}; + +#define NB_ACTION_CONTEXTS sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) + +/* Key assignement */ +#if (CONFIG_KEYPAD == IPOD_1G2G_PAD) \ + || (CONFIG_KEYPAD == IPOD_3G_PAD) \ + || (CONFIG_KEYPAD == IPOD_4G_PAD) \ + || (CONFIG_KEYPAD == SANSA_E200_PAD) +#define SIZE_INCREASE PLA_UP +#define SIZE_INCREASE_REPEAT PLA_UP_REPEAT +#define SIZE_DECREASE PLA_DOWN +#define SIZE_DECREASE_REPEAT PLA_DOWN_REPEAT +#else +#define SIZE_INCREASE PLA_RIGHT +#define SIZE_INCREASE_REPEAT PLA_RIGHT_REPEAT +#define SIZE_DECREASE PLA_LEFT +#define SIZE_DECREASE_REPEAT PLA_LEFT_REPEAT +#endif +#define BUTTON_QUIT PLA_QUIT + +#define MAX_OUTPUT_WIDTH 200 +#define MAX_OUTPUT_HEIGHT 200 + +static fb_data *b; + +static struct bitmap input_bmp; +static struct bitmap output_bmp; + +static fb_data input_bmp_data[100*100]; +static fb_data output_bmp_data[MAX_OUTPUT_WIDTH*MAX_OUTPUT_HEIGHT]; + + +/* this is the plugin entry point */ +enum plugin_status plugin_start(struct plugin_api* api, void* parameter) +{ + (void)parameter; + + rb = api; + b = rb->lcd_framebuffer; + + rb->lcd_set_background(LCD_RGBPACK(0,0,0)); + rb->lcd_clear_display(); // TODO: Optimizes this by e.g. invalidating rects + + input_bmp.data = (char*)input_bmp_data; + output_bmp.data = (char*)output_bmp_data; + + int ret = rb->read_bmp_file("/test.bmp", &input_bmp, sizeof(input_bmp_data), + FORMAT_NATIVE); + + if (ret < 0) { + rb->splash(HZ, "Could not load /test.bmp"); + return PLUGIN_ERROR; + } + + int button; + output_bmp.width = 50; + output_bmp.height = 50; + + DEBUGF("input_bmp_data starts at %p\n", input_bmp_data); + DEBUGF("output_bmp_data starts at %p\n", output_bmp_data); + + while(1) { + rb->lcd_clear_display(); + rb->lcd_bitmap(input_bmp_data, 0, 0, input_bmp.width, input_bmp.height); + + simple_resize_bitmap(&input_bmp, &output_bmp); + + rb->lcd_bitmap(output_bmp_data, 0, 100, output_bmp.width, + output_bmp.height); + + rb->lcd_update(); + button = pluginlib_getaction(rb, HZ, + plugin_contexts, NB_ACTION_CONTEXTS); + switch (button) { + case BUTTON_QUIT: + return PLUGIN_OK; + case SIZE_INCREASE: + case SIZE_INCREASE_REPEAT: + if (output_bmp.width < MAX_OUTPUT_WIDTH - 2) + output_bmp.width += 2; + if (output_bmp.height < MAX_OUTPUT_HEIGHT - 2) + output_bmp.height += 2; + break; + + case SIZE_DECREASE: + case SIZE_DECREASE_REPEAT: + if (output_bmp.width >= 2) output_bmp.width -= 2; + if (output_bmp.height >= 2) output_bmp.height -= 2; + break; + } + } + return PLUGIN_OK; +} -- cgit v1.2.3