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 Nov 30th, 2011  |  syntax: None  |  size: 4.70 KB  |  views: 23  |  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 53ceb7e..dc1611d 100644
  3. --- a/apps/gui/skin_engine/skin_parser.c
  4. +++ b/apps/gui/skin_engine/skin_parser.c
  5. @@ -1057,6 +1057,7 @@ static int parse_albumart_load(struct skin_element* element,
  6.      
  7.      aa->vp = PTRTOSKINOFFSET(skin_buffer, &curr_vp->vp);
  8.      aa->draw_handle = -1;
  9. +    aa->alpha_data_handle = -1;
  10.  
  11.      /* if we got here, we parsed everything ok .. ! */
  12.      if (aa->width < 0)
  13. @@ -1127,6 +1128,24 @@ static int parse_albumart_load(struct skin_element* element,
  14.      }
  15.      return 0;
  16.  }
  17. +static int parse_albumart_display(struct skin_element* element,
  18. +                               struct wps_token *token,
  19. +                               struct wps_data *wps_data)
  20. +{
  21. +    struct skin_albumart *aa = SKINOFFSETTOPTR(skin_buffer, wps_data->albumart);
  22. +    size_t alpha_size;
  23. +    if (!aa)
  24. +        return -1;
  25. +    alpha_size = aa->width * aa->height / 2;
  26. +    aa->alpha_data_handle = core_alloc("aa alpha", alpha_size);
  27. +    if (aa->alpha_data_handle >= 0)
  28. +    {
  29. +        int alpha_val = get_param(element, 0)->data.number * 16 / 100;
  30. +        alpha_val |= (alpha_val << 4);
  31. +        memset(core_get_data(aa->alpha_data_handle), alpha_val, alpha_size);
  32. +    }
  33. +    return 0;
  34. +}
  35.  
  36.  #endif /* HAVE_ALBUMART */
  37.  #ifdef HAVE_SKIN_VARIABLES
  38. @@ -2050,6 +2069,7 @@ static int skin_element_callback(struct skin_element* element, void* data)
  39.                      {
  40.                          struct skin_albumart *aa = SKINOFFSETTOPTR(skin_buffer, wps_data->albumart);
  41.                          aa->vp = PTRTOSKINOFFSET(skin_buffer, &curr_vp->vp);
  42. +                        function = parse_albumart_display;
  43.                      }
  44.                      break;
  45.                  case SKIN_TOKEN_ALBUMART_LOAD:
  46. diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
  47. index 60b9163..00d9d21 100644
  48. --- a/apps/gui/skin_engine/wps_internals.h
  49. +++ b/apps/gui/skin_engine/wps_internals.h
  50. @@ -251,6 +251,7 @@ struct skin_albumart {
  51.      
  52.      OFFSETTYPE(struct viewport *) vp;
  53.      int draw_handle;
  54. +    int alpha_data_handle;
  55.  };
  56.  #endif
  57.      
  58. diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c
  59. index 4cbabbc..4413763 100644
  60. --- a/apps/recorder/albumart.c
  61. +++ b/apps/recorder/albumart.c
  62. @@ -346,10 +346,17 @@ void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear)
  63.      if (!clear)
  64.      {
  65.          /* Draw the bitmap */
  66. -        gwps->display->bitmap_part((fb_data*)bmp->data, 0, 0,
  67. -                                    STRIDE(gwps->display->screen_type,
  68. -                                        bmp->width, bmp->height),
  69. -                                   x, y, width, height);
  70. +        if (aa->alpha_data_handle >= 0)
  71. +        {
  72. +            bmp->alpha_offset = core_get_data(aa->alpha_data_handle) - (void*)bmp->data;
  73. +            bmp->format |= FORMAT_TRANSPARENT;
  74. +        }
  75. +        gwps->display->bmp_part(bmp, 0, 0, x, y, width, height);
  76. +        if (aa->alpha_data_handle >= 0)
  77. +        {
  78. +            bmp->alpha_offset = 0;
  79. +            bmp->format &= ~FORMAT_TRANSPARENT;
  80. +        }
  81.  #ifdef HAVE_LCD_INVERT
  82.          if (global_settings.invert) {
  83.              gwps->display->set_drawmode(DRMODE_COMPLEMENT);
  84. diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c
  85. index 47f5968..ffe0d11 100644
  86. --- a/firmware/drivers/lcd-16bit-common.c
  87. +++ b/firmware/drivers/lcd-16bit-common.c
  88. @@ -575,7 +575,7 @@ void ICODE_ATTR lcd_bmp_part(const struct bitmap* bm, int src_x, int src_y,
  89.      int bitmap_stride = STRIDE_MAIN(bm->width, bm->height);
  90.      if (bm->format == FORMAT_MONO)
  91.          lcd_mono_bitmap_part(bm->data, src_x, src_y, bitmap_stride, x, y, width, height);
  92. -    else if (bm->alpha_offset > 0)
  93. +    else if (bm->alpha_offset != 0)
  94.          lcd_alpha_bitmap_part_mix((fb_data*)bm->data, bm->data+bm->alpha_offset,
  95.              src_x, src_y, x, y, width, height,
  96.              bitmap_stride, ALIGN_UP(bm->width, 2));
  97. diff --git a/lib/skin_parser/tag_table.c b/lib/skin_parser/tag_table.c
  98. index a5db475..648d02e 100644
  99. --- a/lib/skin_parser/tag_table.c
  100. +++ b/lib/skin_parser/tag_table.c
  101. @@ -180,7 +180,7 @@ static const struct tag_info legal_tags[] =
  102.      
  103.      { SKIN_TOKEN_LOAD_FONT,             "Fl" , "IF|I", 0|NOBREAK },
  104.      { SKIN_TOKEN_ALBUMART_LOAD,         "Cl" , "IIII|ss", 0|NOBREAK },
  105. -    { SKIN_TOKEN_ALBUMART_DISPLAY,      "Cd" , "", SKIN_REFRESH_STATIC },
  106. +    { SKIN_TOKEN_ALBUMART_DISPLAY,      "Cd" , "|I", SKIN_REFRESH_STATIC },
  107.      { SKIN_TOKEN_ALBUMART_FOUND,        "C" , "", SKIN_REFRESH_STATIC },
  108.      
  109.      { SKIN_TOKEN_VIEWPORT_ENABLE,       "Vd" , "S", SKIN_REFRESH_STATIC },
  110.  
  111.  
clone this paste RAW Paste Data