#include "mtd.h"
#include "videoomx.h"
#include "surface.h"
-//#include <Magick++.h>
#include "message.h"
#include "command.h"
#include <math.h>
#include <bcm_host.h>
-//using namespace Magick;
+#define EXTERNAL_PICTS \
+ EXTERNALPICTURE(vdrlogo, vdrhires, jpg) \
+ EXTERNALPICTURE(wallpaper, wallpaper720p, jpg)
-extern uint8_t vdr_data[] asm("_binary_other_vdrhires_jpg_start");
-extern uint8_t vdr_data_end[] asm("_binary_other_vdrhires_jpg_end");
-extern uint8_t wallpaper_data[] asm("_binary_other_wallpaper720p_jpg_start");
-extern uint8_t wallpaper_data_end[] asm("_binary_other_wallpaper720p_jpg_end");
+
+
+#define EXTERNALPICTURE(name, fname, fileextension) extern uint8_t name ## _data[] asm("_binary_other_"#fname"_"#fileextension"_start"); \
+ extern uint8_t name ## _data_end[] asm("_binary_other_"#fname"_"#fileextension"_end");
+
+EXTERNAL_PICTS
+
+#undef EXTERNALPICTURES
#define BACKBUFFER_WIDTH 1280
cur_fontname=(char*)malloc(strlen(fontname)+1);
strcpy(cur_fontname,fontname);
+#define EXTERNALPICTURE(name, fname, fileextension) static_artwork_begin[sa_ ## name]=name ## _data;
+
+ EXTERNAL_PICTS
+
+#undef EXTERNALPICTURE
+#define EXTERNALPICTURE(name, fname, fileextension) static_artwork_end[sa_ ## name]=name ## _data_end;
+
+ EXTERNAL_PICTS
+
+#undef EXTERNALPICTURE
}
OsdOpenVG::~OsdOpenVG()
comm.param1=index;
putOpenVGCommand(comm,false);
}
-/*
-ImageIndex OsdOpenVG::createJpeg(const char* fileName, int *width,int *height)
-{
- Image* magicimage=NULL;
- struct OpenVGCommand comm;
- comm.task=OVGcreateImageFile;
-
- try{
- // Now figure out, if it is a special case
- if (strcmp(fileName,"/vdr.jpg")==0) {
- magicimage=new Image(Blob(vdr_data,vdr_data_end-vdr_data));
- *height=100; // this is faked so that the system does use the old coordinate system
- *width=ceil(190.f*aspect_correction);
- Log::getInstance()->log("OSD", Log::DEBUG, "LoadIm vdr.jpg");
- } else if (strcmp(fileName,"/wallpaperPAL.jpg")==0) {
- magicimage=new Image(Blob(wallpaper_data,wallpaper_data_end-wallpaper_data));
- *width=720; // this is faked so that the system does use the old coordinate system
- *height=576;
- Log::getInstance()->log("OSD", Log::DEBUG, "LoadIm wallpaperPAL.jpg");
- } else {
- magicimage=new Image();
- magicimage->read(fileName);
- Log::getInstance()->log("OSD", Log::DEBUG, "LoadIm file: %s",fileName);
- *width=ceil(magicimage->baseColumns()*aspect_correction); // this is faked so that the system does use the old coordinate system
- *height=magicimage->baseRows();
- }
- }catch( Exception &error_ )
- {
- Log::getInstance()->log("OSD", Log::DEBUG, "Libmagick: %s",error_.what());
-
- return 0;
- }
- comm.data=magicimage;
- return putOpenVGCommand(comm,true);
-}*/
bool OsdOpenVG::getStaticImageData(unsigned int static_id, UCHAR **userdata, ULONG *length)
{
- switch (static_id) {
- case 1: {
- *userdata = vdr_data;
- *length = vdr_data_end-vdr_data;
- return true;
- } break;
- case 2: {
- *userdata = wallpaper_data;
- *length = wallpaper_data_end-wallpaper_data;
+ if (sa_MAX>static_id) {
+ *userdata = static_artwork_begin[static_id];
+ *length = static_artwork_end[static_id] - static_artwork_begin[static_id];
return true;
- } break;
- default: {
- *userdata = NULL;
- *length = 0;
- return false;
- } break;
- };
+ }
+
+ *userdata = NULL;
+ *length = 0;
+ return false;
+
}
void OsdOpenVG::createPicture(struct PictureInfo& pict_inf)
void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int *height)
{
- int jpeg_index=-1; // This is for compatibility only
+ StaticArtwork index=sa_MAX; // This is for compatibility only
if (strcmp(fileName,"/vdr.jpg")==0) {
- jpeg_index=1;
+ index=sa_vdrlogo;
*height=100; // this is faked so that the system does use the old coordinate system
*width=ceil(190.f*osd->getPixelAspect());
} else if (strcmp(fileName,"/wallpaperPAL.jpg")==0) {
- jpeg_index=2;
+ index=sa_wallpaper;
*width=720; // this is faked so that the system does use the old coordinate system
*height=576;
}
- if (jpeg_index>0) {
+ if (index!=sa_MAX) {
TVMediaInfo info;
- info.setDefaultJpeg(jpeg_index);
+ info.setStaticArtwork(index);
drawTVMedia(info,x,y,*width,*height,TopLeft);
}
}