diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2015-03-08 16:40:01 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2015-03-08 16:40:01 +0100 |
commit | 735fb20ac6bba137423eabf8eb49ec59dc207d84 (patch) | |
tree | a3a452252e26773e59b0c0468cc8a87ff2853e45 | |
parent | a429eefbe723a992edff8a9d60502fa62f01b71e (diff) | |
download | vdr-735fb20ac6bba137423eabf8eb49ec59dc207d84.tar.gz vdr-735fb20ac6bba137423eabf8eb49ec59dc207d84.tar.bz2 |
Added cOsd::MaxPixmapSize()
-rw-r--r-- | HISTORY | 8 | ||||
-rw-r--r-- | PLUGINS/src/osddemo/HISTORY | 4 | ||||
-rw-r--r-- | PLUGINS/src/osddemo/osddemo.c | 18 | ||||
-rw-r--r-- | config.h | 10 | ||||
-rw-r--r-- | osd.c | 8 | ||||
-rw-r--r-- | osd.h | 5 |
6 files changed, 39 insertions, 14 deletions
@@ -8595,3 +8595,11 @@ Video Disk Recorder Revision History - Fixed leading/trailing/multiple blanks in the translation files. - Bumped all version numbers to 2.2.0. - Official release. + +2015-03-08: Version 2.3.1 + +- The new function cOsd::MaxPixmapSize() can be called to determine the maximum size + a cPixmap may have on the current OSD. The 'osddemo' example has been modified + accordingly. Plugin authors may want to use this function in case they use pixmaps + that are larger than the full OSD size. The default implementation sets this limit + to 2048x2048 pixel. diff --git a/PLUGINS/src/osddemo/HISTORY b/PLUGINS/src/osddemo/HISTORY index 40495b1c..e2f8d0b4 100644 --- a/PLUGINS/src/osddemo/HISTORY +++ b/PLUGINS/src/osddemo/HISTORY @@ -72,3 +72,7 @@ VDR Plugin 'osddemo' Revision History 2015-02-19: Version 2.2.0 - Official release. + +2015-03-08: Version 2.3.1 + +- Now using cOsd::MaxPixmapSize(). diff --git a/PLUGINS/src/osddemo/osddemo.c b/PLUGINS/src/osddemo/osddemo.c index 6273f460..b09606a7 100644 --- a/PLUGINS/src/osddemo/osddemo.c +++ b/PLUGINS/src/osddemo/osddemo.c @@ -3,13 +3,13 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: osddemo.c 3.4 2015/02/17 13:12:36 kls Exp $ + * $Id: osddemo.c 4.1 2015/03/08 16:40:01 kls Exp $ */ #include <vdr/osd.h> #include <vdr/plugin.h> -static const char *VERSION = "2.2.0"; +static const char *VERSION = "2.3.1"; static const char *DESCRIPTION = "Demo of arbitrary OSD setup"; static const char *MAINMENUENTRY = "Osd Demo"; @@ -427,16 +427,20 @@ void cTrueColorDemo::Action(void) const int Size = SmlFont->Width(Text) + 10; const int NumDots = 12; const int AnimFrames = NumDots; + int Rows = min(osd->MaxPixmapSize().Height() / Size, AnimFrames); + int Cols = (AnimFrames + Rows - 1) / Rows; // Temporarily using pixmap layer 0 to have the text alpha blended: - AnimPixmap = osd->CreatePixmap(0, cRect((osd->Width() - Size) / 2, StartLine, Size, Size), cRect(0, 0, Size, Size * AnimFrames)); + AnimPixmap = osd->CreatePixmap(0, cRect((osd->Width() - Size) / 2, StartLine, Size, Size), cRect(0, 0, Size * Cols, Size * Rows)); if (AnimPixmap) { AnimPixmap->SetAlpha(0); AnimPixmap->Clear(); const int Diameter = Size / 5; - int xc = Size / 2 - Diameter / 2; for (int Frame = 0; Frame < AnimFrames; Frame++) { - AnimPixmap->DrawEllipse(cRect(0, Frame * Size, Size, Size), 0xDDFFFFFF); - int yc = Frame * Size + Size / 2 - Diameter / 2; + int x0 = Frame / Rows * Size; + int y0 = Frame % Rows * Size; + AnimPixmap->DrawEllipse(cRect(x0, y0, Size, Size), 0xDDFFFFFF); + int xc = x0 + Size / 2 - Diameter / 2; + int yc = y0 + Size / 2 - Diameter / 2; int Color = 0xFF; int Delta = Color / NumDots / 3; for (int a = 0; a < NumDots; a++) { @@ -446,7 +450,7 @@ void cTrueColorDemo::Action(void) AnimPixmap->DrawEllipse(cRect(x, y, Diameter, Diameter), ArgbToColor(0xFF, Color, Color, Color)); Color -= Delta; } - AnimPixmap->DrawText(cPoint(0, Frame * Size), Text, clrBlack, clrTransparent, SmlFont, Size, Size, taCenter); + AnimPixmap->DrawText(cPoint(x0, y0), Text, clrBlack, clrTransparent, SmlFont, Size, Size, taCenter); } AnimPixmap->SetLayer(3); // now setting the actual pixmap layer FadeInPixmap = AnimPixmap; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 3.21 2015/02/17 13:11:00 kls Exp $ + * $Id: config.h 4.1 2015/02/21 14:59:27 kls Exp $ */ #ifndef __CONFIG_H @@ -22,13 +22,13 @@ // VDR's own version number: -#define VDRVERSION "2.2.0" -#define VDRVERSNUM 20200 // Version * 10000 + Major * 100 + Minor +#define VDRVERSION "2.3.1" +#define VDRVERSNUM 20301 // Version * 10000 + Major * 100 + Minor // The plugin API's version number: -#define APIVERSION "2.2.0" -#define APIVERSNUM 20200 // Version * 10000 + Major * 100 + Minor +#define APIVERSION "2.3.1" +#define APIVERSNUM 20301 // Version * 10000 + Major * 100 + Minor // When loading plugins, VDR searches them by their APIVERSION, which // may be smaller than VDRVERSION in case there have been no changes to @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.c 3.5 2015/02/11 09:48:02 kls Exp $ + * $Id: osd.c 4.1 2015/03/08 13:54:47 kls Exp $ */ #include "osd.h" @@ -1641,6 +1641,7 @@ int cOsd::osdLeft = 0; int cOsd::osdTop = 0; int cOsd::osdWidth = 0; int cOsd::osdHeight = 0; +cSize cOsd::maxPixmapSize(2048, 2048); cVector<cOsd *> cOsd::Osds; cMutex cOsd::mutex; @@ -1705,6 +1706,11 @@ cBitmap *cOsd::GetBitmap(int Area) return Area < numBitmaps ? (isTrueColor ? bitmaps[0] : bitmaps[Area]) : NULL; } +const cSize &cOsd::MaxPixmapSize(void) const +{ + return maxPixmapSize; +} + cPixmap *cOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort) { 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.6 2015/02/11 09:48:02 kls Exp $ + * $Id: osd.h 4.1 2015/03/08 13:54:09 kls Exp $ */ #ifndef __OSD_H @@ -722,6 +722,7 @@ class cOsd { private: static int osdLeft, osdTop, osdWidth, osdHeight; static cVector<cOsd *> Osds; + static cSize maxPixmapSize; static cMutex mutex; bool isTrueColor; cBitmap *savedBitmap; @@ -820,6 +821,8 @@ public: ///< in order to preset the bitmap's palette won't crash. ///< Use of this function outside of derived classes is deprecated and it ///< may be made 'protected' in a future version. + virtual const cSize &MaxPixmapSize(void) const; + ///< Returns the maximum possible size of a pixmap this OSD can create. virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null); ///< Creates a new true color pixmap on this OSD (see cPixmap for details). ///< The caller must not delete the returned object, it will be deleted when |