From bac9c655155d90c36f0111dbcda349e4a329d344 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 6 Apr 2018 08:51:16 +0200 Subject: [PATCH] Fixed scaling bitmaps with very small factors --- CONTRIBUTORS | 1 + HISTORY | 3 ++- osd.c | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 0aa8f74a..f1dfc088 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1203,6 +1203,7 @@ Rolf Ahrenberg for suggesting to change the naming of "binary skip mode" to "adaptive skip mode" for adding a Status parameter to the interface of cDevice::SignalStats() and cDvbDevice::SignalStats() + for reporting a possible crash when scaling bitmaps with very small factors Ralf Klueber for reporting a bug in cutting a recording if there is only a single editing mark diff --git a/HISTORY b/HISTORY index 372f5611..63d0277e 100644 --- a/HISTORY +++ b/HISTORY @@ -9317,7 +9317,7 @@ Video Disk Recorder Revision History - Modified cMenuTimers::Delete() to avoid a lengthy lock on the Timers list while prompting the user. -2018-04-05: Version 2.4.0 +2018-04-06: Version 2.4.0 - Updated the Ukrainian OSD texts (thanks to Yarema Aka Knedlyk). - Fixed processing SVDRP client responses in case the caller doesn't want the actual @@ -9338,3 +9338,4 @@ Video Disk Recorder Revision History - Fixed sluggish setting of editing marks and a jumping progress display with very short recordings (reported by Oliver Endriss). - Fixed updating the Schedule menu after editing a timer. +- Fixed scaling bitmaps with very small factors (reported by Rolf Ahrenberg). 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) {