From 4eedc933572605e42f6f2fb00d099fe4a2075032 Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Sun, 4 Jan 2009 21:22:05 +0000 Subject: build a scaling-enabled bitmap loader in pluginlib for mono bitmap targets, and use it in the test greylib scaler plugin git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19671 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/lib/SOURCES | 4 ++++ apps/plugins/lib/bmp.c | 2 ++ apps/plugins/lib/core_bmp.c | 24 ++++++++++++++++++++++++ apps/plugins/lib/core_resize.c | 24 ++++++++++++++++++++++++ apps/plugins/test_greylib_bitmap_scale.c | 19 ++++++++++++++++--- 5 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 apps/plugins/lib/core_bmp.c create mode 100644 apps/plugins/lib/core_resize.c (limited to 'apps/plugins') diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index d21f21af15..c8c1553dc8 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES @@ -4,6 +4,10 @@ fixedpoint.c playback_control.c rgb_hsv.c #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) +#if LCD_DEPTH == 1 +core_bmp.c +core_resize.c +#endif grey_core.c grey_draw.c grey_parm.c diff --git a/apps/plugins/lib/bmp.c b/apps/plugins/lib/bmp.c index a8ebbffc27..85e996c5e2 100644 --- a/apps/plugins/lib/bmp.c +++ b/apps/plugins/lib/bmp.c @@ -87,6 +87,8 @@ int save_bmp_file( char* filename, struct bitmap *bm, const struct plugin_api* r } #endif +#include "../../recorder/bmp.c" + /** Very simple image scale from src to dst (nearest neighbour). Source and destination dimensions are read from the struct bitmap. diff --git a/apps/plugins/lib/core_bmp.c b/apps/plugins/lib/core_bmp.c new file mode 100644 index 0000000000..28d70b1bb8 --- /dev/null +++ b/apps/plugins/lib/core_bmp.c @@ -0,0 +1,24 @@ +/*************************************************************************** +* __________ __ ___. +* Open \______ \ ____ ____ | | _\_ |__ _______ ___ +* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +* \/ \/ \/ \/ \/ +* $Id$ +* +* This is a wrapper for the core bmp.c +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +* KIND, either express or implied. +* +****************************************************************************/ + +#include +#include "../../recorder/bmp.c" + diff --git a/apps/plugins/lib/core_resize.c b/apps/plugins/lib/core_resize.c new file mode 100644 index 0000000000..099d4079ed --- /dev/null +++ b/apps/plugins/lib/core_resize.c @@ -0,0 +1,24 @@ +/*************************************************************************** +* __________ __ ___. +* Open \______ \ ____ ____ | | _\_ |__ _______ ___ +* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +* \/ \/ \/ \/ \/ +* $Id$ +* +* This is a wrapper for the core bmp.c +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +* KIND, either express or implied. +* +****************************************************************************/ + +#include +#include "../../recorder/resize.c" + diff --git a/apps/plugins/test_greylib_bitmap_scale.c b/apps/plugins/test_greylib_bitmap_scale.c index f8a7bb92cc..3d6f81f91e 100644 --- a/apps/plugins/test_greylib_bitmap_scale.c +++ b/apps/plugins/test_greylib_bitmap_scale.c @@ -22,6 +22,12 @@ #include "plugin.h" #include "lib/grey.h" +#if LCD_DEPTH == 1 +#define BMP_LOAD read_bmp_file +#else +#define BMP_LOAD rb->read_bmp_file +#endif + PLUGIN_HEADER GREY_INFO_STRUCT static unsigned char grey_bm_buf[LCD_WIDTH * LCD_HEIGHT + @@ -30,6 +36,8 @@ static unsigned char grey_display_buf[2*LCD_WIDTH * LCD_HEIGHT]; static const struct plugin_api* rb; /* global api struct pointer */ +MEM_FUNCTION_WRAPPERS(rb) + /* this is the plugin entry point */ enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { @@ -47,9 +55,14 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame rb->strcpy(filename, parameter); - ret = rb->read_bmp_file(filename, &grey_bm, sizeof(grey_bm_buf), - FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT, - &format_grey); +#if LCD_DEPTH == 1 + bmp_init(rb); + resize_init(rb); +#endif + + ret = BMP_LOAD(filename, &grey_bm, sizeof(grey_bm_buf), + FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT, + &format_grey); if(ret < 1) { -- cgit v1.2.3