Fixed scaling bitmaps with very small factors

This commit is contained in:
Klaus Schmidinger 2018-04-06 08:51:16 +02:00
parent 5b9b09a90e
commit bac9c65515
3 changed files with 7 additions and 3 deletions

View File

@ -1203,6 +1203,7 @@ Rolf Ahrenberg <Rolf.Ahrenberg@sci.fi>
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 <ralf.klueber@vodafone.com>
for reporting a bug in cutting a recording if there is only a single editing mark

View File

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

6
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 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) {