summaryrefslogtreecommitdiff
path: root/osd.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-02-22 17:15:31 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-02-22 17:15:31 +0100
commita3d37dfc7104393a859be58181ac2ecfe1d72f75 (patch)
tree2cd04225cca5828325126b888885309e01a938d2 /osd.c
parenta949b9c7d2bc14d2f6322764c88f4d11261680f1 (diff)
downloadvdr-a3d37dfc7104393a859be58181ac2ecfe1d72f75.tar.gz
vdr-a3d37dfc7104393a859be58181ac2ecfe1d72f75.tar.bz2
Fixed upscaling cBitmaps with anti-aliasing
Diffstat (limited to 'osd.c')
-rw-r--r--osd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/osd.c b/osd.c
index ab24e174..9c6ca8f0 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.23 2011/08/15 09:27:39 kls Exp $
+ * $Id: osd.c 2.24 2012/02/22 16:13:04 kls Exp $
*/
#include "osd.h"
@@ -812,11 +812,11 @@ cBitmap *cBitmap::Scaled(double FactorX, double FactorY, bool AntiAlias)
// 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());
- b->Replace(*this); // copy palette
int RatioX = (Width() << 16) / b->Width();
int RatioY = (Height() << 16) / b->Height();
if (!AntiAlias || FactorX <= 1.0 && FactorY <= 1.0) {
// Downscaling - no anti-aliasing:
+ b->Replace(*this); // copy palette
tIndex *DestRow = b->bitmap;
int SourceY = 0;
for (int y = 0; y < b->Height(); y++) {
@@ -834,6 +834,7 @@ cBitmap *cBitmap::Scaled(double FactorX, double FactorY, bool AntiAlias)
else {
// Upscaling - anti-aliasing:
b->SetBpp(8);
+ b->Replace(*this); // copy palette (must be done *after* SetBpp()!)
int SourceY = 0;
for (int y = 0; y < b->Height() - 1; y++) {
int SourceX = 0;