Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

DVD: Fix dvd button background handling.

Refs #9860

Signed-off-by: Mark Kendall <mkendall@mythtv.org>
  • Loading branch information...
commit 005276f8c4cd11203bb1482cc01759793ac43f8d 1 parent 801aebf
martin authored Mark Kendall committed
Showing with 21 additions and 26 deletions.
  1. +21 −26 mythtv/libs/libmythtv/subtitlescreen.cpp
View
47 mythtv/libs/libmythtv/subtitlescreen.cpp
@@ -536,32 +536,13 @@ void SubtitleScreen::DisplayDVDButton(AVSubtitle* dvdButton, QRect &buttonPos)
QImage bg_image(hl_button->pict.data[0], w, h, w, QImage::Format_Indexed8);
uint32_t *bgpalette = (uint32_t *)(hl_button->pict.data[1]);
- bool blank = true;
- for (uint x = 0; (x < w) && bgpalette; x++)
- {
- for (uint y = 0; y < h; y++)
- {
- if (qAlpha(bgpalette[bg_image.pixelIndex(x, y)]) > 0)
- {
- blank = false;
- break;
- }
- }
- }
-
- if (!blank)
- {
- QVector<unsigned int> bg_palette;
- for (int i = 0; i < AVPALETTE_COUNT; i++)
- bg_palette.push_back(bgpalette[i]);
- bg_image.setColorTable(bg_palette);
- bg_image = bg_image.convertToFormat(QImage::Format_ARGB32);
- AddScaledImage(bg_image, rect);
- VERBOSE(VB_PLAYBACK, LOC + "Added DVD button background");
- }
+ QVector<unsigned int> bg_palette;
+ for (int i = 0; i < AVPALETTE_COUNT; i++)
+ bg_palette.push_back(bgpalette[i]);
+ bg_image.setColorTable(bg_palette);
// copy button region of background image
- QRect fg_rect(buttonPos.translated(-hl_button->x, -hl_button->y));
+ const QRect fg_rect(buttonPos.translated(-hl_button->x, -hl_button->y));
QImage fg_image = bg_image.copy(fg_rect);
QVector<unsigned int> fg_palette;
uint32_t *fgpalette = (uint32_t *)(dvdButton->rects[1]->pict.data[1]);
@@ -572,9 +553,23 @@ void SubtitleScreen::DisplayDVDButton(AVSubtitle* dvdButton, QRect &buttonPos)
fg_image.setColorTable(fg_palette);
}
- // scale highlight image to match OSD size, if required
+ bg_image = bg_image.convertToFormat(QImage::Format_ARGB32);
fg_image = fg_image.convertToFormat(QImage::Format_ARGB32);
- AddScaledImage(fg_image, buttonPos);
+
+ // set pixel of highlight area to highlight color
+ for (int x=fg_rect.x(); x < fg_rect.x()+fg_rect.width(); ++x)
+ {
+ if ((x < 0) || (x > hl_button->w))
+ continue;
+ for (int y=fg_rect.y(); y < fg_rect.y()+fg_rect.height(); ++y)
+ {
+ if ((y < 0) || (y > hl_button->h))
+ continue;
+ bg_image.setPixel(x, y, fg_image.pixel(x-fg_rect.x(),y-fg_rect.y()));
+ }
+ }
+
+ AddScaledImage(bg_image, rect);
}
void SubtitleScreen::DisplayCC608Subtitles(void)
Please sign in to comment.
Something went wrong with that request. Please try again.