summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY4
-rw-r--r--dvbsubtitle.c21
-rw-r--r--osd.c6
-rw-r--r--osd.h7
5 files changed, 29 insertions, 10 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 71d4df20..f6ba82c7 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1268,6 +1268,7 @@ Reinhard Nissl <rnissl@gmx.de>
for reporting a problem with horizontal scaling of subtitles
for fixing a buffer overflow in cFont::Bidi()
for avoiding an unecessary call to Recordings.ResetResume()
+ for debugging a problem in handling the bitmap color depth for scaled subtitles
Richard Robson <richard_robson@beeb.net>
for reporting freezing replay if a timer starts while in Transfer Mode from the
diff --git a/HISTORY b/HISTORY
index eaa914d1..c4e22fd8 100644
--- a/HISTORY
+++ b/HISTORY
@@ -6573,8 +6573,8 @@ Video Disk Recorder Revision History
- Fixed cUnbufferedFile::Seek() in case it is compiled without USE_FADVISE (thanks
to Juergen Lock).
- Fixed the Language header of the Serbian translation file (thanks to Ville Skyttä).
-- Added anti-aliasing when upscaling bitmaps (improves the display of SD subtitles
- when replayed on an HD OSD).
+- Added anti-aliasing when upscaling bitmaps, which improves the display of SD subtitles
+ when replayed on an HD OSD (thanks to Reinhard Nissl for his help in debugging).
- Renamed cBitmap::Scale() to Scaled(), because it doesn't modify the bitmap itself,
but rather returns a scaled copy.
- Fixed the description of cReceiver in PLUGINS.html, regarding detaching a receiver
diff --git a/dvbsubtitle.c b/dvbsubtitle.c
index a475e864..de1cd1c0 100644
--- a/dvbsubtitle.c
+++ b/dvbsubtitle.c
@@ -7,7 +7,7 @@
* Original author: Marco Schlüßler <marco@lordzodiac.de>
* With some input from the "subtitle plugin" by Pekka Virtanen <pekka.virtanen@sci.fi>
*
- * $Id: dvbsubtitle.c 2.16 2011/03/27 15:02:12 kls Exp $
+ * $Id: dvbsubtitle.c 2.17 2011/04/17 14:34:05 kls Exp $
*/
@@ -655,11 +655,26 @@ void cDvbSubtitleBitmaps::AddBitmap(cBitmap *Bitmap)
void cDvbSubtitleBitmaps::Draw(cOsd *Osd)
{
+ bool Scale = !(DoubleEqual(osdFactorX, 1.0) && DoubleEqual(osdFactorY, 1.0));
+ bool AntiAlias = true;
+ if (Scale && osdFactorX > 1.0 || osdFactorY > 1.0) {
+ // Upscaling requires 8bpp:
+ int Bpp[MAXOSDAREAS];
+ for (int i = 0; i < numAreas; i++) {
+ Bpp[i] = areas[i].bpp;
+ areas[i].bpp = 8;
+ }
+ if (Osd->CanHandleAreas(areas, numAreas) != oeOk) {
+ for (int i = 0; i < numAreas; i++)
+ Bpp[i] = areas[i].bpp = Bpp[i];
+ AntiAlias = false;
+ }
+ }
if (Osd->SetAreas(areas, numAreas) == oeOk) {
for (int i = 0; i < bitmaps.Size(); i++) {
cBitmap *b = bitmaps[i];
- if (!(DoubleEqual(osdFactorX, 1.0) && DoubleEqual(osdFactorY, 1.0)))
- b = b->Scaled(osdFactorX, osdFactorY);
+ if (Scale)
+ b = b->Scaled(osdFactorX, osdFactorY, AntiAlias);
Osd->DrawBitmap(int(round(b->X0() * osdFactorX)), int(round(b->Y0() * osdFactorY)), *b);
if (b != bitmaps[i])
delete b;
diff --git a/osd.c b/osd.c
index 083bdf41..d4e095a2 100644
--- a/osd.c
+++ b/osd.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.c 2.20 2011/03/27 11:52:12 kls Exp $
+ * $Id: osd.c 2.21 2011/04/17 14:25:07 kls Exp $
*/
#include "osd.h"
@@ -806,7 +806,7 @@ void cBitmap::ShrinkBpp(int NewBpp)
}
}
-cBitmap *cBitmap::Scaled(double FactorX, double FactorY)
+cBitmap *cBitmap::Scaled(double FactorX, double FactorY, bool AntiAlias)
{
// Fixed point scaling code based on www.inversereality.org/files/bitmapscaling.pdf
// by deltener@mindtremors.com
@@ -814,7 +814,7 @@ cBitmap *cBitmap::Scaled(double FactorX, double FactorY)
b->Replace(*this); // copy palette
int RatioX = (Width() << 16) / b->Width();
int RatioY = (Height() << 16) / b->Height();
- if (FactorX <= 1.0 && FactorY <= 1.0) {
+ if (!AntiAlias || FactorX <= 1.0 && FactorY <= 1.0) {
// Downscaling - no anti-aliasing:
tIndex *DestRow = b->bitmap;
int SourceY = 0;
diff --git a/osd.h b/osd.h
index 5196e2cf..b56853a3 100644
--- a/osd.h
+++ b/osd.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.h 2.12 2011/03/27 11:51:48 kls Exp $
+ * $Id: osd.h 2.13 2011/04/17 14:24:32 kls Exp $
*/
#ifndef __OSD_H
@@ -273,8 +273,11 @@ public:
///< the 2^NewBpp most frequently used colors as defined in the current palette.
///< If NewBpp is not smaller than the bitmap's current color depth,
///< or if it is not one of 4bpp or 2bpp, nothing happens.
- cBitmap *Scaled(double FactorX, double FactorY);
+ cBitmap *Scaled(double FactorX, double FactorY, bool AntiAlias = false);
///< Creates a copy of this bitmap, scaled by the given factors.
+ ///< If AntiAlias is true and either of the factors is greater than 1.0,
+ ///< anti-aliasing is applied. This will also set the color depth of the
+ ///< returned bitmap to 8bpp.
///< The caller must delete the returned bitmap once it is no longer used.
};