SHARE
TWEET

Uncommitted relative-positioning work

a guest Feb 27th, 2012 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Index: android/src/org/rockbox/Helper/RunForegroundManager.java
  2. ===================================================================
  3. --- android/src/org/rockbox/Helper/RunForegroundManager.java    (revision 30742)
  4. +++ android/src/org/rockbox/Helper/RunForegroundManager.java    (working copy)
  5. @@ -69,6 +69,7 @@
  6.           * We use a layout id because it is a unique number.  
  7.           * We use it later to cancel.
  8.           */
  9. +        Logger.d("FGMan startForeground");
  10.          mNM.notify(R.string.notification, mNotification);
  11.          /*
  12.           * this call makes the service run as foreground, which
  13. @@ -83,6 +84,7 @@
  14.          /* Note to cancel BEFORE changing the
  15.           * foreground state, since we could be killed at that point.
  16.           */
  17. +        Logger.d("FGMan stopForeground");
  18.          mNM.cancel(R.string.notification);
  19.          api.stopForeground();
  20.          mWidgetUpdate = null;
  21. Index: android/src/org/rockbox/RockboxActivity.java
  22. ===================================================================
  23. --- android/src/org/rockbox/RockboxActivity.java        (revision 30742)
  24. +++ android/src/org/rockbox/RockboxActivity.java        (working copy)
  25. @@ -31,6 +31,7 @@
  26.  import android.view.Window;
  27.  import android.view.WindowManager;
  28.  import android.widget.Toast;
  29. +import android.util.Log;
  30.  
  31.  public class RockboxActivity extends Activity
  32.  {
  33. @@ -40,8 +41,10 @@
  34.      {
  35.          super.onCreate(savedInstanceState);
  36.          requestWindowFeature(Window.FEATURE_NO_TITLE);
  37. +/*
  38.          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
  39.                               WindowManager.LayoutParams.FLAG_FULLSCREEN);
  40. +*/
  41.          Intent intent = new Intent(this, RockboxService.class);
  42.          intent.setAction(Intent.ACTION_MAIN);
  43.          intent.putExtra("callback", new ResultReceiver(new Handler(getMainLooper())) {
  44. @@ -98,6 +101,8 @@
  45.  
  46.      public void onResume()
  47.      {
  48. +        LOG("onResume");
  49. +        setServiceActivity(true);
  50.          super.onResume();
  51.          setVisible(true);
  52.      }
  53. @@ -108,6 +113,7 @@
  54.      @Override
  55.      protected void onPause()
  56.      {
  57. +        LOG("onPause");
  58.          super.onPause();
  59.          /* this will cause the framebuffer's Surface to be destroyed, enabling
  60.           * us to disable drawing */
  61. @@ -117,6 +123,7 @@
  62.      @Override
  63.      protected void onStop()
  64.      {
  65. +        LOG("onStop");
  66.          super.onStop();
  67.          setServiceActivity(false);
  68.      }
  69. @@ -124,7 +131,13 @@
  70.      @Override
  71.      protected void onDestroy()
  72.      {
  73. +        LOG("onDestroy");
  74.          super.onDestroy();
  75.          setServiceActivity(false);
  76.      }
  77. +
  78. +    private void LOG(CharSequence text)
  79. +    {
  80. +        Log.d("RockboxActivity ", (String) text);
  81. +    }
  82.  }
  83. Index: android/src/org/rockbox/RockboxService.java
  84. ===================================================================
  85. --- android/src/org/rockbox/RockboxService.java (revision 30742)
  86. +++ android/src/org/rockbox/RockboxService.java (working copy)
  87. @@ -60,6 +60,10 @@
  88.      private MediaButtonReceiver mMediaButtonReceiver;
  89.      private ResultReceiver resultReceiver;
  90.  
  91. +    private boolean music_playing = false;
  92. +    private boolean app_open = false;
  93. +    private boolean paused = false;
  94. +
  95.      public static final int RESULT_INVOKING_MAIN = 0;
  96.      public static final int RESULT_LIB_LOAD_PROGRESS = 1;
  97.      public static final int RESULT_SERVICE_RUNNING = 3;
  98. @@ -90,9 +94,37 @@
  99.      {
  100.          return current_activity;
  101.      }
  102. +
  103. +    private native void tickpause();
  104. +    private native void tickresume();
  105. +
  106. +    private void check_sleep()
  107. +    {
  108. +        if (paused)
  109. +        {
  110. +            if (music_playing || app_open)
  111. +            {
  112. +                LOG("Tick resume");
  113. +//                tickresume();
  114. +                paused = false;
  115. +            }
  116. +        }
  117. +        else
  118. +        {
  119. +            if (!music_playing && !app_open)
  120. +            {
  121. +                LOG("Tick pause");
  122. +//                tickpause();
  123. +                paused = true;
  124. +            }
  125. +        }
  126. +    }
  127. +
  128.      public void set_activity(Activity a)
  129.      {
  130. +        app_open = (a != null);
  131.          current_activity = a;
  132. +        check_sleep();
  133.      }
  134.  
  135.      private void do_start(Intent intent)
  136. @@ -138,20 +170,22 @@
  137.  
  138.      private void LOG(CharSequence text)
  139.      {
  140. -        Log.d("Rockbox", (String) text);
  141. +        Log.d("RockboxService", (String) text);
  142.      }
  143.  
  144.      private void LOG(CharSequence text, Throwable tr)
  145.      {
  146. -        Log.d("Rockbox", (String) text, tr);
  147. +        Log.d("RockboxService", (String) text, tr);
  148.      }
  149.  
  150.      public void onStart(Intent intent, int startId) {
  151. +        LOG("onStartCommand");
  152.          do_start(intent);
  153.      }
  154.  
  155.      public int onStartCommand(Intent intent, int flags, int startId)
  156.      {
  157. +        LOG("onStartCommand");
  158.          /* if null, then the service was most likely restarted by android
  159.           * after getting killed for memory pressure earlier */
  160.          if (intent == null)
  161. @@ -324,12 +358,18 @@
  162.  
  163.      void startForeground()
  164.      {
  165. +        LOG("startForeground");
  166. +        music_playing = true;
  167. +        check_sleep();
  168.          fg_runner.startForeground();
  169.      }
  170.  
  171.      void stopForeground()
  172.      {
  173. +        LOG("stopForeground");
  174. +        music_playing = false;
  175.          fg_runner.stopForeground();
  176. +        check_sleep();
  177.      }
  178.  
  179.      @Override
  180. Index: apps/screen_access.c
  181. ===================================================================
  182. --- apps/screen_access.c        (revision 30742)
  183. +++ apps/screen_access.c        (working copy)
  184. @@ -186,10 +186,8 @@
  185.          .vline=&lcd_vline,
  186.          .hline=&lcd_hline,
  187.          .scroll_step=&lcd_scroll_step,
  188. -        .puts_style_offset=&lcd_puts_style_offset,
  189. -        .puts_style_xyoffset=&lcd_puts_style_xyoffset,
  190. +        .putsxy_style_xyoffset=&lcd_putsxy_style_xyoffset,
  191.          .puts_scroll_style=&lcd_puts_scroll_style,
  192. -        .puts_scroll_style_offset=&lcd_puts_scroll_style_offset,
  193.          .puts_scroll_style_xyoffset=&lcd_puts_scroll_style_xyoffset,
  194.  #endif /* HAVE_LCD_BITMAP */
  195.  
  196. @@ -205,9 +203,7 @@
  197.          .putsxy=&lcd_putsxy,
  198.          .puts=&lcd_puts,
  199.          .putsf=&lcd_putsf,
  200. -        .puts_offset=&lcd_puts_offset,
  201.          .puts_scroll=&lcd_puts_scroll,
  202. -        .puts_scroll_offset=&lcd_puts_scroll_offset,
  203.          .scroll_speed=&lcd_scroll_speed,
  204.          .scroll_delay=&lcd_scroll_delay,
  205.          .stop_scroll=&lcd_stop_scroll,
  206. @@ -279,10 +275,8 @@
  207.          .vline=&lcd_remote_vline,
  208.          .hline=&lcd_remote_hline,
  209.          .scroll_step=&lcd_remote_scroll_step,
  210. -        .puts_style_offset=&lcd_remote_puts_style_offset,
  211. -        .puts_style_xyoffset=&lcd_remote_puts_style_xyoffset,
  212. +        .putsxy_style_xyoffset=&lcd_remote_puts_style_xyoffset,
  213.          .puts_scroll_style=&lcd_remote_puts_scroll_style,
  214. -        .puts_scroll_style_offset=&lcd_remote_puts_scroll_style_offset,
  215.          .puts_scroll_style_xyoffset=&lcd_remote_puts_scroll_style_xyoffset,
  216.  #endif /* 1 */
  217.  
  218. @@ -296,9 +290,7 @@
  219.          .putsxy=&lcd_remote_putsxy,
  220.          .puts=&lcd_remote_puts,
  221.          .putsf=&lcd_remote_putsf,
  222. -        .puts_offset=&lcd_remote_puts_offset,
  223.          .puts_scroll=&lcd_remote_puts_scroll,
  224. -        .puts_scroll_offset=&lcd_remote_puts_scroll_offset,
  225.          .scroll_speed=&lcd_remote_scroll_speed,
  226.          .scroll_delay=&lcd_remote_scroll_delay,
  227.          .stop_scroll=&lcd_remote_stop_scroll,
  228. Index: apps/screen_access.h
  229. ===================================================================
  230. --- apps/screen_access.h        (revision 30742)
  231. +++ apps/screen_access.h        (working copy)
  232. @@ -78,14 +78,10 @@
  233.      int (*getfont)(void);
  234.  
  235.      void (*scroll_step)(int pixels);
  236. -    void (*puts_style_offset)(int x, int y, const unsigned char *str,
  237. -                              int style, int x_offset);
  238. -    void (*puts_style_xyoffset)(int x, int y, const unsigned char *str,
  239. -                                int style, int x_offset, int y_offset);
  240. +    void (*putsxy_style_xyoffset)(int x, int y, const unsigned char *str,
  241. +                                  int style, int x_offset, int y_offset);
  242.      void (*puts_scroll_style)(int x, int y, const unsigned char *string,
  243.                                   int style);
  244. -    void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
  245. -                                     int style, int x_offset);
  246.      void (*puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string,
  247.                                       int style, int x_offset, int y_offset);
  248.      void (*mono_bitmap)(const unsigned char *src,
  249. @@ -139,10 +135,7 @@
  250.      void (*putsxy)(int x, int y, const unsigned char *str);
  251.      void (*puts)(int x, int y, const unsigned char *str);
  252.      void (*putsf)(int x, int y, const unsigned char *str, ...);
  253. -    void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
  254.      void (*puts_scroll)(int x, int y, const unsigned char *string);
  255. -    void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
  256. -                                 int x_offset);
  257.      void (*scroll_speed)(int speed);
  258.      void (*scroll_delay)(int ms);
  259.      void (*stop_scroll)(void);
  260. Index: apps/gui/bitmap/list.c
  261. ===================================================================
  262. --- apps/gui/bitmap/list.c      (revision 30742)
  263. +++ apps/gui/bitmap/list.c      (working copy)
  264. @@ -312,7 +312,7 @@
  265.              if (item_offset> item_width - (list_text_vp->width - text_pos))
  266.              {
  267.                  /* don't scroll */
  268. -                display->puts_style_xyoffset(0, line, entry_name,
  269. +                display->putsxy_style_xyoffset(0, line*h, entry_name,
  270.                          style, item_offset, draw_offset);
  271.              }
  272.              else
  273. @@ -324,10 +324,10 @@
  274.          else
  275.          {
  276.              if (list->scroll_all)
  277. -                display->puts_scroll_style_xyoffset(0, line, entry_name,
  278. +                display->puts_scroll_style_xyoffset(0, line*h, entry_name,
  279.                          style, item_offset, draw_offset);
  280.              else
  281. -                display->puts_style_xyoffset(0, line, entry_name,
  282. +                display->putsxy_style_xyoffset(0, line, entry_name,
  283.                          style, item_offset, draw_offset);
  284.          }
  285.          /* do the icon */
  286. Index: apps/gui/skin_engine/skin_display.c
  287. ===================================================================
  288. --- apps/gui/skin_engine/skin_display.c (revision 30742)
  289. +++ apps/gui/skin_engine/skin_display.c (working copy)
  290. @@ -596,9 +596,10 @@
  291.      else
  292.      {
  293.  #ifdef HAVE_LCD_BITMAP
  294. +        int ypos = line * string_height;
  295.          /* clear the line first */
  296.          display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
  297. -        display->fillrect(left_xpos, line*string_height, display->getwidth(), string_height);
  298. +        display->fillrect(left_xpos, ypos, display->getwidth(), string_height);
  299.          display->set_drawmode(DRMODE_SOLID);
  300.  #endif
  301.  
  302. @@ -609,18 +610,18 @@
  303.          /* print aligned strings */
  304.          if (left_width != 0)
  305.          {
  306. -            display->puts_style_xyoffset(left_xpos/space_width, line,
  307. +            display->putsxy_style_xyoffset(left_xpos, ypos,
  308.                              (unsigned char *)format_align->left, style, 0, 0);
  309.  
  310.          }
  311.          if (center_width != 0)
  312.          {
  313. -            display->puts_style_xyoffset(center_xpos/space_width, line,
  314. +            display->putsxy_style_xyoffset(center_xpos, ypos,
  315.                              (unsigned char *)format_align->center, style, 0, 0);
  316.          }
  317.          if (right_width != 0)
  318.          {
  319. -            display->puts_style_xyoffset(right_xpos/space_width, line,
  320. +            display->putsxy_style_xyoffset(right_xpos, ypos,
  321.                              (unsigned char *)format_align->right, style, 0, 0);
  322.          }
  323.  #else
  324. Index: apps/debug_menu.c
  325. ===================================================================
  326. --- apps/debug_menu.c   (revision 30742)
  327. +++ apps/debug_menu.c   (working copy)
  328. @@ -2120,9 +2120,9 @@
  329.      };
  330.  static int menu_action_callback(int btn, struct gui_synclist *lists)
  331.  {
  332. -   int i;
  333.      if (btn == ACTION_STD_OK)
  334.      {
  335. +        int i;
  336.          FOR_NB_SCREENS(i)
  337.             viewportmanager_theme_enable(i, false, NULL);
  338.          menuitems[gui_synclist_get_sel_pos(lists)].function();
  339. Index: wps/cabbiev2.480x800x16.wps
  340. ===================================================================
  341. --- wps/cabbiev2.480x800x16.wps (revision 30742)
  342. +++ wps/cabbiev2.480x800x16.wps (working copy)
  343. @@ -52,15 +52,15 @@
  344.  %s%ac%?id<%id|%?d(1)<%d(1)|%(root%)>>
  345.  
  346.  # next track info - AA
  347. -%Vl(d,0,550,-,-,-)
  348. +%Vl(d,0,512,-,-,-)
  349.  %?C<%s%ac%Sx(Next:) %?Ia<%Ia|%?D(2)<%D(2)|%(root%)>> - %?It<%It|%Fn>|%s%ac%?Id<%Id|%?D(1)<%D(1)|%(root%)>>>
  350.  
  351.  # playtime
  352. -%V(20,660,440,36,-)
  353. +%V(20,622,440,36,-)
  354.  %pc%ac%?Sr<%pe %Sx(of) %pp|%pp %Sx(of) %pe>%ar%pr
  355.  
  356.  # progressbar and bottom icons
  357. -%V(0,600,-,-,-)
  358. +%V(0,562,-,-,-)
  359.  %pb(25,11,430,-,pb-480x800x16.bmp)
  360.  %T(25,0,430,50,progressbar)
  361.  
  362. @@ -95,7 +95,7 @@
  363.  #
  364.  # ff/rewind button
  365.  #
  366. -%V(0,720,150,75,-)
  367. +%V(0,682,150,75,-)
  368.  %xd(H)%xd(I)
  369.  %T(0,0,70,75,rwd, repeat)
  370.  %T(0,0,70,75,prev)
  371. Index: firmware/export/lcd.h
  372. ===================================================================
  373. --- firmware/export/lcd.h       (revision 30742)
  374. +++ firmware/export/lcd.h       (working copy)
  375. @@ -197,9 +197,6 @@
  376.  extern void lcd_puts(int x, int y, const unsigned char *string);
  377.  extern void lcd_putsf(int x, int y, const unsigned char *fmt, ...);
  378.  extern void lcd_puts_style(int x, int y, const unsigned char *string, int style);
  379. -extern void lcd_puts_offset(int x, int y, const unsigned char *str, int offset);
  380. -extern void lcd_puts_scroll_offset(int x, int y, const unsigned char *string,
  381. -                                  int offset);
  382.  extern void lcd_putc(int x, int y, unsigned long ucs);
  383.  extern void lcd_stop_scroll(void);
  384.  extern void lcd_bidir_scroll(int threshold);
  385. @@ -481,14 +478,10 @@
  386.  extern void lcd_setfont(int font);
  387.  extern int lcd_getfont(void);
  388.  
  389. -extern void lcd_puts_style_offset(int x, int y, const unsigned char *str,
  390. -                                  int style, int x_offset);
  391. -extern void lcd_puts_style_xyoffset(int x, int y, const unsigned char *str,
  392. +extern void lcd_putsxy_style_xyoffset(int x, int y, const unsigned char *str,
  393.                                    int style, int x_offset, int y_offset);
  394. -extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
  395. -                                  int style, int x_offset);
  396.  extern void lcd_puts_scroll_style_xyoffset(int x, int y, const unsigned char *string,
  397. -                                  int style, int x_offset, int y_offset);
  398. +                                           int style, int x_offset, int y_offset);
  399.  
  400.  /* low level drawing function pointer arrays */
  401.  #if LCD_DEPTH >= 8
  402. Index: firmware/export/config/android.h
  403. ===================================================================
  404. --- firmware/export/config/android.h    (revision 30742)
  405. +++ firmware/export/config/android.h    (working copy)
  406. @@ -50,6 +50,9 @@
  407.  #define LCD_DEPTH  16
  408.  #define LCD_PIXELFORMAT 565
  409.  
  410. +/* define this if you use relative (percent) screen coordinates */
  411. +#define LCD_RELATIVE
  412. +
  413.  #define HAVE_LCD_ENABLE
  414.  
  415.  /* define this to indicate your device's keypad */
  416. Index: firmware/export/config/sdlapp.h
  417. ===================================================================
  418. --- firmware/export/config/sdlapp.h     (revision 30742)
  419. +++ firmware/export/config/sdlapp.h     (working copy)
  420. @@ -50,6 +50,9 @@
  421.  #define LCD_DEPTH  16
  422.  #define LCD_PIXELFORMAT 565
  423.  
  424. +/* define this if you use relative (percent) screen coordinates */
  425. +#define LCD_RELATIVE
  426. +
  427.  /* define this to indicate your device's keypad */
  428.  #define HAVE_TOUCHSCREEN
  429.  #define HAVE_BUTTON_DATA
  430. Index: firmware/target/hosted/android/kernel-android.c
  431. ===================================================================
  432. --- firmware/target/hosted/android/kernel-android.c     (revision 30742)
  433. +++ firmware/target/hosted/android/kernel-android.c     (working copy)
  434. @@ -19,7 +19,7 @@
  435.   *
  436.   ****************************************************************************/
  437.  
  438. -
  439. +#include <jni.h>
  440.  #include <time.h>
  441.  #include <signal.h>
  442.  #include <errno.h>
  443. @@ -67,21 +67,25 @@
  444.   *
  445.   * Can be possibly be attached if it really needs to be. but let's
  446.   * keep this leightweight */
  447. +static timer_t timerid = 0;
  448. +static int nsec;
  449. +
  450.  void tick_start(unsigned int interval_in_ms)
  451.  {
  452.      int ret = 0;
  453. -    timer_t timerid;
  454.      struct itimerspec ts;
  455.      sigevent_t sigev;
  456.  
  457.      /* initializing in the declaration causes some weird warnings */
  458.      memset(&sigev, 0, sizeof(sigevent_t));
  459. -    sigev.sigev_notify = SIGEV_THREAD,
  460. -    sigev.sigev_notify_function = timer_signal,
  461. +    sigev.sigev_notify = SIGEV_THREAD;
  462. +    sigev.sigev_notify_function = timer_signal;
  463.  
  464. +    nsec = interval_in_ms * 1000000;
  465.      ts.it_value.tv_sec = ts.it_interval.tv_sec = 0;
  466. -    ts.it_value.tv_nsec = ts.it_interval.tv_nsec = interval_in_ms*1000*1000;
  467. +    ts.it_value.tv_nsec = ts.it_interval.tv_nsec = nsec;
  468.  
  469. +
  470.      /* add the timer */
  471.      ret |= timer_create(CLOCK_REALTIME, &sigev, &timerid);
  472.      ret |= timer_settime(timerid, 0, &ts, NULL);
  473. @@ -95,7 +99,27 @@
  474.          panicf("%s(): %s\n", __func__, strerror(errno));
  475.  }
  476.  
  477. +JNIEXPORT void JNICALL
  478. +Java_org_rockbox_RockboxService_tickpause(JNIEnv*env, jobject this)
  479. +{
  480. +    (void)env;
  481. +    (void)this;
  482. +    const struct itimerspec newtimer = { {0, 0}, {0, 0} };
  483. +    if (timerid)
  484. +        timer_settime(timerid, 0, &newtimer, NULL);
  485. +}
  486.  
  487. +JNIEXPORT void JNICALL
  488. +Java_org_rockbox_RockboxService_tickresume(JNIEnv*env, jobject this)
  489. +{
  490. +    (void)env;
  491. +    (void)this;
  492. +    const struct itimerspec newtimer = { {0, nsec}, {0, 0} };
  493. +
  494. +    if (timerid)
  495. +        timer_settime(timerid, 0, &newtimer, NULL);
  496. +}
  497. +
  498.  bool timer_register(int reg_prio, void (*unregister_callback)(void),
  499.                      long cycles, void (*timer_callback)(void))
  500.  {
  501. Index: firmware/drivers/lcd-bitmap-common.c
  502. ===================================================================
  503. --- firmware/drivers/lcd-bitmap-common.c        (revision 30742)
  504. +++ firmware/drivers/lcd-bitmap-common.c        (working copy)
  505. @@ -42,8 +42,8 @@
  506.  
  507.  #if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR)
  508.  /* Fill a rectangle with a gradient */
  509. -static void lcd_gradient_rect(int x1, int x2, int y, unsigned h,
  510. -                              int num_lines, int cur_line)
  511. +static void LCDFN(gradient_rect)(int x1, int x2, int y, unsigned h,
  512. +                                 int num_lines, int cur_line)
  513.  {
  514.      int old_pattern = current_vp->fg_pattern;
  515.      int step_mul;
  516. @@ -71,7 +71,7 @@
  517.  
  518.      for(count = 0; count < h; count++) {
  519.          current_vp->fg_pattern = LCD_RGBPACK(h_r >> 16, h_g >> 16, h_b >> 16);
  520. -        lcd_hline(x1, x2, y + count);
  521. +        LCDFN(hline)(x1, x2, y + count);
  522.          h_r -= rstep;
  523.          h_g -= gstep;
  524.          h_b -= bstep;
  525. @@ -206,8 +206,8 @@
  526.  
  527.  #if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR)
  528.          if (pf->depth)
  529. -            lcd_alpha_bitmap_part(bits, ofs, 0, width, x + base_ofs, y,
  530. -                                  width - ofs, pf->height);
  531. +            LCDFN(alpha_bitmap_part)(bits, ofs, 0, width, x + base_ofs, y,
  532. +                                     width - ofs, pf->height);
  533.          else
  534.  #endif
  535.              LCDFN(mono_bitmap_part)(bits, ofs, 0, width, x + base_ofs,
  536. @@ -273,23 +273,23 @@
  537.      current_vp->drawmode ^= DRMODE_INVERSEVID;
  538.      if (style & STYLE_GRADIENT) {
  539.          current_vp->drawmode = DRMODE_FG;
  540. -        lcd_gradient_rect(xpos, current_vp->width, ypos, h,
  541. -                          NUMLN_UNPACK(style), CURLN_UNPACK(style));
  542. +        LCDFN(gradient_rect)(xpos, current_vp->width, ypos, h,
  543. +                             NUMLN_UNPACK(style), CURLN_UNPACK(style));
  544.          current_vp->fg_pattern = current_vp->lst_pattern;
  545.      }
  546.      else if (style & STYLE_COLORBAR) {
  547.          current_vp->drawmode = DRMODE_FG;
  548.          current_vp->fg_pattern = current_vp->lss_pattern;
  549. -        lcd_fillrect(xpos, ypos, current_vp->width - xpos, h);
  550. +        LCDFN(fillrect)(xpos, ypos, current_vp->width - xpos, h);
  551.          current_vp->fg_pattern = current_vp->lst_pattern;
  552.      }
  553.      else {
  554. -        lcd_fillrect(x, ypos, current_vp->width - xrect, h);
  555. +        LCDFN(fillrect)(x, ypos, current_vp->width - xrect, h);
  556.          current_vp->drawmode = (style & STYLE_INVERT) ?
  557.          (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
  558.      }
  559.      if (str[0])
  560. -        lcd_putsxyofs(xpos, ypos, offset, str);
  561. +        LCDFN(putsxyofs)(xpos, ypos, offset, str);
  562.      current_vp->fg_pattern = oldfgcolor;
  563.      current_vp->bg_pattern = oldbgcolor;
  564.  #else
  565. @@ -305,30 +305,27 @@
  566.  
  567.  /*** Line oriented text output ***/
  568.  
  569. -/* put a string at a given char position */
  570. -void LCDFN(puts_style_xyoffset)(int x, int y, const unsigned char *str,
  571. -                              int style, int x_offset, int y_offset)
  572. +/* put a string at a given pixel position */
  573. +void LCDFN(putsxy_style_xyoffset)(int x, int y, const unsigned char *str,
  574. +                                  int style, int x_offset, int y_offset)
  575.  {
  576.      int xpos, ypos, w, h;
  577. -    LCDFN(scroll_stop_line)(current_vp, y);
  578. +    LCDFN(getstringsize)(" ", NULL, &h);
  579. +    lcd_scroll_stop_line(current_vp, y/h);
  580.      if(!str)
  581.          return;
  582.  
  583.      LCDFN(getstringsize)(str, &w, &h);
  584. -    xpos = x * LCDFN(getstringsize)(" ", NULL, NULL);
  585. -    ypos = y * h + y_offset;
  586. +    xpos = x;
  587. +    ypos = y + y_offset;
  588.      LCDFN(putsxyofs_style)(xpos, ypos, str, style, w, h, x_offset);
  589.  }
  590.  
  591. -void LCDFN(puts_style_offset)(int x, int y, const unsigned char *str,
  592. -                              int style, int x_offset)
  593. -{
  594. -    LCDFN(puts_style_xyoffset)(x, y, str, style, x_offset, 0);
  595. -}
  596. -
  597.  void LCDFN(puts)(int x, int y, const unsigned char *str)
  598.  {
  599. -    LCDFN(puts_style_offset)(x, y, str, STYLE_DEFAULT, 0);
  600. +    int w, h;
  601. +    LCDFN(getstringsize)(" ", &w, &h);
  602. +    LCDFN(putsxyofs)(x*w, y*h, 0, str);
  603.  }
  604.  
  605.  /* Formatting version of LCDFN(puts) */
  606. @@ -344,18 +341,16 @@
  607.  
  608.  void LCDFN(puts_style)(int x, int y, const unsigned char *str, int style)
  609.  {
  610. -    LCDFN(puts_style_offset)(x, y, str, style, 0);
  611. +    int w, h;
  612. +    LCDFN(getstringsize)(" ", &w, &h);
  613. +    LCDFN(putsxy_style_xyoffset)(x*w, y*h, str, style, 0, 0);
  614.  }
  615.  
  616. -void LCDFN(puts_offset)(int x, int y, const unsigned char *str, int offset)
  617. -{
  618. -    LCDFN(puts_style_offset)(x, y, str, STYLE_DEFAULT, offset);
  619. -}
  620. -
  621.  /*** scrolling ***/
  622.  
  623. -void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string,
  624. -                                     int style, int x_offset, int y_offset)
  625. +void LCDFN(puts_scroll_style_xyoffset)(int x, int y,
  626. +                                         const unsigned char *string,
  627. +                                         int style, int x_offset, int y_offset)
  628.  {
  629.      struct scrollinfo* s;
  630.      char *end;
  631. @@ -366,12 +361,13 @@
  632.          return;
  633.  
  634.      /* remove any previously scrolling line at the same location */
  635. -    LCDFN(scroll_stop_line)(current_vp, y);
  636. +    LCDFN(getstringsize)(" ", NULL, &h);
  637. +    lcd_scroll_stop_line(current_vp, y/h);
  638.  
  639. -    if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) return;
  640. +    if (lcd_scroll_info.lines >= LCDM(SCROLLABLE_LINES)) return;
  641.      if (!string)
  642.          return;
  643. -    LCDFN(puts_style_xyoffset)(x, y, string, style, x_offset, y_offset);
  644. +    LCDFN(putsxy_style_xyoffset)(x, y, string, style, x_offset, y_offset);
  645.  
  646.      LCDFN(getstringsize)(string, &w, &h);
  647.  
  648. @@ -379,8 +375,8 @@
  649.          return;
  650.  
  651.      /* prepare scroll line */
  652. -    s = &LCDFN(scroll_info).scroll[LCDFN(scroll_info).lines];
  653. -    s->start_tick = current_tick + LCDFN(scroll_info).delay;
  654. +    s = &lcd_scroll_info.scroll[lcd_scroll_info.lines];
  655. +    s->start_tick = current_tick + lcd_scroll_info.delay;
  656.      s->style = style;
  657.  
  658.      strlcpy(s->line, string, sizeof s->line);
  659. @@ -390,9 +386,9 @@
  660.  
  661.      /* scroll bidirectional or forward only depending on the string
  662.         width */
  663. -    if ( LCDFN(scroll_info).bidir_limit ) {
  664. +    if ( lcd_scroll_info.bidir_limit ) {
  665.          s->bidir = s->width < (current_vp->width) *
  666. -            (100 + LCDFN(scroll_info).bidir_limit) / 100;
  667. +            (100 + lcd_scroll_info.bidir_limit) / 100;
  668.      }
  669.      else
  670.          s->bidir = false;
  671. @@ -410,11 +406,11 @@
  672.      s->vp = current_vp;
  673.      s->y = y;
  674.      s->offset = x_offset;
  675. -    s->startx = x * LCDFN(getstringsize)(" ", NULL, NULL);
  676. +    s->startx = x;
  677.      s->y_offset = y_offset;
  678.      s->backward = false;
  679.  
  680. -    LCDFN(scroll_info).lines++;
  681. +    lcd_scroll_info.lines++;
  682.  }
  683.  
  684.  void LCDFN(puts_scroll)(int x, int y, const unsigned char *string)
  685. @@ -425,15 +421,9 @@
  686.  void LCDFN(puts_scroll_style)(int x, int y, const unsigned char *string,
  687.                                int style)
  688.  {
  689. -     LCDFN(puts_scroll_style_offset)(x, y, string, style, 0);
  690. +    LCDFN(puts_scroll_style_xyoffset)(x, y, string, style, 0, 0);
  691.  }
  692.  
  693. -void LCDFN(puts_scroll_offset)(int x, int y, const unsigned char *string,
  694. -                               int offset)
  695. -{
  696. -     LCDFN(puts_scroll_style_offset)(x, y, string, STYLE_DEFAULT, offset);
  697. -}
  698. -
  699.  void LCDFN(scroll_fn)(void)
  700.  {
  701.      struct font* pf;
  702. @@ -443,8 +433,8 @@
  703.      struct viewport* old_vp = current_vp;
  704.      bool makedelay;
  705.  
  706. -    for ( index = 0; index < LCDFN(scroll_info).lines; index++ ) {
  707. -        s = &LCDFN(scroll_info).scroll[index];
  708. +    for ( index = 0; index < lcd_scroll_info.lines; index++ ) {
  709. +        s = &lcd_scroll_info.scroll[index];
  710.  
  711.          /* check pause */
  712.          if (TIME_BEFORE(current_tick, s->start_tick))
  713. @@ -453,9 +443,9 @@
  714.          LCDFN(set_viewport)(s->vp);
  715.  
  716.          if (s->backward)
  717. -            s->offset -= LCDFN(scroll_info).step;
  718. +            s->offset -= lcd_scroll_info.step;
  719.          else
  720. -            s->offset += LCDFN(scroll_info).step;
  721. +            s->offset += lcd_scroll_info.step;
  722.  
  723.          pf = font_get(current_vp->font);
  724.          xpos = s->startx;
  725. @@ -485,8 +475,8 @@
  726.          }
  727.  
  728.          if (makedelay)
  729. -            s->start_tick = current_tick + LCDFN(scroll_info).delay +
  730. -                    LCDFN(scroll_info).ticks;
  731. +            s->start_tick = current_tick + lcd_scroll_info.delay +
  732. +                    lcd_scroll_info.ticks;
  733.  
  734.          LCDFN(putsxyofs_style)(xpos, ypos, s->line, s->style, s->width,
  735.                                 pf->height, s->offset);
  736. @@ -495,9 +485,3 @@
  737.      }
  738.      LCDFN(set_viewport)(old_vp);
  739.  }
  740. -
  741. -void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
  742. -                                     int style, int x_offset)
  743. -{
  744. -    LCDFN(puts_scroll_style_xyoffset)(x, y, string, style, x_offset, 0);
  745. -}
  746. Index: firmware/drivers/lcd-16bit-common.c
  747. ===================================================================
  748. --- firmware/drivers/lcd-16bit-common.c (revision 30742)
  749. +++ firmware/drivers/lcd-16bit-common.c (working copy)
  750. @@ -42,9 +42,9 @@
  751.  
  752.  /* Draw a partial monochrome bitmap */
  753.  
  754. -void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
  755. -                                     int src_y, int stride, int x, int y,
  756. -                                     int width, int height)
  757. +void ICODE_ATTR LCDFN(mono_bitmap_part)(const unsigned char *src, int src_x,
  758. +                                        int src_y, int stride, int x, int y,
  759. +                                        int width, int height)
  760.  {
  761.      const unsigned char *src_end;
  762.      fb_data *dst, *dst_col;
  763. @@ -224,7 +224,8 @@
  764.      while (src < src_end);
  765.  }
  766.  /* Draw a full monochrome bitmap */
  767. -void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int height)
  768. +void LCDFN(mono_bitmap)(const unsigned char *src, int x, int y,
  769. +                        int width, int height)
  770.  {
  771.      lcd_mono_bitmap_part(src, 0, 0, width, x, y, width, height);
  772.  }
  773. @@ -285,9 +286,9 @@
  774.      return blend_two_colors(c, current_vp->fg_pattern, a);
  775.  }
  776.  
  777. -void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
  778. -                                      int src_y, int stride, int x, int y,
  779. -                                      int width, int height)
  780. +void ICODE_ATTR LCDFN(alpha_bitmap_part)(const unsigned char *src, int src_x,
  781. +                                         int src_y, int stride, int x, int y,
  782. +                                         int width, int height)
  783.  {
  784.      fb_data *dst, *dst_row;
  785.      unsigned dmask = 0x00000000;
  786. Index: firmware/drivers/lcd-16bit.c
  787. ===================================================================
  788. --- firmware/drivers/lcd-16bit.c        (revision 30742)
  789. +++ firmware/drivers/lcd-16bit.c        (working copy)
  790. @@ -1,10 +1,4 @@
  791.  /***************************************************************************
  792. - *             __________               __   ___.
  793. - *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  794. - *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  795. - *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  796. - *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  797. - *                     \/            \/     \/    \/            \/
  798.   * $Id$
  799.   *
  800.   * Copyright (C) 2005 by Dave Chapman
  801. @@ -39,6 +33,22 @@
  802.  #include "bidi.h"
  803.  #include "scroll_engine.h"
  804.  
  805. +#ifdef LCD_RELATIVE
  806. +
  807. +int lcd_xres = 480;
  808. +int lcd_yres = 800;
  809. +
  810. +#define XPOS(xpos) (xpos * lcd_xres / 480)
  811. +#define YPOS(ypos) (ypos * lcd_yres / 800)
  812. +
  813. +#define LCDFN(fn) lcd_abs_ ## fn
  814. +
  815. +#else /* not LCD_RELATIVE */
  816. +
  817. +#define LCDFN(fn) lcd_ ## fn
  818. +
  819. +#endif /* LCD_RELATIVE */
  820. +
  821.  enum fill_opt {
  822.      OPT_NONE = 0,
  823.      OPT_SET,
  824. @@ -81,7 +91,7 @@
  825.  }
  826.  /*** Viewports ***/
  827.  
  828. -void lcd_set_viewport(struct viewport* vp)
  829. +void LCDFN(set_viewport)(struct viewport* vp)
  830.  {
  831.      if (vp == NULL)
  832.          current_vp = &default_vp;
  833. @@ -117,7 +127,7 @@
  834.                      current_vp->width, current_vp->height);
  835.  }
  836.  
  837. -void lcd_update_viewport_rect(int x, int y, int width, int height)
  838. +void LCDFN(update_viewport_rect)(int x, int y, int width, int height)
  839.  {
  840.      lcd_update_rect(current_vp->x + x, current_vp->y + y, width, height);
  841.  }
  842. @@ -196,7 +206,7 @@
  843.      return current_vp->font;
  844.  }
  845.  
  846. -int lcd_getstringsize(const unsigned char *str, int *w, int *h)
  847. +int LCDFN(getstringsize)(const unsigned char *str, int *w, int *h)
  848.  {
  849.      return font_getstringsize(str, w, h, current_vp->font);
  850.  }
  851. @@ -327,7 +337,7 @@
  852.  }
  853.  
  854.  /* Set a single pixel */
  855. -void lcd_drawpixel(int x, int y)
  856. +void LCDFN(drawpixel)(int x, int y)
  857.  {
  858.      if (   ((unsigned)x < (unsigned)current_vp->width)
  859.          && ((unsigned)y < (unsigned)current_vp->height)
  860. @@ -340,7 +350,7 @@
  861.  }
  862.  
  863.  /* Draw a line */
  864. -void lcd_drawline(int x1, int y1, int x2, int y2)
  865. +void LCDFN(drawline)(int x1, int y1, int x2, int y2)
  866.  {
  867.      int numpixels;
  868.      int i;
  869. @@ -429,7 +439,7 @@
  870.  }
  871.  
  872.  /* Draw a horizontal line (optimised) */
  873. -void lcd_hline(int x1, int x2, int y)
  874. +void LCDFN(hline)(int x1, int x2, int y)
  875.  {
  876.      int x, width;
  877.      unsigned bits = 0;
  878. @@ -525,7 +535,7 @@
  879.  }
  880.  
  881.  /* Draw a vertical line (optimised) */
  882. -void lcd_vline(int x, int y1, int y2)
  883. +void LCDFN(vline)(int x, int y1, int y2)
  884.  {
  885.      int y;
  886.      fb_data *dst, *dst_end;
  887. @@ -582,7 +592,7 @@
  888.  }
  889.  
  890.  /* Draw a rectangular box */
  891. -void lcd_drawrect(int x, int y, int width, int height)
  892. +void LCDFN(drawrect)(int x, int y, int width, int height)
  893.  {
  894.      if ((width <= 0) || (height <= 0))
  895.          return;
  896. @@ -597,7 +607,7 @@
  897.  }
  898.  
  899.  /* Fill a rectangular area */
  900. -void lcd_fillrect(int x, int y, int width, int height)
  901. +void LCDFN(fillrect)(int x, int y, int width, int height)
  902.  {
  903.      unsigned bits = 0;
  904.      enum fill_opt fillopt = OPT_NONE;
  905. @@ -709,9 +719,9 @@
  906.  }
  907.  
  908.  /* Draw a partial native bitmap */
  909. -void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
  910. -                                int stride, int x, int y, int width,
  911. -                                int height)
  912. +void ICODE_ATTR LCDFN(bitmap_part)(const fb_data *src, int src_x, int src_y,
  913. +                                   int stride, int x, int y, int width,
  914. +                                   int height)
  915.  {
  916.      fb_data *dst;
  917.  
  918. @@ -782,15 +792,15 @@
  919.  }
  920.  
  921.  /* Draw a full native bitmap */
  922. -void lcd_bitmap(const fb_data *src, int x, int y, int width, int height)
  923. +void LCDFN(bitmap)(const fb_data *src, int x, int y, int width, int height)
  924.  {
  925.      lcd_bitmap_part(src, 0, 0, width, x, y, width, height);
  926.  }
  927.  
  928.  /* Draw a partial native bitmap with transparency and foreground colors */
  929. -void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
  930. -                                            int src_y, int stride, int x,
  931. -                                            int y, int width, int height)
  932. +void ICODE_ATTR LCDFN(bitmap_transparent_part)(const fb_data *src, int src_x,
  933. +                                               int src_y, int stride, int x,
  934. +                                               int y, int width, int height)
  935.  {
  936.      fb_data *dst;
  937.      unsigned fg = current_vp->fg_pattern;
  938. @@ -907,8 +917,8 @@
  939.  }
  940.  
  941.  /* Draw a full native bitmap with transparent and foreground colors */
  942. -void lcd_bitmap_transparent(const fb_data *src, int x, int y,
  943. -                            int width, int height)
  944. +void LCDFN(bitmap_transparent)(const fb_data *src, int x, int y,
  945. +                               int width, int height)
  946.  {
  947.      lcd_bitmap_transparent_part(src, 0, 0, width, x, y, width, height);
  948.  }
  949. @@ -918,5 +928,9 @@
  950.  
  951.  #include "lcd-16bit-common.c"
  952.  
  953. +#ifdef LCD_RELATIVE
  954. +#include "lcd-bitmap-relative.c"
  955. +#else
  956.  #include "lcd-bitmap-common.c"
  957. +#endif
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top