This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 11th, 2010  |  syntax: None  |  size: 10.79 KB  |  views: 74  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
  2. index 9475e5f..16b5cdc 100644
  3. --- a/apps/gui/skin_engine/skin_parser.c
  4. +++ b/apps/gui/skin_engine/skin_parser.c
  5. @@ -438,6 +438,7 @@ static int parse_viewportcolour(struct skin_element *element,
  6.          }
  7.          else
  8.          {
  9. +            curr_vp->vp.ignore_bg_image = true;
  10.              curr_vp->start_bgcolour = colour->colour;
  11.              curr_vp->vp.bg_pattern = colour->colour;
  12.          }
  13. diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
  14. index 45094e4..95b4e08 100644
  15. --- a/apps/gui/viewport.c
  16. +++ b/apps/gui/viewport.c
  17. @@ -332,7 +332,8 @@ void viewport_set_fullscreen(struct viewport *vp,
  18.  #endif
  19.      {
  20.          vp->fg_pattern = FG_FALLBACK;
  21. -        vp->bg_pattern = BG_FALLBACK;
  22. +        vp->bg_pattern = LCD_DARKGRAY;//BG_FALLBACK;
  23. +        vp->ignore_bg_image = false;
  24.  #ifdef HAVE_LCD_COLOR
  25.          vp->lss_pattern = global_settings.lss_color;
  26.          vp->lse_pattern = global_settings.lse_color;
  27. diff --git a/firmware/drivers/lcd-16bit-vert.c b/firmware/drivers/lcd-16bit-vert.c
  28. index a2f47d3..ada2f18 100644
  29. --- a/firmware/drivers/lcd-16bit-vert.c
  30. +++ b/firmware/drivers/lcd-16bit-vert.c
  31. @@ -61,6 +61,7 @@ static struct viewport default_vp =
  32.      .drawmode = DRMODE_SOLID,
  33.      .fg_pattern = LCD_DEFAULT_FG,
  34.      .bg_pattern = LCD_DEFAULT_BG,
  35. +    .ignore_bg_image = false,
  36.      .lss_pattern = LCD_DEFAULT_BG,
  37.      .lse_pattern = LCD_DEFAULT_BG,
  38.      .lst_pattern = LCD_DEFAULT_BG,
  39. @@ -206,6 +207,10 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
  40.  }
  41.  
  42.  /*** low-level drawing functions ***/
  43. +static inline bool lcd_using_backdrop(void)
  44. +{
  45. +    return !current_vp->ignore_bg_image;
  46. +}
  47.  
  48.  #define LCDADDR(x, y) (&lcd_framebuffer[0][0] + LCD_HEIGHT*(x) + (y))
  49.                                                      
  50. @@ -221,7 +226,10 @@ static void ICODE_ATTR clearpixel(fb_data *address)
  51.  
  52.  static void ICODE_ATTR clearimgpixel(fb_data *address)
  53.  {
  54. -    *address = *(fb_data *)((long)address + lcd_backdrop_offset);
  55. +    if (lcd_using_backdrop())
  56. +        *address = *(fb_data *)((long)address + lcd_backdrop_offset);
  57. +    else
  58. +        *address = current_vp->bg_pattern;
  59.  }
  60.  
  61.  static void ICODE_ATTR flippixel(fb_data *address)
  62. @@ -287,7 +295,7 @@ void lcd_clear_viewport(void)
  63.      }
  64.      else
  65.      {
  66. -        if (!lcd_backdrop)
  67. +        if (!lcd_backdrop || !lcd_using_backdrop())
  68.          {
  69.              do
  70.              {
  71. @@ -543,7 +551,7 @@ void lcd_vline(int x, int y1, int y2)
  72.      {
  73.          if (current_vp->drawmode & DRMODE_BG)
  74.          {
  75. -            if (!lcd_backdrop)
  76. +            if (!lcd_backdrop || !lcd_using_backdrop())
  77.              {
  78.                  fillopt = OPT_SET;
  79.                  bits = current_vp->bg_pattern;
  80. @@ -661,7 +669,7 @@ void lcd_fillrect(int x, int y, int width, int height)
  81.      {
  82.          if (current_vp->drawmode & DRMODE_BG)
  83.          {
  84. -            if (!lcd_backdrop)
  85. +            if (!lcd_backdrop || !lcd_using_backdrop())
  86.              {
  87.                  fillopt = OPT_SET;
  88.                  bits = current_vp->bg_pattern;
  89. @@ -831,7 +839,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
  90.              break;
  91.  
  92.            case DRMODE_BG:
  93. -            if (lcd_backdrop)
  94. +            if (lcd_backdrop && lcd_using_backdrop())
  95.              {
  96.                  bo = lcd_backdrop_offset;
  97.                  do
  98. @@ -874,7 +882,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
  99.  
  100.            case DRMODE_SOLID:
  101.              fg = current_vp->fg_pattern;
  102. -            if (lcd_backdrop)
  103. +            if (lcd_backdrop && lcd_using_backdrop())
  104.              {
  105.                  bo = lcd_backdrop_offset;
  106.                  do
  107. diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
  108. index be4f21f..656828f 100644
  109. --- a/firmware/drivers/lcd-16bit.c
  110. +++ b/firmware/drivers/lcd-16bit.c
  111. @@ -60,6 +60,7 @@ static struct viewport default_vp =
  112.      .drawmode = DRMODE_SOLID,
  113.      .fg_pattern = LCD_DEFAULT_FG,
  114.      .bg_pattern = LCD_DEFAULT_BG,
  115. +    .ignore_bg_image = false,
  116.      .lss_pattern = LCD_DEFAULT_BG,
  117.      .lse_pattern = LCD_DEFAULT_BG,
  118.      .lst_pattern = LCD_DEFAULT_BG,
  119. @@ -199,6 +200,10 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
  120.  }
  121.  
  122.  /*** low-level drawing functions ***/
  123. +static inline bool lcd_using_backdrop(void)
  124. +{
  125. +    return !current_vp->ignore_bg_image;
  126. +}
  127.  
  128.  #define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)])
  129.  
  130. @@ -214,7 +219,10 @@ static void ICODE_ATTR clearpixel(fb_data *address)
  131.  
  132.  static void ICODE_ATTR clearimgpixel(fb_data *address)
  133.  {
  134. -    *address = *(fb_data *)((long)address + lcd_backdrop_offset);
  135. +    if (lcd_using_backdrop())
  136. +        *address = *(fb_data *)((long)address + lcd_backdrop_offset);
  137. +    else
  138. +        *address = current_vp->bg_pattern;
  139.  }
  140.  
  141.  static void ICODE_ATTR flippixel(fb_data *address)
  142. @@ -280,7 +288,7 @@ void lcd_clear_viewport(void)
  143.      }
  144.      else
  145.      {
  146. -        if (!lcd_backdrop)
  147. +        if (!lcd_backdrop || !lcd_using_backdrop())
  148.          {
  149.              do
  150.              {
  151. @@ -479,7 +487,7 @@ void lcd_hline(int x1, int x2, int y)
  152.      {
  153.          if (current_vp->drawmode & DRMODE_BG)
  154.          {
  155. -            if (!lcd_backdrop)
  156. +            if (!lcd_backdrop || !lcd_using_backdrop())
  157.              {
  158.                  fillopt = OPT_SET;
  159.                  bits = current_vp->bg_pattern;
  160. @@ -654,7 +662,7 @@ void lcd_fillrect(int x, int y, int width, int height)
  161.      {
  162.          if (current_vp->drawmode & DRMODE_BG)
  163.          {
  164. -            if (!lcd_backdrop)
  165. +            if (!lcd_backdrop || !lcd_using_backdrop())
  166.              {
  167.                  fillopt = OPT_SET;
  168.                  bits = current_vp->bg_pattern;
  169. @@ -824,7 +832,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
  170.              break;
  171.  
  172.            case DRMODE_BG:
  173. -            if (lcd_backdrop)
  174. +            if (lcd_backdrop && lcd_using_backdrop())
  175.              {
  176.                  bo = lcd_backdrop_offset;
  177.                  do
  178. @@ -867,7 +875,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
  179.  
  180.            case DRMODE_SOLID:
  181.              fg = current_vp->fg_pattern;
  182. -            if (lcd_backdrop)
  183. +            if (lcd_backdrop && lcd_using_backdrop())
  184.              {
  185.                  bo = lcd_backdrop_offset;
  186.                  do
  187. diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c
  188. index b480509..0c71a64 100644
  189. --- a/firmware/drivers/lcd-2bit-horz.c
  190. +++ b/firmware/drivers/lcd-2bit-horz.c
  191. @@ -57,7 +57,8 @@ static struct viewport default_vp =
  192.      .font     = FONT_SYSFIXED,
  193.      .drawmode = DRMODE_SOLID,
  194.      .fg_pattern = LCD_DEFAULT_FG,
  195. -    .bg_pattern = LCD_DEFAULT_BG
  196. +    .bg_pattern = LCD_DEFAULT_BG,
  197. +    .ignore_bg_image = false
  198.  };
  199.  
  200.  static struct viewport* current_vp IBSS_ATTR;
  201. @@ -189,6 +190,10 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h)
  202.  }
  203.  
  204.  /*** low-level drawing functions ***/
  205. +static inline bool lcd_using_backdrop(void)
  206. +{
  207. +    return false;//!current_vp->ignore_bg_image;
  208. +}
  209.  
  210.  static void setpixel(int x, int y)
  211.  {
  212. @@ -213,8 +218,12 @@ static void clearimgpixel(int x, int y)
  213.      unsigned mask = pixmask[x & 3];
  214.      fb_data *address = &lcd_framebuffer[y][x>>2];
  215.      unsigned data = *address;
  216. +    unsigned pattern = *(address + lcd_backdrop_offset);
  217. +    
  218. +    if (!lcd_using_backdrop())
  219. +        pattern = bg_pattern;
  220.  
  221. -    *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask);
  222. +    *address = data ^ ((data ^ pattern) & mask);
  223.  }
  224.  
  225.  static void flippixel(int x, int y)
  226. @@ -263,8 +272,12 @@ static void ICODE_ATTR bgimgblock(fb_data *address, unsigned mask,
  227.                                    unsigned bits)
  228.  {
  229.      unsigned data = *address;
  230. +    unsigned pattern = *(address + lcd_backdrop_offset);
  231. +    
  232. +    if (!lcd_using_backdrop())
  233. +        pattern = bg_pattern;
  234.  
  235. -    *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits);
  236. +    *address = data ^ ((data ^ pattern) & mask & ~bits);
  237.  }
  238.  
  239.  static void ICODE_ATTR fgblock(fb_data *address, unsigned mask,
  240. @@ -290,6 +303,9 @@ static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask,
  241.  {
  242.      unsigned data = *address;
  243.      unsigned bgp  = *(address + lcd_backdrop_offset);
  244. +    
  245. +    if (!lcd_using_backdrop())
  246. +        bgp = bg_pattern;
  247.  
  248.      bits     = bgp  ^ ((bgp ^ fg_pattern) & bits);
  249.      *address = data ^ ((data ^ bits) & mask);
  250. @@ -313,8 +329,12 @@ static void ICODE_ATTR bgimginvblock(fb_data *address, unsigned mask,
  251.                                       unsigned bits)
  252.  {
  253.      unsigned data = *address;
  254. +    unsigned bgp  = *(address + lcd_backdrop_offset);
  255. +    
  256. +    if (!lcd_using_backdrop())
  257. +        bgp = bg_pattern;
  258.  
  259. -    *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits);
  260. +    *address = data ^ ((data ^ bgp) & mask & bits);
  261.  }
  262.  
  263.  static void ICODE_ATTR fginvblock(fb_data *address, unsigned mask,
  264. @@ -340,8 +360,12 @@ static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask,
  265.  {
  266.      unsigned data = *address;
  267.      unsigned fgp  = fg_pattern;
  268. +    unsigned bgp  = *(address + lcd_backdrop_offset);
  269. +    
  270. +    if (!lcd_using_backdrop())
  271. +        bgp = bg_pattern;
  272.  
  273. -    bits     = fgp  ^ ((fgp ^ *(address + lcd_backdrop_offset)) & bits);
  274. +    bits     = fgp  ^ ((fgp ^ bgp) & bits);
  275.      *address = data ^ ((data ^ bits) & mask);
  276.  }
  277.  
  278. @@ -400,7 +424,7 @@ void lcd_clear_display(void)
  279.      }
  280.      else
  281.      {
  282. -        if (lcd_backdrop)
  283. +        if (lcd_backdrop && lcd_using_backdrop())
  284.              memcpy(lcd_framebuffer, lcd_backdrop, sizeof lcd_framebuffer);
  285.          else
  286.              memset(lcd_framebuffer, bg_pattern, sizeof lcd_framebuffer);
  287. @@ -877,7 +901,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
  288.              break;
  289.              
  290.            case DRMODE_BG:
  291. -            if (lcd_backdrop)
  292. +            if (lcd_backdrop && lcd_using_backdrop())
  293.              {
  294.                  bo = lcd_backdrop_offset;
  295.                  do
  296. @@ -927,7 +951,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
  297.  
  298.            case DRMODE_SOLID:
  299.              fg = fg_pattern;
  300. -            if (lcd_backdrop)
  301. +            if (lcd_backdrop && lcd_using_backdrop())
  302.              {
  303.                  bo = lcd_backdrop_offset;
  304.                  do
  305. diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
  306. index 79231d1..a3ec33f 100644
  307. --- a/firmware/export/lcd.h
  308. +++ b/firmware/export/lcd.h
  309. @@ -48,6 +48,7 @@ struct viewport {
  310.  #if LCD_DEPTH > 1
  311.      unsigned fg_pattern;
  312.      unsigned bg_pattern;
  313. +    bool ignore_bg_image;
  314.  #ifdef HAVE_LCD_COLOR
  315.      unsigned lss_pattern;
  316.      unsigned lse_pattern;
clone this paste RAW Paste Data