diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2009-10-13 11:29:16 +0200 |
---|---|---|
committer | Christian Gmeiner <christian.gmeiner@gmail.com> | 2009-10-13 11:29:16 +0200 |
commit | 8435197ec3e9b338936186a40e78f5f2364bb9ee (patch) | |
tree | f57ce16813c7a0b1bee5020a038d2d975a149a82 | |
parent | 524c3aeb6f60e3bab7f09936a75da5fa758fc830 (diff) | |
download | vdr-plugin-dxr3-8435197ec3e9b338936186a40e78f5f2364bb9ee.tar.gz vdr-plugin-dxr3-8435197ec3e9b338936186a40e78f5f2364bb9ee.tar.bz2 |
make use of scaler
-rw-r--r-- | dxr3osd.c | 30 |
1 files changed, 24 insertions, 6 deletions
@@ -233,19 +233,37 @@ void cDxr3Osd::Flush() uint32_t horizontal, vertical; cDxr3Interface::instance()->dimension(horizontal, vertical); + int top = Top(); + int left = Left(); + // check if we need to scale the osd if (horizontal < 720 || vertical < 576) { - // TODO - dsyslog("SCALE ME"); - } + // calculate ratio + float alpha = 720.f / bmap->Width(); + float beta = 576.f / bmap->Height(); - if (!bmap) - return; + // apply ration to get size of scaled bitmap + int width = horizontal / alpha; + int height = vertical / beta; + + // calculate ratio for top/left + alpha = 720.f / left; + beta = 576.f / top; + + // apply ration to top/left + left = horizontal / alpha; + top = vertical / beta; + + cBitmap *scaled = cScaler::scaleBitmap(bmap, width, height); + scaled->Replace(*Palette); + + bmap = scaled; + } // encode bitmap if (bmap->Dirty(x1, y1, x2, y2)) { - cSpuEncoder::instance()->encode(bmap, Top(), Left()); + cSpuEncoder::instance()->encode(bmap, top, left); shown = true; bmap->Clean(); } |