cBitmap::DrawBitmap() now also resets the palette if the entire bitmap area is covered

This commit is contained in:
Klaus Schmidinger 2004-05-28 15:33:22 +02:00
parent 3c0dbfe19e
commit 887194ccc1
4 changed files with 24 additions and 8 deletions

View File

@ -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

View File

@ -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).

19
osd.c
View File

@ -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++)

9
osd.h
View File

@ -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).