summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-03-02 10:51:46 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-03-02 10:51:46 +0100
commit1e3f6d6da29572426d5fd2fd922af9cc5219b285 (patch)
tree85a89f35bb78e82ed67eb481b18c2f79acf6b94b
parentc8808a854b58a6370baba41a8a0de97f1d4f73fd (diff)
downloadvdr-1e3f6d6da29572426d5fd2fd922af9cc5219b285.tar.gz
vdr-1e3f6d6da29572426d5fd2fd922af9cc5219b285.tar.bz2
Replaced min(max()) calls with the new function constrain()
-rw-r--r--HISTORY1
-rw-r--r--device.c4
-rw-r--r--dvbsubtitle.c8
-rw-r--r--font.c4
-rw-r--r--osd.c8
5 files changed, 13 insertions, 12 deletions
diff --git a/HISTORY b/HISTORY
index fbcc0760..75a790be 100644
--- a/HISTORY
+++ b/HISTORY
@@ -6946,3 +6946,4 @@ Video Disk Recorder Revision History
has been changed to IDLEPRIORITY.
- Added a Query parameter to cDevice::GetDevice(), so that devices can be queried
without side effects when zapping.
+- Replaced min(max()) calls with the new function constrain().
diff --git a/device.c b/device.c
index 9a0e4f6b..7a8c8c37 100644
--- a/device.c
+++ b/device.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: device.c 2.53 2012/03/02 10:33:35 kls Exp $
+ * $Id: device.c 2.54 2012/03/02 10:46:06 kls Exp $
*/
#include "device.h"
@@ -877,7 +877,7 @@ void cDevice::SetAudioChannel(int AudioChannel)
void cDevice::SetVolume(int Volume, bool Absolute)
{
int OldVolume = volume;
- volume = min(max(Absolute ? Volume : volume + Volume, 0), MAXVOLUME);
+ volume = constrain(Absolute ? Volume : volume + Volume, 0, MAXVOLUME);
SetVolumeDevice(volume);
Absolute |= mute;
cStatus::MsgSetVolume(Absolute ? volume : volume - OldVolume, Absolute);
diff --git a/dvbsubtitle.c b/dvbsubtitle.c
index 54029e28..300cd7c5 100644
--- a/dvbsubtitle.c
+++ b/dvbsubtitle.c
@@ -7,7 +7,7 @@
* Original author: Marco Schlüßler <marco@lordzodiac.de>
* With some input from the "subtitle plugin" by Pekka Virtanen <pekka.virtanen@sci.fi>
*
- * $Id: dvbsubtitle.c 2.26 2012/02/25 14:47:44 kls Exp $
+ * $Id: dvbsubtitle.c 2.27 2012/03/02 10:47:25 kls Exp $
*/
@@ -969,9 +969,9 @@ tColor cDvbSubtitleConverter::yuv2rgb(int Y, int Cb, int Cr)
Epb = (Cb - 128);
Epr = (Cr - 128);
/* ITU-R 709 */
- Er = max(min(((298 * Ey + 460 * Epr) / 256), 255), 0);
- Eg = max(min(((298 * Ey - 55 * Epb - 137 * Epr) / 256), 255), 0);
- Eb = max(min(((298 * Ey + 543 * Epb ) / 256), 255), 0);
+ Er = constrain((298 * Ey + 460 * Epr) / 256, 0, 255);
+ Eg = constrain((298 * Ey - 55 * Epb - 137 * Epr) / 256, 0, 255);
+ Eb = constrain((298 * Ey + 543 * Epb ) / 256, 0, 255);
return (Er << 16) | (Eg << 8) | Eb;
}
diff --git a/font.c b/font.c
index b3913451..706a017c 100644
--- a/font.c
+++ b/font.c
@@ -6,7 +6,7 @@
*
* BiDi support by Osama Alrawab <alrawab@hotmail.com> @2008 Tripoli-Libya.
*
- * $Id: font.c 2.9 2012/01/13 09:43:22 kls Exp $
+ * $Id: font.c 2.10 2012/03/02 10:47:45 kls Exp $
*/
#include "font.h"
@@ -396,7 +396,7 @@ cFont *cFont::fonts[eDvbFontSize] = { NULL };
void cFont::SetFont(eDvbFont Font, const char *Name, int CharHeight)
{
- cFont *f = CreateFont(Name, min(max(CharHeight, MINFONTSIZE), MAXFONTSIZE));
+ cFont *f = CreateFont(Name, constrain(CharHeight, MINFONTSIZE, MAXFONTSIZE));
if (!f || !f->Height())
f = new cDummyFont;
delete fonts[Font];
diff --git a/osd.c b/osd.c
index 9c6ca8f0..f9a76428 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 2.24 2012/02/22 16:13:04 kls Exp $
+ * $Id: osd.c 2.25 2012/03/02 10:48:19 kls Exp $
*/
#include "osd.h"
@@ -1008,7 +1008,7 @@ void cPixmap::SetLayer(int Layer)
void cPixmap::SetAlpha(int Alpha)
{
Lock();
- Alpha = min(max(Alpha, ALPHA_TRANSPARENT), ALPHA_OPAQUE);
+ Alpha = constrain(Alpha, ALPHA_TRANSPARENT, ALPHA_OPAQUE);
if (Alpha != alpha) {
MarkViewPortDirty(viewPort);
alpha = Alpha;
@@ -1648,8 +1648,8 @@ void cOsd::SetOsdPosition(int Left, int Top, int Width, int Height)
{
osdLeft = Left;
osdTop = Top;
- osdWidth = min(max(Width, MINOSDWIDTH), MAXOSDWIDTH);
- osdHeight = min(max(Height, MINOSDHEIGHT), MAXOSDHEIGHT);
+ osdWidth = constrain(Width, MINOSDWIDTH, MAXOSDWIDTH);
+ osdHeight = constrain(Height, MINOSDHEIGHT, MAXOSDHEIGHT);
}
void cOsd::SetAntiAliasGranularity(uint FixedColors, uint BlendColors)