summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2004-05-28 15:33:22 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2004-05-28 15:33:22 +0200
commit887194ccc11fe75188d61c1f24a79eb204053489 (patch)
tree482e675e2ec479b1219ee757323d6cdc60cc2af7
parent3c0dbfe19e06ca1f47a9940b23600dcb37daac07 (diff)
downloadvdr-887194ccc11fe75188d61c1f24a79eb204053489.tar.gz
vdr-887194ccc11fe75188d61c1f24a79eb204053489.tar.bz2
cBitmap::DrawBitmap() now also resets the palette if the entire bitmap area is covered
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY2
-rw-r--r--osd.c19
-rw-r--r--osd.h9
4 files changed, 24 insertions, 8 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 2f16b852..aeb5e0e9 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -708,6 +708,8 @@ Sascha Volkenandt <sascha@akv-soft.de>
for reporting a crash when switching the skin and having selected a non-default
theme that is not available for the newly selected skin
for suggesting to map the color name "None" to #00000000 when processing XPM data
+ for suggesting to also reset the palette in cBitmap::DrawBitmap() if the entire
+ bitmap area is covered
Malcolm Caldwell <malcolm.caldwell@ntu.edu.au>
for modifying LOF handling to allow for C-band reception
diff --git a/HISTORY b/HISTORY
index 0c220bfb..a4dbdefd 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2846,3 +2846,5 @@ Video Disk Recorder Revision History
in order to prevent a "hangup" in case, e.g., the LIRC driver is not loaded (thanks
to Helmut Auer).
- Updated 'channels.conf.terr' for Hannover (thanks to Peter Waechtler).
+- cBitmap::DrawBitmap() now also resets the palette if the entire bitmap area is
+ covered (suggested by Sascha Volkenandt).
diff --git a/osd.c b/osd.c
index 077cd9c1..a63d0e15 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 1.47 2004/05/22 13:47:39 kls Exp $
+ * $Id: osd.c 1.48 2004/05/28 15:33:22 kls Exp $
*/
#include "osd.h"
@@ -149,6 +149,15 @@ bool cBitmap::Contains(int x, int y) const
return 0 <= x && x < width && 0 <= y && y < height;
}
+bool cBitmap::Covers(int x1, int y1, int x2, int y2) const
+{
+ x1 -= x0;
+ y1 -= y0;
+ x2 -= x0;
+ y2 -= y0;
+ return x1 <= 0 && y1 <= 0 && x2 >= width - 1 && y2 >= height - 1;
+}
+
bool cBitmap::Intersects(int x1, int y1, int x2, int y2) const
{
x1 -= x0;
@@ -321,11 +330,11 @@ void cBitmap::DrawPixel(int x, int y, tColor Color)
void cBitmap::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg)
{
if (bitmap && Bitmap.bitmap && Intersects(x, y, x + Bitmap.Width() - 1, y + Bitmap.Height() - 1)) {
+ if (Covers(x, y, x + Bitmap.Width() - 1, y + Bitmap.Height() - 1))
+ Reset();
x -= x0;
y -= y0;
tIndexes Indexes;
- if (ColorFg || ColorBg) {
- }
Take(Bitmap, &Indexes, ColorFg, ColorBg);
for (int ix = 0; ix < Bitmap.width; ix++) {
for (int iy = 0; iy < Bitmap.height; iy++)
@@ -401,6 +410,8 @@ void cBitmap::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Color
void cBitmap::DrawRectangle(int x1, int y1, int x2, int y2, tColor Color)
{
if (bitmap && Intersects(x1, y1, x2, y2)) {
+ if (Covers(x1, y1, x2, y2))
+ Reset();
x1 -= x0;
y1 -= y0;
x2 -= x0;
@@ -409,8 +420,6 @@ void cBitmap::DrawRectangle(int x1, int y1, int x2, int y2, tColor Color)
y1 = max(y1, 0);
x2 = min(x2, width - 1);
y2 = min(y2, height - 1);
- if (x1 == 0 && y1 == 0 && x2 == width - 1 && y2 == height - 1)
- Reset();
tIndex c = Index(Color);
for (int y = y1; y <= y2; y++)
for (int x = x1; x <= x2; x++)
diff --git a/osd.h b/osd.h
index 2df875ed..c942acc0 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 1.41 2004/05/15 14:54:37 kls Exp $
+ * $Id: osd.h 1.42 2004/05/28 15:25:58 kls Exp $
*/
#ifndef __OSD_H
@@ -122,9 +122,12 @@ public:
///< unchanged.
bool Contains(int x, int y) const;
///< Returns true if this bitmap contains the point (x, y).
+ bool Covers(int x1, int y1, int x2, int y2) const;
+ ///< Returns true if the rectangle defined by the given coordinates
+ ///< completely covers this bitmap.
bool Intersects(int x1, int y1, int x2, int y2) const;
- ///< Returns true if this bitmap intersects with the rectangle
- ///< defined by the given coordinates.
+ ///< Returns true if the rectangle defined by the given coordinates
+ ///< intersects with this bitmap.
bool Dirty(int &x1, int &y1, int &x2, int &y2);
///< Tells whether there is a dirty area and returns the bounding
///< rectangle of that area (relative to the bitmaps origin).