From e63b279d967564b847f19dbd694dab9a577acfb1 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 25 Aug 2002 10:05:24 +0200 Subject: [PATCH] Added cPalette::AllColors() for plugins that need to get the color entries of a cPalette --- HISTORY | 2 ++ dvbosd.c | 4 ++-- osdbase.c | 10 ++++++++-- osdbase.h | 15 +++++++++++++-- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index 3d05a591..266a1c5d 100644 --- a/HISTORY +++ b/HISTORY @@ -1423,3 +1423,5 @@ Video Disk Recorder Revision History Zimmermann). - Added cDevice::NewOsd() to allow a derived cDevice class to implement its own OSD capabilities (thanks to Andreas Schultz). +- Added cPalette::AllColors() for plugins that need to get the color entries of + a cPalette (see osdbase.h). diff --git a/dvbosd.c b/dvbosd.c index ca5cf490..4b0c1ea8 100644 --- a/dvbosd.c +++ b/dvbosd.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbosd.c 1.18 2002/08/04 10:13:21 kls Exp $ + * $Id: dvbosd.c 1.19 2002/08/25 09:53:51 kls Exp $ */ #include "dvbosd.h" @@ -92,7 +92,7 @@ void cDvbOsd::CommitWindow(cWindow *Window) // commit colors: int FirstColor = 0, LastColor = 0; const eDvbColor *pal; - while ((pal = Window->Colors(FirstColor, LastColor)) != NULL) + while ((pal = Window->NewColors(FirstColor, LastColor)) != NULL) Cmd(OSD_SetPalette, FirstColor, LastColor, 0, 0, 0, pal); // commit modified data: Cmd(OSD_SetBlock, Window->Width(), x1, y1, x2, y2, Window->Data(x1, y1)); diff --git a/osdbase.c b/osdbase.c index 70e11bfa..e16b27b0 100644 --- a/osdbase.c +++ b/osdbase.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.c 1.6 2002/08/11 11:47:21 kls Exp $ + * $Id: osdbase.c 1.7 2002/08/25 10:02:36 kls Exp $ */ #include "osdbase.h" @@ -74,7 +74,7 @@ void cPalette::Reset(void) full = false; } -const eDvbColor *cPalette::Colors(int &FirstColor, int &LastColor) +const eDvbColor *cPalette::NewColors(int &FirstColor, int &LastColor) { for (FirstColor = 0; FirstColor < numColors; FirstColor++) { if (!fetched[FirstColor]) { @@ -87,6 +87,12 @@ const eDvbColor *cPalette::Colors(int &FirstColor, int &LastColor) return NULL; } +const eDvbColor *cPalette::AllColors(int &NumColors) +{ + NumColors = numColors; + return numColors ? color : NULL; +} + void cPalette::Take(const cPalette &Palette, tIndexes *Indexes) { for (int i = 0; i < Palette.numColors; i++) { diff --git a/osdbase.h b/osdbase.h index 1800482f..39221261 100644 --- a/osdbase.h +++ b/osdbase.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.h 1.4 2002/07/13 14:45:55 kls Exp $ + * $Id: osdbase.h 1.5 2002/08/25 10:01:00 kls Exp $ */ #ifndef __OSDBASE_H @@ -56,7 +56,18 @@ public: cPalette(int Bpp); int Index(eDvbColor Color); void Reset(void); - const eDvbColor *Colors(int &FirstColor, int &LastColor); + const eDvbColor *NewColors(int &FirstColor, int &LastColor); + // With every call this function returns a consecutive range of + // color entries that have been added since the last call. The + // return value is the address of the first new color, and the + // index of the first and last new color are returned in the given + // int parameters. If there are no new color entries, NULL will + // be returned. + const eDvbColor *AllColors(int &NumColors); + // Returns a pointer to the complete color table and stores the + // number of valid entries in NumColors. If no colors have been + // stored yet, NumColors will be set to 0 and the function will + // return NULL. void Take(const cPalette &Palette, tIndexes *Indexes = NULL); };