diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2015-01-04 15:53:47 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2015-01-04 15:53:47 +0100 |
commit | fc0094231d3f803869b8a03f449092b9464b2c21 (patch) | |
tree | 3c9acf86af44d5fcb2cb4eb515344b1d3e8d6363 | |
parent | aacdeba5d9591a8afc5f2e0e008a3b3b9dfc3bba (diff) | |
download | vdr-fc0094231d3f803869b8a03f449092b9464b2c21.tar.gz vdr-fc0094231d3f803869b8a03f449092b9464b2c21.tar.bz2 |
Added cOsd::DrawScaledBitmap()
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 3 | ||||
-rw-r--r-- | dvbsubtitle.c | 8 | ||||
-rw-r--r-- | osd.c | 12 | ||||
-rw-r--r-- | osd.h | 7 |
5 files changed, 23 insertions, 8 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 3368ca15..e6184a52 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3262,6 +3262,7 @@ Thomas Reufer <thomas@reufer.ch> for suggesting to add a note to ePlayMode in device.h that VDR itself always uses pmAudioVideo when replaying a recording for fixing a possible crash in the LCARS skin + for implementing cOsd::DrawScaledBitmap() Eike Sauer <EikeSauer@t-online.de> for reporting a problem with channels that need more than 5 TS packets for detecting @@ -8331,3 +8331,6 @@ Video Disk Recorder Revision History "Setup/DVB/Update channels" is set to a value other than "no" or "PIDs only". - Fixed multiple OBSOLETE marks in channels that are not listed in the SDT in case "Setup/Miscellaneous/Show channel names with source" is set to "yes". +- The new function cOsd::DrawScaledBitmap() is now used for drawing subtitles. + This function can be reimplemented by high level OSDs which may be able to do + the scaling in hardware or otherwise more efficiently (thanks to Thomas Reufer). diff --git a/dvbsubtitle.c b/dvbsubtitle.c index 88c594c2..92c2eb6c 100644 --- a/dvbsubtitle.c +++ b/dvbsubtitle.c @@ -7,7 +7,7 @@ * Original author: Marco Schluessler <marco@lordzodiac.de> * With some input from the "subtitles plugin" by Pekka Virtanen <pekka.virtanen@sci.fi> * - * $Id: dvbsubtitle.c 3.5 2014/02/08 12:29:13 kls Exp $ + * $Id: dvbsubtitle.c 3.6 2015/01/04 15:46:39 kls Exp $ */ #include "dvbsubtitle.h" @@ -1077,11 +1077,7 @@ void cDvbSubtitleBitmaps::Draw(cOsd *Osd) if (State() == 0 || Osd->SetAreas(areas, numAreas) == oeOk) { for (int i = 0; i < bitmaps.Size(); i++) { cBitmap *b = bitmaps[i]; - 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; + Osd->DrawScaledBitmap(int(round(b->X0() * osdFactorX)), int(round(b->Y0() * osdFactorY)), *b, osdFactorX, osdFactorY, AntiAlias); } Osd->Flush(); } @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.c 3.2 2013/09/03 11:59:17 kls Exp $ + * $Id: osd.c 3.3 2015/01/04 15:46:39 kls Exp $ */ #include "osd.h" @@ -1917,6 +1917,16 @@ void cOsd::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColo } } +void cOsd::DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY, bool AntiAlias) +{ + const cBitmap *b = &Bitmap; + if (!DoubleEqual(FactorX, 1.0) || !DoubleEqual(FactorY, 1.0)) + b = b->Scaled(FactorX, FactorY, AntiAlias); + DrawBitmap(x, y, *b); + if (b != &Bitmap) + delete b; +} + void cOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width, int Height, int Alignment) { if (isTrueColor) @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.h 3.2 2013/09/06 12:13:47 kls Exp $ + * $Id: osd.h 3.3 2015/01/04 15:51:03 kls Exp $ */ #ifndef __OSD_H @@ -885,6 +885,11 @@ public: ///< If Overlay is true, any pixel in Bitmap that has color index 0 will ///< not overwrite the corresponding pixel in the target area. ///< If this is a true color OSD, ReplacePalette has no meaning. + virtual void DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY, bool AntiAlias = false); + ///< Sets the pixels in the OSD with the data from the given Bitmap, putting + ///< the upper left corner of the Bitmap at (x, y) and scaled by the given + ///< factors. If AntiAlias is true and either of the factors is greater than + ///< 1.0, anti-aliasing is applied. virtual void DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width = 0, int Height = 0, int Alignment = taDefault); ///< Draws the given string at coordinates (x, y) with the given foreground ///< and background color and font. If Width and Height are given, the text |