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 /PLUGINS | |
parent | a429eefbe723a992edff8a9d60502fa62f01b71e (diff) | |
download | vdr-735fb20ac6bba137423eabf8eb49ec59dc207d84.tar.gz vdr-735fb20ac6bba137423eabf8eb49ec59dc207d84.tar.bz2 |
Added cOsd::MaxPixmapSize()
Diffstat (limited to 'PLUGINS')
-rw-r--r-- | PLUGINS/src/osddemo/HISTORY | 4 | ||||
-rw-r--r-- | PLUGINS/src/osddemo/osddemo.c | 18 |
2 files changed, 15 insertions, 7 deletions
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; |