summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManiac <maniac>2011-05-22 13:37:59 +0200
committerManiac <maniac>2011-05-22 13:37:59 +0200
commitcfb41df43e50ccf686dab645e79aef1b775d4b3f (patch)
tree82f78103c55fb6c133f6f7f54cf95d2320d4d4f9
parentd64c0ba3d1a790eea4dea48d645bfe06ca0beac0 (diff)
downloadvdr-plugin-skinpearlhd-cfb41df43e50ccf686dab645e79aef1b775d4b3f.tar.gz
vdr-plugin-skinpearlhd-cfb41df43e50ccf686dab645e79aef1b775d4b3f.tar.bz2
get cImage at correct size
-rw-r--r--bitmap.c38
-rw-r--r--bitmap.h8
-rw-r--r--pearlhd.c24
3 files changed, 39 insertions, 31 deletions
diff --git a/bitmap.c b/bitmap.c
index 029a909..c57fa11 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -63,7 +63,7 @@ bool cOSDImageBitmap::Load(cBitmap &bmp, const char *Filename, int width, int he
}
#if VDRVERSNUM > 10716
-bool cOSDImageBitmap::Load(cImage &bmp, const char *Filename, int width, int height)
+bool cOSDImageBitmap::Load(const char *Filename, int width, int height)
{
try
{
@@ -71,27 +71,11 @@ bool cOSDImageBitmap::Load(cImage &bmp, const char *Filename, int width, int hei
int start = cTimeMs::Now();
#endif
- int w, h;
- Image osdImage;
osdImage.read(Filename);
if (height != 0 || width != 0)
osdImage.sample( Geometry(width, height));
- w = osdImage.columns();
- h = osdImage.rows();
-
- const PixelPacket *pixels = osdImage.getConstPixels(0, 0, w, h);
- for (int iy = 0; iy < h; ++iy) {
- for (int ix = 0; ix < w; ++ix) {
- tColor col = (~int(pixels->opacity * 255 / MaxRGB) << 24)
- | (int(pixels->green * 255 / MaxRGB) << 8)
- | (int(pixels->red * 255 / MaxRGB) << 16)
- | (int(pixels->blue * 255 / MaxRGB) );
- bmp.SetPixel(cPoint(ix, iy), col);
- ++pixels;
- }
- }
#ifdef DEBUG_SKINPEARLHD
printf ("skinpearlhd: bitmap render took %d ms\n", int(cTimeMs::Now()-start));
#endif
@@ -102,4 +86,24 @@ bool cOSDImageBitmap::Load(cImage &bmp, const char *Filename, int width, int hei
return false;
}
}
+
+cImage cOSDImageBitmap::GetImage()
+{
+ int w, h;
+ w = osdImage.columns();
+ h = osdImage.rows();
+ cImage image (cSize(w, h));
+ const PixelPacket *pixels = osdImage.getConstPixels(0, 0, w, h);
+ for (int iy = 0; iy < h; ++iy) {
+ for (int ix = 0; ix < w; ++ix) {
+ tColor col = (~int(pixels->opacity * 255 / MaxRGB) << 24)
+ | (int(pixels->green * 255 / MaxRGB) << 8)
+ | (int(pixels->red * 255 / MaxRGB) << 16)
+ | (int(pixels->blue * 255 / MaxRGB) );
+ image.SetPixel(cPoint(ix, iy), col);
+ ++pixels;
+ }
+ }
+ return image;
+}
#endif
diff --git a/bitmap.h b/bitmap.h
index 7e2999b..be4e764 100644
--- a/bitmap.h
+++ b/bitmap.h
@@ -15,9 +15,11 @@ public:
~cOSDImageBitmap();
bool Load(cBitmap &bmp, const char *Filename, int width=0, int height=0, int bpp=0);
#if VDRVERSNUM > 10716
- bool Load(cImage &bmp, const char *Filename, int width, int height);
- #endif
-private:
+ bool Load(const char *Filename, int width, int height);
+ cImage GetImage();
+private:
+ Image osdImage;
+ #endif
};
#endif
diff --git a/pearlhd.c b/pearlhd.c
index 4c522ff..0890cfa 100644
--- a/pearlhd.c
+++ b/pearlhd.c
@@ -218,10 +218,11 @@ void cSkinPearlHDDisplayChannel::SetChannel(const cChannel *Channel, int Number)
#if VDRVERSNUM > 10716
if (bpp > 8)
{
- cImage logo (cSize(64, 48));
- osd->DestroyPixmap(logoPixmap);
- if(osdbitmap.Load(logo, displayLogoPath.c_str(), 64, 48)){
- logoPixmap = osd->CreatePixmap(0, cRect(x1ChannelInfo+120, y1ChannelInfo, 64, 48));
+ osd->DestroyPixmap(logoPixmap);
+ if(osdbitmap.Load(displayLogoPath.c_str(), 64, 48))
+ {
+ cImage logo = osdbitmap.GetImage();
+ logoPixmap = osd->CreatePixmap(0, cRect(x1ChannelInfo+120, y1ChannelInfo, logo.Width(), logo.Height()));
logoPixmap->DrawImage(cPoint(0, 0), logo);
}
}
@@ -239,10 +240,11 @@ void cSkinPearlHDDisplayChannel::SetChannel(const cChannel *Channel, int Number)
#if VDRVERSNUM > 10716
if (bpp > 8)
{
- cImage logo (cSize(120, 100));
- osd->DestroyPixmap(logoPixmap);
- if(osdbitmap.Load(logo, displayLogoPath.c_str(), 120, 100)){
- logoPixmap = osd->CreatePixmap(0, cRect(x2ChannelInfo-125, y2ChannelInfo-110, 120, 100));
+ osd->DestroyPixmap(logoPixmap);
+ if(osdbitmap.Load(displayLogoPath.c_str(), 120, 100))
+ {
+ cImage logo = osdbitmap.GetImage();
+ logoPixmap = osd->CreatePixmap(0, cRect(x2ChannelInfo-125, y2ChannelInfo-110, logo.Width(), logo.Height()));
logoPixmap->DrawImage(cPoint(0, 0), logo);
}
}
@@ -1021,9 +1023,9 @@ void cSkinPearlHDDisplayMenu::SetEvent(const cEvent *Event)
#if VDRVERSNUM > 10716
if (bpp > 8)
{
- cImage epgImg (cSize(300, 225));
- if(osdbitmap.Load(epgImg, epgPath.str().c_str(), 300, 225)){
- epgPixmap = osd->CreatePixmap(0, cRect(x2Menu-330, y2Menu-285, 300, 225));
+ if(osdbitmap.Load(epgPath.str().c_str(), 300, 225)){
+ cImage epgImg = osdbitmap.GetImage();
+ epgPixmap = osd->CreatePixmap(0, cRect(x2Menu-330, y2Menu-285, epgImg.Width(), epgImg.Height()));
epgPixmap->DrawImage(cPoint(0, 0), epgImg);
}
}