@@ -536,32 +536,13 @@ void SubtitleScreen::DisplayDVDButton(AVSubtitle* dvdButton, QRect &buttonPos)
536
536
QImage bg_image (hl_button->pict .data [0 ], w, h, w, QImage::Format_Indexed8);
537
537
uint32_t *bgpalette = (uint32_t *)(hl_button->pict .data [1 ]);
538
538
539
- bool blank = true ;
540
- for (uint x = 0 ; (x < w) && bgpalette; x++)
541
- {
542
- for (uint y = 0 ; y < h; y++)
543
- {
544
- if (qAlpha (bgpalette[bg_image.pixelIndex (x, y)]) > 0 )
545
- {
546
- blank = false ;
547
- break ;
548
- }
549
- }
550
- }
551
-
552
- if (!blank)
553
- {
554
- QVector<unsigned int > bg_palette;
555
- for (int i = 0 ; i < AVPALETTE_COUNT; i++)
556
- bg_palette.push_back (bgpalette[i]);
557
- bg_image.setColorTable (bg_palette);
558
- bg_image = bg_image.convertToFormat (QImage::Format_ARGB32);
559
- AddScaledImage (bg_image, rect);
560
- VERBOSE (VB_PLAYBACK, LOC + " Added DVD button background" );
561
- }
539
+ QVector<unsigned int > bg_palette;
540
+ for (int i = 0 ; i < AVPALETTE_COUNT; i++)
541
+ bg_palette.push_back (bgpalette[i]);
542
+ bg_image.setColorTable (bg_palette);
562
543
563
544
// copy button region of background image
564
- QRect fg_rect (buttonPos.translated (-hl_button->x , -hl_button->y ));
545
+ const QRect fg_rect (buttonPos.translated (-hl_button->x , -hl_button->y ));
565
546
QImage fg_image = bg_image.copy (fg_rect);
566
547
QVector<unsigned int > fg_palette;
567
548
uint32_t *fgpalette = (uint32_t *)(dvdButton->rects [1 ]->pict .data [1 ]);
@@ -572,9 +553,23 @@ void SubtitleScreen::DisplayDVDButton(AVSubtitle* dvdButton, QRect &buttonPos)
572
553
fg_image.setColorTable (fg_palette);
573
554
}
574
555
575
- // scale highlight image to match OSD size, if required
556
+ bg_image = bg_image. convertToFormat (QImage::Format_ARGB32);
576
557
fg_image = fg_image.convertToFormat (QImage::Format_ARGB32);
577
- AddScaledImage (fg_image, buttonPos);
558
+
559
+ // set pixel of highlight area to highlight color
560
+ for (int x=fg_rect.x (); x < fg_rect.x ()+fg_rect.width (); ++x)
561
+ {
562
+ if ((x < 0 ) || (x > hl_button->w ))
563
+ continue ;
564
+ for (int y=fg_rect.y (); y < fg_rect.y ()+fg_rect.height (); ++y)
565
+ {
566
+ if ((y < 0 ) || (y > hl_button->h ))
567
+ continue ;
568
+ bg_image.setPixel (x, y, fg_image.pixel (x-fg_rect.x (),y-fg_rect.y ()));
569
+ }
570
+ }
571
+
572
+ AddScaledImage (bg_image, rect);
578
573
}
579
574
580
575
void SubtitleScreen::DisplayCC608Subtitles (void )
0 commit comments