summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2009-10-13 11:29:16 +0200
committerChristian Gmeiner <christian.gmeiner@gmail.com>2009-10-13 11:29:16 +0200
commit8435197ec3e9b338936186a40e78f5f2364bb9ee (patch)
treef57ce16813c7a0b1bee5020a038d2d975a149a82
parent524c3aeb6f60e3bab7f09936a75da5fa758fc830 (diff)
downloadvdr-plugin-dxr3-8435197ec3e9b338936186a40e78f5f2364bb9ee.tar.gz
vdr-plugin-dxr3-8435197ec3e9b338936186a40e78f5f2364bb9ee.tar.bz2
make use of scaler
-rw-r--r--dxr3osd.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/dxr3osd.c b/dxr3osd.c
index 10b4024..64a2460 100644
--- a/dxr3osd.c
+++ b/dxr3osd.c
@@ -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();
}