summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-01-04 21:22:05 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-01-04 21:22:05 +0000
commit4eedc933572605e42f6f2fb00d099fe4a2075032 (patch)
tree4e623580b92763369fb824ec725a28b71f9272ef /apps/plugins
parentb93874fefcb152f5e079366c6bf65df7ebf657fa (diff)
downloadrockbox-4eedc933572605e42f6f2fb00d099fe4a2075032.tar.gz
rockbox-4eedc933572605e42f6f2fb00d099fe4a2075032.zip
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
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/lib/SOURCES4
-rw-r--r--apps/plugins/lib/bmp.c2
-rw-r--r--apps/plugins/lib/core_bmp.c24
-rw-r--r--apps/plugins/lib/core_resize.c24
-rw-r--r--apps/plugins/test_greylib_bitmap_scale.c19
5 files changed, 70 insertions, 3 deletions
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
4playback_control.c 4playback_control.c
5rgb_hsv.c 5rgb_hsv.c
6#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) 6#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
7#if LCD_DEPTH == 1
8core_bmp.c
9core_resize.c
10#endif
7grey_core.c 11grey_core.c
8grey_draw.c 12grey_draw.c
9grey_parm.c 13grey_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
87} 87}
88#endif 88#endif
89 89
90#include "../../recorder/bmp.c"
91
90/** 92/**
91 Very simple image scale from src to dst (nearest neighbour). 93 Very simple image scale from src to dst (nearest neighbour).
92 Source and destination dimensions are read from the struct bitmap. 94 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 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* This is a wrapper for the core bmp.c
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version 2
15* of the License, or (at your option) any later version.
16*
17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18* KIND, either express or implied.
19*
20****************************************************************************/
21
22#include <plugin.h>
23#include "../../recorder/bmp.c"
24
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 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* This is a wrapper for the core bmp.c
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version 2
15* of the License, or (at your option) any later version.
16*
17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18* KIND, either express or implied.
19*
20****************************************************************************/
21
22#include <plugin.h>
23#include "../../recorder/resize.c"
24
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 @@
22#include "plugin.h" 22#include "plugin.h"
23#include "lib/grey.h" 23#include "lib/grey.h"
24 24
25#if LCD_DEPTH == 1
26#define BMP_LOAD read_bmp_file
27#else
28#define BMP_LOAD rb->read_bmp_file
29#endif
30
25PLUGIN_HEADER 31PLUGIN_HEADER
26GREY_INFO_STRUCT 32GREY_INFO_STRUCT
27static unsigned char grey_bm_buf[LCD_WIDTH * LCD_HEIGHT + 33static unsigned char grey_bm_buf[LCD_WIDTH * LCD_HEIGHT +
@@ -30,6 +36,8 @@ static unsigned char grey_display_buf[2*LCD_WIDTH * LCD_HEIGHT];
30 36
31static const struct plugin_api* rb; /* global api struct pointer */ 37static const struct plugin_api* rb; /* global api struct pointer */
32 38
39MEM_FUNCTION_WRAPPERS(rb)
40
33/* this is the plugin entry point */ 41/* this is the plugin entry point */
34enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) 42enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
35{ 43{
@@ -47,9 +55,14 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
47 55
48 rb->strcpy(filename, parameter); 56 rb->strcpy(filename, parameter);
49 57
50 ret = rb->read_bmp_file(filename, &grey_bm, sizeof(grey_bm_buf), 58#if LCD_DEPTH == 1
51 FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT, 59 bmp_init(rb);
52 &format_grey); 60 resize_init(rb);
61#endif
62
63 ret = BMP_LOAD(filename, &grey_bm, sizeof(grey_bm_buf),
64 FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT,
65 &format_grey);
53 66
54 if(ret < 1) 67 if(ret < 1)
55 { 68 {