Fixed upscaling cBitmaps with anti-aliasing

This commit is contained in:
Klaus Schmidinger 2012-02-22 17:15:31 +01:00
parent a949b9c7d2
commit a3d37dfc71
3 changed files with 6 additions and 2 deletions

View File

@ -1133,6 +1133,7 @@ Rolf Ahrenberg <rahrenbe@cc.hut.fi>
for improving handling subtitles of BBC channels for improving handling subtitles of BBC channels
for fixing handling subtitle color palettes on channels where subtitles appear for fixing handling subtitle color palettes on channels where subtitles appear
"word by word" "word by word"
for reporting a problem with color palettes in subtitles
Ralf Klueber <ralf.klueber@vodafone.com> Ralf Klueber <ralf.klueber@vodafone.com>
for reporting a bug in cutting a recording if there is only a single editing mark for reporting a bug in cutting a recording if there is only a single editing mark

View File

@ -6906,3 +6906,5 @@ Video Disk Recorder Revision History
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Fixed handling subtitle color palettes on channels where subtitles appear - Fixed handling subtitle color palettes on channels where subtitles appear
"word by word" (thanks to Rolf Ahrenberg). "word by word" (thanks to Rolf Ahrenberg).
- Fixed upscaling cBitmaps with anti-aliasing (thanks to Rolf Ahrenberg for reporting
a problem with color palettes in subtitles).

5
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #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 // Fixed point scaling code based on www.inversereality.org/files/bitmapscaling.pdf
// by deltener@mindtremors.com // by deltener@mindtremors.com
cBitmap *b = new cBitmap(int(round(Width() * FactorX)), int(round(Height() * FactorY)), Bpp(), X0(), Y0()); 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 RatioX = (Width() << 16) / b->Width();
int RatioY = (Height() << 16) / b->Height(); int RatioY = (Height() << 16) / b->Height();
if (!AntiAlias || FactorX <= 1.0 && FactorY <= 1.0) { if (!AntiAlias || FactorX <= 1.0 && FactorY <= 1.0) {
// Downscaling - no anti-aliasing: // Downscaling - no anti-aliasing:
b->Replace(*this); // copy palette
tIndex *DestRow = b->bitmap; tIndex *DestRow = b->bitmap;
int SourceY = 0; int SourceY = 0;
for (int y = 0; y < b->Height(); y++) { for (int y = 0; y < b->Height(); y++) {
@ -834,6 +834,7 @@ cBitmap *cBitmap::Scaled(double FactorX, double FactorY, bool AntiAlias)
else { else {
// Upscaling - anti-aliasing: // Upscaling - anti-aliasing:
b->SetBpp(8); b->SetBpp(8);
b->Replace(*this); // copy palette (must be done *after* SetBpp()!)
int SourceY = 0; int SourceY = 0;
for (int y = 0; y < b->Height() - 1; y++) { for (int y = 0; y < b->Height() - 1; y++) {
int SourceX = 0; int SourceX = 0;