summaryrefslogtreecommitdiff
path: root/osd.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2018-04-06 08:51:16 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2018-04-06 08:51:16 +0200
commitbac9c655155d90c36f0111dbcda349e4a329d344 (patch)
treeb36372f603bb4097243b111e54e95c5e2ec99a8b /osd.c
parent5b9b09a90e6c4fcb7f1af59368d6255dc7a3b942 (diff)
downloadvdr-bac9c655155d90c36f0111dbcda349e4a329d344.tar.gz
vdr-bac9c655155d90c36f0111dbcda349e4a329d344.tar.bz2
Fixed scaling bitmaps with very small factors
Diffstat (limited to 'osd.c')
-rw-r--r--osd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/osd.c b/osd.c
index d29a2c41..2617c504 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 4.4 2018/01/25 15:09:09 kls Exp $
+ * $Id: osd.c 4.5 2018/04/06 08:43:15 kls Exp $
*/
#include "osd.h"
@@ -839,7 +839,9 @@ cBitmap *cBitmap::Scaled(double FactorX, double FactorY, bool AntiAlias) const
{
// Fixed point scaling code based on www.inversereality.org/files/bitmapscaling.pdf
// by deltener@mindtremors.com
- cBitmap *b = new cBitmap(int(round(Width() * FactorX)), int(round(Height() * FactorY)), Bpp(), X0(), Y0());
+ int w = max(1, int(round(Width() * FactorX)));
+ int h = max(1, int(round(Height() * FactorY)));
+ cBitmap *b = new cBitmap(w, h, Bpp(), X0(), Y0());
int RatioX = (Width() << 16) / b->Width();
int RatioY = (Height() << 16) / b->Height();
if (!AntiAlias || FactorX <= 1.0 && FactorY <= 1.0) {