Index: android/src/org/rockbox/Helper/RunForegroundManager.java
===================================================================
--- android/src/org/rockbox/Helper/RunForegroundManager.java (revision 30742)
+++ android/src/org/rockbox/Helper/RunForegroundManager.java (working copy)
@@ -69,6 +69,7 @@
* We use a layout id because it is a unique number.
* We use it later to cancel.
*/
+ Logger.d("FGMan startForeground");
mNM.notify(R.string.notification, mNotification);
/*
* this call makes the service run as foreground, which
@@ -83,6 +84,7 @@
/* Note to cancel BEFORE changing the
* foreground state, since we could be killed at that point.
*/
+ Logger.d("FGMan stopForeground");
mNM.cancel(R.string.notification);
api.stopForeground();
mWidgetUpdate = null;
Index: android/src/org/rockbox/RockboxActivity.java
===================================================================
--- android/src/org/rockbox/RockboxActivity.java (revision 30742)
+++ android/src/org/rockbox/RockboxActivity.java (working copy)
@@ -31,6 +31,7 @@
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
+import android.util.Log;
public class RockboxActivity extends Activity
{
@@ -40,8 +41,10 @@
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
+/*
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
+*/
Intent intent = new Intent(this, RockboxService.class);
intent.setAction(Intent.ACTION_MAIN);
intent.putExtra("callback", new ResultReceiver(new Handler(getMainLooper())) {
@@ -98,6 +101,8 @@
public void onResume()
{
+ LOG("onResume");
+ setServiceActivity(true);
super.onResume();
setVisible(true);
}
@@ -108,6 +113,7 @@
@Override
protected void onPause()
{
+ LOG("onPause");
super.onPause();
/* this will cause the framebuffer's Surface to be destroyed, enabling
* us to disable drawing */
@@ -117,6 +123,7 @@
@Override
protected void onStop()
{
+ LOG("onStop");
super.onStop();
setServiceActivity(false);
}
@@ -124,7 +131,13 @@
@Override
protected void onDestroy()
{
+ LOG("onDestroy");
super.onDestroy();
setServiceActivity(false);
}
+
+ private void LOG(CharSequence text)
+ {
+ Log.d("RockboxActivity ", (String) text);
+ }
}
Index: android/src/org/rockbox/RockboxService.java
===================================================================
--- android/src/org/rockbox/RockboxService.java (revision 30742)
+++ android/src/org/rockbox/RockboxService.java (working copy)
@@ -60,6 +60,10 @@
private MediaButtonReceiver mMediaButtonReceiver;
private ResultReceiver resultReceiver;
+ private boolean music_playing = false;
+ private boolean app_open = false;
+ private boolean paused = false;
+
public static final int RESULT_INVOKING_MAIN = 0;
public static final int RESULT_LIB_LOAD_PROGRESS = 1;
public static final int RESULT_SERVICE_RUNNING = 3;
@@ -90,9 +94,37 @@
{
return current_activity;
}
+
+ private native void tickpause();
+ private native void tickresume();
+
+ private void check_sleep()
+ {
+ if (paused)
+ {
+ if (music_playing || app_open)
+ {
+ LOG("Tick resume");
+// tickresume();
+ paused = false;
+ }
+ }
+ else
+ {
+ if (!music_playing && !app_open)
+ {
+ LOG("Tick pause");
+// tickpause();
+ paused = true;
+ }
+ }
+ }
+
public void set_activity(Activity a)
{
+ app_open = (a != null);
current_activity = a;
+ check_sleep();
}
private void do_start(Intent intent)
@@ -138,20 +170,22 @@
private void LOG(CharSequence text)
{
- Log.d("Rockbox", (String) text);
+ Log.d("RockboxService", (String) text);
}
private void LOG(CharSequence text, Throwable tr)
{
- Log.d("Rockbox", (String) text, tr);
+ Log.d("RockboxService", (String) text, tr);
}
public void onStart(Intent intent, int startId) {
+ LOG("onStartCommand");
do_start(intent);
}
public int onStartCommand(Intent intent, int flags, int startId)
{
+ LOG("onStartCommand");
/* if null, then the service was most likely restarted by android
* after getting killed for memory pressure earlier */
if (intent == null)
@@ -324,12 +358,18 @@
void startForeground()
{
+ LOG("startForeground");
+ music_playing = true;
+ check_sleep();
fg_runner.startForeground();
}
void stopForeground()
{
+ LOG("stopForeground");
+ music_playing = false;
fg_runner.stopForeground();
+ check_sleep();
}
@Override
Index: apps/screen_access.c
===================================================================
--- apps/screen_access.c (revision 30742)
+++ apps/screen_access.c (working copy)
@@ -186,10 +186,8 @@
.vline=&lcd_vline,
.hline=&lcd_hline,
.scroll_step=&lcd_scroll_step,
- .puts_style_offset=&lcd_puts_style_offset,
- .puts_style_xyoffset=&lcd_puts_style_xyoffset,
+ .putsxy_style_xyoffset=&lcd_putsxy_style_xyoffset,
.puts_scroll_style=&lcd_puts_scroll_style,
- .puts_scroll_style_offset=&lcd_puts_scroll_style_offset,
.puts_scroll_style_xyoffset=&lcd_puts_scroll_style_xyoffset,
#endif /* HAVE_LCD_BITMAP */
@@ -205,9 +203,7 @@
.putsxy=&lcd_putsxy,
.puts=&lcd_puts,
.putsf=&lcd_putsf,
- .puts_offset=&lcd_puts_offset,
.puts_scroll=&lcd_puts_scroll,
- .puts_scroll_offset=&lcd_puts_scroll_offset,
.scroll_speed=&lcd_scroll_speed,
.scroll_delay=&lcd_scroll_delay,
.stop_scroll=&lcd_stop_scroll,
@@ -279,10 +275,8 @@
.vline=&lcd_remote_vline,
.hline=&lcd_remote_hline,
.scroll_step=&lcd_remote_scroll_step,
- .puts_style_offset=&lcd_remote_puts_style_offset,
- .puts_style_xyoffset=&lcd_remote_puts_style_xyoffset,
+ .putsxy_style_xyoffset=&lcd_remote_puts_style_xyoffset,
.puts_scroll_style=&lcd_remote_puts_scroll_style,
- .puts_scroll_style_offset=&lcd_remote_puts_scroll_style_offset,
.puts_scroll_style_xyoffset=&lcd_remote_puts_scroll_style_xyoffset,
#endif /* 1 */
@@ -296,9 +290,7 @@
.putsxy=&lcd_remote_putsxy,
.puts=&lcd_remote_puts,
.putsf=&lcd_remote_putsf,
- .puts_offset=&lcd_remote_puts_offset,
.puts_scroll=&lcd_remote_puts_scroll,
- .puts_scroll_offset=&lcd_remote_puts_scroll_offset,
.scroll_speed=&lcd_remote_scroll_speed,
.scroll_delay=&lcd_remote_scroll_delay,
.stop_scroll=&lcd_remote_stop_scroll,
Index: apps/screen_access.h
===================================================================
--- apps/screen_access.h (revision 30742)
+++ apps/screen_access.h (working copy)
@@ -78,14 +78,10 @@
int (*getfont)(void);
void (*scroll_step)(int pixels);
- void (*puts_style_offset)(int x, int y, const unsigned char *str,
- int style, int x_offset);
- void (*puts_style_xyoffset)(int x, int y, const unsigned char *str,
- int style, int x_offset, int y_offset);
+ void (*putsxy_style_xyoffset)(int x, int y, const unsigned char *str,
+ int style, int x_offset, int y_offset);
void (*puts_scroll_style)(int x, int y, const unsigned char *string,
int style);
- void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
- int style, int x_offset);
void (*puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string,
int style, int x_offset, int y_offset);
void (*mono_bitmap)(const unsigned char *src,
@@ -139,10 +135,7 @@
void (*putsxy)(int x, int y, const unsigned char *str);
void (*puts)(int x, int y, const unsigned char *str);
void (*putsf)(int x, int y, const unsigned char *str, ...);
- void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
void (*puts_scroll)(int x, int y, const unsigned char *string);
- void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
- int x_offset);
void (*scroll_speed)(int speed);
void (*scroll_delay)(int ms);
void (*stop_scroll)(void);
Index: apps/gui/bitmap/list.c
===================================================================
--- apps/gui/bitmap/list.c (revision 30742)
+++ apps/gui/bitmap/list.c (working copy)
@@ -312,7 +312,7 @@
if (item_offset> item_width - (list_text_vp->width - text_pos))
{
/* don't scroll */
- display->puts_style_xyoffset(0, line, entry_name,
+ display->putsxy_style_xyoffset(0, line*h, entry_name,
style, item_offset, draw_offset);
}
else
@@ -324,10 +324,10 @@
else
{
if (list->scroll_all)
- display->puts_scroll_style_xyoffset(0, line, entry_name,
+ display->puts_scroll_style_xyoffset(0, line*h, entry_name,
style, item_offset, draw_offset);
else
- display->puts_style_xyoffset(0, line, entry_name,
+ display->putsxy_style_xyoffset(0, line, entry_name,
style, item_offset, draw_offset);
}
/* do the icon */
Index: apps/gui/skin_engine/skin_display.c
===================================================================
--- apps/gui/skin_engine/skin_display.c (revision 30742)
+++ apps/gui/skin_engine/skin_display.c (working copy)
@@ -596,9 +596,10 @@
else
{
#ifdef HAVE_LCD_BITMAP
+ int ypos = line * string_height;
/* clear the line first */
display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- display->fillrect(left_xpos, line*string_height, display->getwidth(), string_height);
+ display->fillrect(left_xpos, ypos, display->getwidth(), string_height);
display->set_drawmode(DRMODE_SOLID);
#endif
@@ -609,18 +610,18 @@
/* print aligned strings */
if (left_width != 0)
{
- display->puts_style_xyoffset(left_xpos/space_width, line,
+ display->putsxy_style_xyoffset(left_xpos, ypos,
(unsigned char *)format_align->left, style, 0, 0);
}
if (center_width != 0)
{
- display->puts_style_xyoffset(center_xpos/space_width, line,
+ display->putsxy_style_xyoffset(center_xpos, ypos,
(unsigned char *)format_align->center, style, 0, 0);
}
if (right_width != 0)
{
- display->puts_style_xyoffset(right_xpos/space_width, line,
+ display->putsxy_style_xyoffset(right_xpos, ypos,
(unsigned char *)format_align->right, style, 0, 0);
}
#else
Index: apps/debug_menu.c
===================================================================
--- apps/debug_menu.c (revision 30742)
+++ apps/debug_menu.c (working copy)
@@ -2120,9 +2120,9 @@
};
static int menu_action_callback(int btn, struct gui_synclist *lists)
{
- int i;
if (btn == ACTION_STD_OK)
{
+ int i;
FOR_NB_SCREENS(i)
viewportmanager_theme_enable(i, false, NULL);
menuitems[gui_synclist_get_sel_pos(lists)].function();
Index: wps/cabbiev2.480x800x16.wps
===================================================================
--- wps/cabbiev2.480x800x16.wps (revision 30742)
+++ wps/cabbiev2.480x800x16.wps (working copy)
@@ -52,15 +52,15 @@
%s%ac%?id<%id|%?d(1)<%d(1)|%(root%)>>
# next track info - AA
-%Vl(d,0,550,-,-,-)
+%Vl(d,0,512,-,-,-)
%?C<%s%ac%Sx(Next:) %?Ia<%Ia|%?D(2)<%D(2)|%(root%)>> - %?It<%It|%Fn>|%s%ac%?Id<%Id|%?D(1)<%D(1)|%(root%)>>>
# playtime
-%V(20,660,440,36,-)
+%V(20,622,440,36,-)
%pc%ac%?Sr<%pe %Sx(of) %pp|%pp %Sx(of) %pe>%ar%pr
# progressbar and bottom icons
-%V(0,600,-,-,-)
+%V(0,562,-,-,-)
%pb(25,11,430,-,pb-480x800x16.bmp)
%T(25,0,430,50,progressbar)
@@ -95,7 +95,7 @@
#
# ff/rewind button
#
-%V(0,720,150,75,-)
+%V(0,682,150,75,-)
%xd(H)%xd(I)
%T(0,0,70,75,rwd, repeat)
%T(0,0,70,75,prev)
Index: firmware/export/lcd.h
===================================================================
--- firmware/export/lcd.h (revision 30742)
+++ firmware/export/lcd.h (working copy)
@@ -197,9 +197,6 @@
extern void lcd_puts(int x, int y, const unsigned char *string);
extern void lcd_putsf(int x, int y, const unsigned char *fmt, ...);
extern void lcd_puts_style(int x, int y, const unsigned char *string, int style);
-extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset);
-extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string,
- int offset);
extern void lcd_putc(int x, int y, unsigned long ucs);
extern void lcd_stop_scroll(void);
extern void lcd_bidir_scroll(int threshold);
@@ -481,14 +478,10 @@
extern void lcd_setfont(int font);
extern int lcd_getfont(void);
-extern void lcd_puts_style_offset(int x, int y, const unsigned char *str,
- int style, int x_offset);
-extern void lcd_puts_style_xyoffset(int x, int y, const unsigned char *str,
+extern void lcd_putsxy_style_xyoffset(int x, int y, const unsigned char *str,
int style, int x_offset, int y_offset);
-extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
- int style, int x_offset);
extern void lcd_puts_scroll_style_xyoffset(int x, int y, const unsigned char *string,
- int style, int x_offset, int y_offset);
+ int style, int x_offset, int y_offset);
/* low level drawing function pointer arrays */
#if LCD_DEPTH >= 8
Index: firmware/export/config/android.h
===================================================================
--- firmware/export/config/android.h (revision 30742)
+++ firmware/export/config/android.h (working copy)
@@ -50,6 +50,9 @@
#define LCD_DEPTH 16
#define LCD_PIXELFORMAT 565
+/* define this if you use relative (percent) screen coordinates */
+#define LCD_RELATIVE
+
#define HAVE_LCD_ENABLE
/* define this to indicate your device's keypad */
Index: firmware/export/config/sdlapp.h
===================================================================
--- firmware/export/config/sdlapp.h (revision 30742)
+++ firmware/export/config/sdlapp.h (working copy)
@@ -50,6 +50,9 @@
#define LCD_DEPTH 16
#define LCD_PIXELFORMAT 565
+/* define this if you use relative (percent) screen coordinates */
+#define LCD_RELATIVE
+
/* define this to indicate your device's keypad */
#define HAVE_TOUCHSCREEN
#define HAVE_BUTTON_DATA
Index: firmware/target/hosted/android/kernel-android.c
===================================================================
--- firmware/target/hosted/android/kernel-android.c (revision 30742)
+++ firmware/target/hosted/android/kernel-android.c (working copy)
@@ -19,7 +19,7 @@
*
****************************************************************************/
-
+#include <jni.h>
#include <time.h>
#include <signal.h>
#include <errno.h>
@@ -67,21 +67,25 @@
*
* Can be possibly be attached if it really needs to be. but let's
* keep this leightweight */
+static timer_t timerid = 0;
+static int nsec;
+
void tick_start(unsigned int interval_in_ms)
{
int ret = 0;
- timer_t timerid;
struct itimerspec ts;
sigevent_t sigev;
/* initializing in the declaration causes some weird warnings */
memset(&sigev, 0, sizeof(sigevent_t));
- sigev.sigev_notify = SIGEV_THREAD,
- sigev.sigev_notify_function = timer_signal,
+ sigev.sigev_notify = SIGEV_THREAD;
+ sigev.sigev_notify_function = timer_signal;
+ nsec = interval_in_ms * 1000000;
ts.it_value.tv_sec = ts.it_interval.tv_sec = 0;
- ts.it_value.tv_nsec = ts.it_interval.tv_nsec = interval_in_ms*1000*1000;
+ ts.it_value.tv_nsec = ts.it_interval.tv_nsec = nsec;
+
/* add the timer */
ret |= timer_create(CLOCK_REALTIME, &sigev, &timerid);
ret |= timer_settime(timerid, 0, &ts, NULL);
@@ -95,7 +99,27 @@
panicf("%s(): %s\n", __func__, strerror(errno));
}
+JNIEXPORT void JNICALL
+Java_org_rockbox_RockboxService_tickpause(JNIEnv*env, jobject this)
+{
+ (void)env;
+ (void)this;
+ const struct itimerspec newtimer = { {0, 0}, {0, 0} };
+ if (timerid)
+ timer_settime(timerid, 0, &newtimer, NULL);
+}
+JNIEXPORT void JNICALL
+Java_org_rockbox_RockboxService_tickresume(JNIEnv*env, jobject this)
+{
+ (void)env;
+ (void)this;
+ const struct itimerspec newtimer = { {0, nsec}, {0, 0} };
+
+ if (timerid)
+ timer_settime(timerid, 0, &newtimer, NULL);
+}
+
bool timer_register(int reg_prio, void (*unregister_callback)(void),
long cycles, void (*timer_callback)(void))
{
Index: firmware/drivers/lcd-bitmap-common.c
===================================================================
--- firmware/drivers/lcd-bitmap-common.c (revision 30742)
+++ firmware/drivers/lcd-bitmap-common.c (working copy)
@@ -42,8 +42,8 @@
#if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR)
/* Fill a rectangle with a gradient */
-static void lcd_gradient_rect(int x1, int x2, int y, unsigned h,
- int num_lines, int cur_line)
+static void LCDFN(gradient_rect)(int x1, int x2, int y, unsigned h,
+ int num_lines, int cur_line)
{
int old_pattern = current_vp->fg_pattern;
int step_mul;
@@ -71,7 +71,7 @@
for(count = 0; count < h; count++) {
current_vp->fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16);
- lcd_hline(x1, x2, y + count);
+ LCDFN(hline)(x1, x2, y + count);
h_r -= rstep;
h_g -= gstep;
h_b -= bstep;
@@ -206,8 +206,8 @@
#if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR)
if (pf->depth)
- lcd_alpha_bitmap_part(bits, ofs, 0, width, x + base_ofs, y,
- width - ofs, pf->height);
+ LCDFN(alpha_bitmap_part)(bits, ofs, 0, width, x + base_ofs, y,
+ width - ofs, pf->height);
else
#endif
LCDFN(mono_bitmap_part)(bits, ofs, 0, width, x + base_ofs,
@@ -273,23 +273,23 @@
current_vp->drawmode ^= DRMODE_INVERSEVID;
if (style & STYLE_GRADIENT) {
current_vp->drawmode = DRMODE_FG;
- lcd_gradient_rect(xpos, current_vp->width, ypos, h,
- NUMLN_UNPACK(style), CURLN_UNPACK(style));
+ LCDFN(gradient_rect)(xpos, current_vp->width, ypos, h,
+ NUMLN_UNPACK(style), CURLN_UNPACK(style));
current_vp->fg_pattern = current_vp->lst_pattern;
}
else if (style & STYLE_COLORBAR) {
current_vp->drawmode = DRMODE_FG;
current_vp->fg_pattern = current_vp->lss_pattern;
- lcd_fillrect(xpos, ypos, current_vp->width - xpos, h);
+ LCDFN(fillrect)(xpos, ypos, current_vp->width - xpos, h);
current_vp->fg_pattern = current_vp->lst_pattern;
}
else {
- lcd_fillrect(x, ypos, current_vp->width - xrect, h);
+ LCDFN(fillrect)(x, ypos, current_vp->width - xrect, h);
current_vp->drawmode = (style & STYLE_INVERT) ?
(DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
}
if (str[0])
- lcd_putsxyofs(xpos, ypos, offset, str);
+ LCDFN(putsxyofs)(xpos, ypos, offset, str);
current_vp->fg_pattern = oldfgcolor;
current_vp->bg_pattern = oldbgcolor;
#else
@@ -305,30 +305,27 @@
/*** Line oriented text output ***/
-/* put a string at a given char position */
-void LCDFN(puts_style_xyoffset)(int x, int y, const unsigned char *str,
- int style, int x_offset, int y_offset)
+/* put a string at a given pixel position */
+void LCDFN(putsxy_style_xyoffset)(int x, int y, const unsigned char *str,
+ int style, int x_offset, int y_offset)
{
int xpos, ypos, w, h;
- LCDFN(scroll_stop_line)(current_vp, y);
+ LCDFN(getstringsize)(" ", NULL, &h);
+ lcd_scroll_stop_line(current_vp, y/h);
if(!str)
return;
LCDFN(getstringsize)(str, &w, &h);
- xpos = x * LCDFN(getstringsize)(" ", NULL, NULL);
- ypos = y * h + y_offset;
+ xpos = x;
+ ypos = y + y_offset;
LCDFN(putsxyofs_style)(xpos, ypos, str, style, w, h, x_offset);
}
-void LCDFN(puts_style_offset)(int x, int y, const unsigned char *str,
- int style, int x_offset)
-{
- LCDFN(puts_style_xyoffset)(x, y, str, style, x_offset, 0);
-}
-
void LCDFN(puts)(int x, int y, const unsigned char *str)
{
- LCDFN(puts_style_offset)(x, y, str, STYLE_DEFAULT, 0);
+ int w, h;
+ LCDFN(getstringsize)(" ", &w, &h);
+ LCDFN(putsxyofs)(x*w, y*h, 0, str);
}
/* Formatting version of LCDFN(puts) */
@@ -344,18 +341,16 @@
void LCDFN(puts_style)(int x, int y, const unsigned char *str, int style)
{
- LCDFN(puts_style_offset)(x, y, str, style, 0);
+ int w, h;
+ LCDFN(getstringsize)(" ", &w, &h);
+ LCDFN(putsxy_style_xyoffset)(x*w, y*h, str, style, 0, 0);
}
-void LCDFN(puts_offset)(int x, int y, const unsigned char *str, int offset)
-{
- LCDFN(puts_style_offset)(x, y, str, STYLE_DEFAULT, offset);
-}
-
/*** scrolling ***/
-void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string,
- int style, int x_offset, int y_offset)
+void LCDFN(puts_scroll_style_xyoffset)(int x, int y,
+ const unsigned char *string,
+ int style, int x_offset, int y_offset)
{
struct scrollinfo* s;
char *end;
@@ -366,12 +361,13 @@
return;
/* remove any previously scrolling line at the same location */
- LCDFN(scroll_stop_line)(current_vp, y);
+ LCDFN(getstringsize)(" ", NULL, &h);
+ lcd_scroll_stop_line(current_vp, y/h);
- if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) return;
+ if (lcd_scroll_info.lines >= LCDM(SCROLLABLE_LINES)) return;
if (!string)
return;
- LCDFN(puts_style_xyoffset)(x, y, string, style, x_offset, y_offset);
+ LCDFN(putsxy_style_xyoffset)(x, y, string, style, x_offset, y_offset);
LCDFN(getstringsize)(string, &w, &h);
@@ -379,8 +375,8 @@
return;
/* prepare scroll line */
- s = &LCDFN(scroll_info).scroll[LCDFN(scroll_info).lines];
- s->start_tick = current_tick + LCDFN(scroll_info).delay;
+ s = &lcd_scroll_info.scroll[lcd_scroll_info.lines];
+ s->start_tick = current_tick + lcd_scroll_info.delay;
s->style = style;
strlcpy(s->line, string, sizeof s->line);
@@ -390,9 +386,9 @@
/* scroll bidirectional or forward only depending on the string
width */
- if ( LCDFN(scroll_info).bidir_limit ) {
+ if ( lcd_scroll_info.bidir_limit ) {
s->bidir = s->width < (current_vp->width) *
- (100 + LCDFN(scroll_info).bidir_limit) / 100;
+ (100 + lcd_scroll_info.bidir_limit) / 100;
}
else
s->bidir = false;
@@ -410,11 +406,11 @@
s->vp = current_vp;
s->y = y;
s->offset = x_offset;
- s->startx = x * LCDFN(getstringsize)(" ", NULL, NULL);
+ s->startx = x;
s->y_offset = y_offset;
s->backward = false;
- LCDFN(scroll_info).lines++;
+ lcd_scroll_info.lines++;
}
void LCDFN(puts_scroll)(int x, int y, const unsigned char *string)
@@ -425,15 +421,9 @@
void LCDFN(puts_scroll_style)(int x, int y, const unsigned char *string,
int style)
{
- LCDFN(puts_scroll_style_offset)(x, y, string, style, 0);
+ LCDFN(puts_scroll_style_xyoffset)(x, y, string, style, 0, 0);
}
-void LCDFN(puts_scroll_offset)(int x, int y, const unsigned char *string,
- int offset)
-{
- LCDFN(puts_scroll_style_offset)(x, y, string, STYLE_DEFAULT, offset);
-}
-
void LCDFN(scroll_fn)(void)
{
struct font* pf;
@@ -443,8 +433,8 @@
struct viewport* old_vp = current_vp;
bool makedelay;
- for ( index = 0; index < LCDFN(scroll_info).lines; index++ ) {
- s = &LCDFN(scroll_info).scroll[index];
+ for ( index = 0; index < lcd_scroll_info.lines; index++ ) {
+ s = &lcd_scroll_info.scroll[index];
/* check pause */
if (TIME_BEFORE(current_tick, s->start_tick))
@@ -453,9 +443,9 @@
LCDFN(set_viewport)(s->vp);
if (s->backward)
- s->offset -= LCDFN(scroll_info).step;
+ s->offset -= lcd_scroll_info.step;
else
- s->offset += LCDFN(scroll_info).step;
+ s->offset += lcd_scroll_info.step;
pf = font_get(current_vp->font);
xpos = s->startx;
@@ -485,8 +475,8 @@
}
if (makedelay)
- s->start_tick = current_tick + LCDFN(scroll_info).delay +
- LCDFN(scroll_info).ticks;
+ s->start_tick = current_tick + lcd_scroll_info.delay +
+ lcd_scroll_info.ticks;
LCDFN(putsxyofs_style)(xpos, ypos, s->line, s->style, s->width,
pf->height, s->offset);
@@ -495,9 +485,3 @@
}
LCDFN(set_viewport)(old_vp);
}
-
-void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
- int style, int x_offset)
-{
- LCDFN(puts_scroll_style_xyoffset)(x, y, string, style, x_offset, 0);
-}
Index: firmware/drivers/lcd-16bit-common.c
===================================================================
--- firmware/drivers/lcd-16bit-common.c (revision 30742)
+++ firmware/drivers/lcd-16bit-common.c (working copy)
@@ -42,9 +42,9 @@
/* Draw a partial monochrome bitmap */
-void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
- int src_y, int stride, int x, int y,
- int width, int height)
+void ICODE_ATTR LCDFN(mono_bitmap_part)(const unsigned char *src, int src_x,
+ int src_y, int stride, int x, int y,
+ int width, int height)
{
const unsigned char *src_end;
fb_data *dst, *dst_col;
@@ -224,7 +224,8 @@
while (src < src_end);
}
/* Draw a full monochrome bitmap */
-void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int height)
+void LCDFN(mono_bitmap)(const unsigned char *src, int x, int y,
+ int width, int height)
{
lcd_mono_bitmap_part(src, 0, 0, width, x, y, width, height);
}
@@ -285,9 +286,9 @@
return blend_two_colors(c, current_vp->fg_pattern, a);
}
-void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
- int src_y, int stride, int x, int y,
- int width, int height)
+void ICODE_ATTR LCDFN(alpha_bitmap_part)(const unsigned char *src, int src_x,
+ int src_y, int stride, int x, int y,
+ int width, int height)
{
fb_data *dst, *dst_row;
unsigned dmask = 0x00000000;
Index: firmware/drivers/lcd-16bit.c
===================================================================
--- firmware/drivers/lcd-16bit.c (revision 30742)
+++ firmware/drivers/lcd-16bit.c (working copy)
@@ -1,10 +1,4 @@
/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2005 by Dave Chapman
@@ -39,6 +33,22 @@
#include "bidi.h"
#include "scroll_engine.h"
+#ifdef LCD_RELATIVE
+
+int lcd_xres = 480;
+int lcd_yres = 800;
+
+#define XPOS(xpos) (xpos * lcd_xres / 480)
+#define YPOS(ypos) (ypos * lcd_yres / 800)
+
+#define LCDFN(fn) lcd_abs_ ## fn
+
+#else /* not LCD_RELATIVE */
+
+#define LCDFN(fn) lcd_ ## fn
+
+#endif /* LCD_RELATIVE */
+
enum fill_opt {
OPT_NONE = 0,
OPT_SET,
@@ -81,7 +91,7 @@
}
/*** Viewports ***/
-void lcd_set_viewport(struct viewport* vp)
+void LCDFN(set_viewport)(struct viewport* vp)
{
if (vp == NULL)
current_vp = &default_vp;
@@ -117,7 +127,7 @@
current_vp->width, current_vp->height);
}
-void lcd_update_viewport_rect(int x, int y, int width, int height)
+void LCDFN(update_viewport_rect)(int x, int y, int width, int height)
{
lcd_update_rect(current_vp->x + x, current_vp->y + y, width, height);
}
@@ -196,7 +206,7 @@
return current_vp->font;
}
-int lcd_getstringsize(const unsigned char *str, int *w, int *h)
+int LCDFN(getstringsize)(const unsigned char *str, int *w, int *h)
{
return font_getstringsize(str, w, h, current_vp->font);
}
@@ -327,7 +337,7 @@
}
/* Set a single pixel */
-void lcd_drawpixel(int x, int y)
+void LCDFN(drawpixel)(int x, int y)
{
if ( ((unsigned)x < (unsigned)current_vp->width)
&& ((unsigned)y < (unsigned)current_vp->height)
@@ -340,7 +350,7 @@
}
/* Draw a line */
-void lcd_drawline(int x1, int y1, int x2, int y2)
+void LCDFN(drawline)(int x1, int y1, int x2, int y2)
{
int numpixels;
int i;
@@ -429,7 +439,7 @@
}
/* Draw a horizontal line (optimised) */
-void lcd_hline(int x1, int x2, int y)
+void LCDFN(hline)(int x1, int x2, int y)
{
int x, width;
unsigned bits = 0;
@@ -525,7 +535,7 @@
}
/* Draw a vertical line (optimised) */
-void lcd_vline(int x, int y1, int y2)
+void LCDFN(vline)(int x, int y1, int y2)
{
int y;
fb_data *dst, *dst_end;
@@ -582,7 +592,7 @@
}
/* Draw a rectangular box */
-void lcd_drawrect(int x, int y, int width, int height)
+void LCDFN(drawrect)(int x, int y, int width, int height)
{
if ((width <= 0) || (height <= 0))
return;
@@ -597,7 +607,7 @@
}
/* Fill a rectangular area */
-void lcd_fillrect(int x, int y, int width, int height)
+void LCDFN(fillrect)(int x, int y, int width, int height)
{
unsigned bits = 0;
enum fill_opt fillopt = OPT_NONE;
@@ -709,9 +719,9 @@
}
/* Draw a partial native bitmap */
-void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
- int stride, int x, int y, int width,
- int height)
+void ICODE_ATTR LCDFN(bitmap_part)(const fb_data *src, int src_x, int src_y,
+ int stride, int x, int y, int width,
+ int height)
{
fb_data *dst;
@@ -782,15 +792,15 @@
}
/* Draw a full native bitmap */
-void lcd_bitmap(const fb_data *src, int x, int y, int width, int height)
+void LCDFN(bitmap)(const fb_data *src, int x, int y, int width, int height)
{
lcd_bitmap_part(src, 0, 0, width, x, y, width, height);
}
/* Draw a partial native bitmap with transparency and foreground colors */
-void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
- int src_y, int stride, int x,
- int y, int width, int height)
+void ICODE_ATTR LCDFN(bitmap_transparent_part)(const fb_data *src, int src_x,
+ int src_y, int stride, int x,
+ int y, int width, int height)
{
fb_data *dst;
unsigned fg = current_vp->fg_pattern;
@@ -907,8 +917,8 @@
}
/* Draw a full native bitmap with transparent and foreground colors */
-void lcd_bitmap_transparent(const fb_data *src, int x, int y,
- int width, int height)
+void LCDFN(bitmap_transparent)(const fb_data *src, int x, int y,
+ int width, int height)
{
lcd_bitmap_transparent_part(src, 0, 0, width, x, y, width, height);
}
@@ -918,5 +928,9 @@
#include "lcd-16bit-common.c"
+#ifdef LCD_RELATIVE
+#include "lcd-bitmap-relative.c"
+#else
#include "lcd-bitmap-common.c"
+#endif