From 2961ce854e5f97d5641136f4a0514caee67c82ff Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sun, 7 Oct 2012 18:20:41 +0200 Subject: [PATCH] Fixed Scaling in Jpeg handling, add Subtitles handling for HD resolutions(untested), add Subtitles rendering on OpenVG --- bitmap.cc | 11 +++++++++++ bitmap.h | 9 +++++++++ boxx.cc | 6 +++--- boxx.h | 2 +- dvbsubtitles.cc | 39 +++++++++++++++++++++++++++++++++------ dvbsubtitles.h | 13 ++++++++++++- osdopenvg.cc | 39 ++++++++++++++++++++++++++++++++------- osdopenvg.h | 5 +++-- osdreceiver.h | 5 +++-- osdvector.cc | 4 ++-- osdvector.h | 4 ++-- surface.h | 3 ++- surfacemvp.cc | 2 +- surfaceopengl.cc | 2 +- surfaceopengl.h | 2 +- surfacevector.cc | 31 ++++++++++++++++++++++--------- surfacevector.h | 2 +- vvideolivetv.cc | 15 +++++++++++---- vvideolivetv.h | 4 ++-- vvideorec.cc | 16 ++++++++++++---- vvideorec.h | 4 ++-- 21 files changed, 166 insertions(+), 52 deletions(-) diff --git a/bitmap.cc b/bitmap.cc index 29e62b6..7dde884 100644 --- a/bitmap.cc +++ b/bitmap.cc @@ -19,6 +19,17 @@ */ #include "bitmap.h" + +DisplayRegion::DisplayRegion() +{ + framewidth=720; + frameheight=576; + windowx=0; + windowy=0; + windoww=719; + windowh=575; +} + Palette::Palette(UCHAR tBpp) { numColours = 0; diff --git a/bitmap.h b/bitmap.h index 115cf31..c15a394 100644 --- a/bitmap.h +++ b/bitmap.h @@ -23,6 +23,15 @@ #include "defines.h" #include +class DisplayRegion { +public: + DisplayRegion(); + UINT windowx, windowy,windoww,windowh; + UINT framewidth,frameheight; +}; + + + class Palette { public: diff --git a/boxx.cc b/boxx.cc index 4645d60..af2464d 100644 --- a/boxx.cc +++ b/boxx.cc @@ -391,10 +391,10 @@ void Boxx::drawTTChar(int ox, int oy,int x, int y, cTeletextChar c) } -void Boxx::drawBitmap(UINT x, UINT y, const Bitmap& bm) +void Boxx::drawBitmap(UINT x, UINT y, const Bitmap& bm, const DisplayRegion & region) { - if (parent) parent->drawBitmap(area.x + x, area.y + y, bm); - else if (surface) surface->drawBitmap(x, y, bm); + if (parent) parent->drawBitmap(area.x + x, area.y + y, bm, region); + else if (surface) surface->drawBitmap(x, y, bm, region); } void Boxx::drawJpeg(const char *fileName,int x, int y,int *width, int *height) diff --git a/boxx.h b/boxx.h index 887d03d..6755cb7 100644 --- a/boxx.h +++ b/boxx.h @@ -103,7 +103,7 @@ class Boxx void drawTextCentre(const char* text, int x, int y, const DrawStyle& colour); //Now deprecated //void drawPixel(UINT x, UINT y, const Colour& colour, bool fastdraw=false); - void drawBitmap(UINT x, UINT y, const Bitmap& bm); + void drawBitmap(UINT x, UINT y, const Bitmap& bm, const DisplayRegion & region); //Now deprecated // void drawPixelAlpha(UINT x, UINT y, const Colour& colour,bool fastdraw=false); int getFontHeight(); diff --git a/dvbsubtitles.cc b/dvbsubtitles.cc index f1be7a8..b0da569 100644 --- a/dvbsubtitles.cc +++ b/dvbsubtitles.cc @@ -188,6 +188,12 @@ void DVBSubtitlePage::updateRegionPalettes(const DVBSubtitleCLUT& clut) region->second.palette = clut.getPalette(region->second.palette.getBpp()); } +DVBSubtitleDisplayDefinition::DVBSubtitleDisplayDefinition() +{ + version=0xFF; + displaywindow=false; +} + class DVBSubtitleObject { private: @@ -677,8 +683,28 @@ bool DVBSubtitles::decodePacket(const PESPacket& packet) ; // TODO break; } - case 0x14: // Display definition - break; // TODO: Ignore now and assume 720x576 per ETSI EN 300 743 V1.2.1 + case 0x14: {// Display definition + if (segmentLength<5) break; + UINT ddsversion=(segmentData[0]&0xf0)>>4; + if (ddsversion==dds.version) break; // no update ncessary + dds.version=ddsversion; + dds.displaywindow=!(!(segmentData[0]&0x08)); + dds.framewidth=(segmentData[1] << 8) + segmentData[2]; + dds.frameheight=(segmentData[3] << 8) + segmentData[4]; + if (segmentLength<13) break; + if (dds.displaywindow) { + dds.windowx=(segmentData[4] << 8) + segmentData[5]; + dds.windoww=(segmentData[6] << 8) + segmentData[7]-dds.windowx; + dds.windowy=(segmentData[8] << 8) + segmentData[9]; + dds.windowh=(segmentData[10] << 8) + segmentData[11]-dds.windowy; + } else { + dds.windowx=0; + dds.windowy=0; + dds.windoww=dds.framewidth; + dds.windowh=dds.frameheight; + } + break; + } case 0x80: // End of display set finishPage(page); page.dirty = false; @@ -711,7 +737,7 @@ void DVBSubtitles::finishPage(const DVBSubtitlePage& page) if (region_iter == page.regions.end()) continue; Log::getInstance()->log("SUBTITLES", Log::DEBUG, "Clear region %d", i->first); osd->clearOSDArea(i->second.x, i->second.y, - region_iter->second.getWidth(), region_iter->second.getHeight()); + region_iter->second.getWidth(), region_iter->second.getHeight(),dds); } } @@ -721,7 +747,7 @@ void DVBSubtitles::finishPage(const DVBSubtitlePage& page) region_iter = page.regions.find(i->first); if (region_iter == page.regions.end()) continue; Log::getInstance()->log("SUBTITLES", Log::DEBUG, "Display region %d", i->first); - osd->drawOSDBitmap(i->second.x, i->second.y, region_iter->second); + osd->drawOSDBitmap(i->second.x, i->second.y, region_iter->second,dds); } } @@ -764,6 +790,7 @@ void DVBSubtitles::unlockOutput() int DVBSubtitles::start() { lockInput(); + dds=DVBSubtitleDisplayDefinition(); running = true; unlockInput(); return threadStart(); @@ -788,7 +815,7 @@ void DVBSubtitles::stop() region_iter = page.regions.find(i->first); if (region_iter == page.regions.end()) continue; osd->clearOSDArea(i->second.x, i->second.y, - region_iter->second.getWidth(), region_iter->second.getHeight()); + region_iter->second.getWidth(), region_iter->second.getHeight(),dds); } } pages.clear(); @@ -819,7 +846,7 @@ void DVBSubtitles::hide() region_iter = page.regions.find(i->first); if (region_iter == page.regions.end()) continue; osd->clearOSDArea(i->second.x, i->second.y, - region_iter->second.getWidth(), region_iter->second.getHeight()); + region_iter->second.getWidth(), region_iter->second.getHeight(),dds); } } pages.clear(); diff --git a/dvbsubtitles.h b/dvbsubtitles.h index d720396..db65750 100644 --- a/dvbsubtitles.h +++ b/dvbsubtitles.h @@ -90,11 +90,21 @@ class DVBSubtitlePage void updateRegionPalettes(const DVBSubtitleCLUT&); }; +class DVBSubtitleDisplayDefinition: public DisplayRegion +{ +public: + DVBSubtitleDisplayDefinition(); + + UCHAR version; + bool displaywindow; + +}; + class DVBSubtitles : public Thread_TYPE { public: DVBSubtitles(OSDReceiver* tosd = NULL); - ~DVBSubtitles() {} + virtual ~DVBSubtitles() {} void put(const PESPacket& packet); int start(); void stop(); @@ -109,6 +119,7 @@ class DVBSubtitles : public Thread_TYPE UINT pageOnDisplay; bool decodePacket(const PESPacket&); void finishPage(const DVBSubtitlePage&); + DVBSubtitleDisplayDefinition dds; bool running; bool showing; diff --git a/osdopenvg.cc b/osdopenvg.cc index 955f78b..4d8c419 100644 --- a/osdopenvg.cc +++ b/osdopenvg.cc @@ -657,9 +657,15 @@ void OsdOpenVG::executeDrawCommand(SVGCommand & command) vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER); vgScale(aspect_correction,1.f); } else { + VGfloat imagewidth=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_WIDTH); + VGfloat imageheight=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_HEIGHT); //vgScale(720.f/((float)BACKBUFFER_WIDTH), 576.f/((float)BACKBUFFER_HEIGHT)); - vgScale(aspect_correction,1.f); + float scalex=command.w/imagewidth; + float scaley=command.h/imageheight; + //vgScale(command.w/imagewidth,command.h/imageheight); + vgScale(scalex,scaley); vgSeti(VG_IMAGE_MODE,VG_DRAW_IMAGE_NORMAL); + //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Image Scale %g %g %g %g %g %g",command.w,imagewidth,command.h,imageheight,scalex,scaley); } @@ -756,10 +762,27 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command) vgDestroyPaint((VGPaint)command.param1); return 0; } break; - case OVGcreateImageRGBA: { - return vgCreateImage(VG_sRGBA_8888,command.param1, command.param2, - VG_IMAGE_QUALITY_NONANTIALIASED| - VG_IMAGE_QUALITY_FASTER|VG_IMAGE_QUALITY_BETTER); + case OVGcreateImagePalette: { + VGImage input=vgCreateImage(VG_A_8,command.param1, command.param2, + VG_IMAGE_QUALITY_NONANTIALIASED| + VG_IMAGE_QUALITY_FASTER|VG_IMAGE_QUALITY_BETTER); + vgImageSubData(input,command.data,command.param1, + VG_A_8,0,0,command.param1, command.param2); // upload palettized image data + VGImage handle=vgCreateImage(VG_sRGBA_8888,command.param1, command.param2, + VG_IMAGE_QUALITY_NONANTIALIASED| + VG_IMAGE_QUALITY_FASTER|VG_IMAGE_QUALITY_BETTER); + VGuint *palette=(VGuint*)malloc(256*sizeof(VGuint)); + VGuint *in_palette=(VGuint*)command.data2; + for (int i=0;i<256;i++) { + VGuint color=in_palette[i]; + palette[i]=color<<8 | (color &0xff000000)>>24; + } + + vgLookupSingle(handle,input,palette,VG_ALPHA,VG_FALSE,VG_FALSE); + free(palette); + vgDestroyImage(input); + + return handle; } break; case OVGcreateMonoBitmap: { VGImage handle=vgCreateImage(VG_A_1,command.param1, command.param2, @@ -980,12 +1003,14 @@ ImageIndex OsdOpenVG::createMonoBitmap(void *base,int width,int height) return putOpenVGCommand(comm,true); } -ImageIndex OsdOpenVG::createImageRGBA(int width,int height) +ImageIndex OsdOpenVG::createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data) { struct OpenVGCommand comm; - comm.task=OVGcreateImageRGBA; + comm.task=OVGcreateImagePalette; comm.param1=width; comm.param2=height; + comm.data=image_data; + comm.data2=palette_data; return putOpenVGCommand(comm,true); } diff --git a/osdopenvg.h b/osdopenvg.h index 3769d73..29bcfe5 100644 --- a/osdopenvg.h +++ b/osdopenvg.h @@ -46,7 +46,7 @@ enum OpenVGTask { OVGdestroyImageRef, OVGdestroyPaint, - OVGcreateImageRGBA, + OVGcreateImagePalette, OVGcreateMonoBitmap, OVGcreateColorRef, OVGimageUploadLine, @@ -57,6 +57,7 @@ struct OpenVGCommand { enum OpenVGTask task; const void *data; + const void *data2; unsigned int param1,param2,param3; unsigned int id; //only set an id if you are waiting }; @@ -87,7 +88,7 @@ protected: void destroyImageRef(ImageIndex index); ImageIndex createJpeg(const char* fileName, int *width,int *height); ImageIndex createMonoBitmap(void *base,int width,int height); - ImageIndex createImageRGBA(int width,int height); + ImageIndex createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data); void destroyStyleRef(unsigned int index); unsigned int createStyleRef(const DrawStyle &c); unsigned int createColorRef(const Colour &c); diff --git a/osdreceiver.h b/osdreceiver.h index 4fb350d..37f41dc 100644 --- a/osdreceiver.h +++ b/osdreceiver.h @@ -21,13 +21,14 @@ #define OSDRECEIVER_H class Bitmap; +class DisplayRegion; class OSDReceiver { public: - virtual void drawOSDBitmap(UINT posX, UINT posY, const Bitmap&)=0; + virtual void drawOSDBitmap(UINT posX, UINT posY, const Bitmap&, const DisplayRegion& region)=0; virtual void clearOSD()=0; - virtual void clearOSDArea(UINT posX, UINT posY, UINT width, UINT height)=0; + virtual void clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region)=0; }; #endif diff --git a/osdvector.cc b/osdvector.cc index 5663fa9..791f36a 100644 --- a/osdvector.cc +++ b/osdvector.cc @@ -327,10 +327,10 @@ ImageIndex OsdVector::getMonoBitmapRef(void *base,int width,int height) return image_handle; } -ImageIndex OsdVector::getImageRGBA(int width,int height) +ImageIndex OsdVector::getImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data) { ImageIndex image_handle; - image_handle=createImageRGBA(width,height); + image_handle=createImagePalette(width,height,image_data,palette_data); incImageRef(image_handle); return image_handle; } diff --git a/osdvector.h b/osdvector.h index 963bbf2..028996c 100644 --- a/osdvector.h +++ b/osdvector.h @@ -147,7 +147,7 @@ class OsdVector : public Osd virtual ImageIndex getJpegRef(const char* fileName, int *width,int *height); virtual ImageIndex getMonoBitmapRef(void *base,int width,int height); - virtual ImageIndex getImageRGBA(int width,int height); + virtual ImageIndex getImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data); virtual void imageUploadLine(ImageIndex index,unsigned int j,unsigned int width,void *data)=0; void removeImageRef(const ImageIndex ref); unsigned int getColorRef(const Colour &c); //internally this is the same as getStyleRef @@ -166,7 +166,7 @@ protected: virtual void destroyImageRef(ImageIndex index)=0; virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0; virtual ImageIndex createMonoBitmap(void *base,int width,int height)=0; - virtual ImageIndex createImageRGBA(int width,int height)=0; + virtual ImageIndex createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data)=0; map images_ref; map monobitmaps; diff --git a/surface.h b/surface.h index d92994b..f970f4d 100644 --- a/surface.h +++ b/surface.h @@ -43,6 +43,7 @@ typedef struct bogl_font { extern osd_font_t font_helvB18; class Bitmap; +class DisplayRegion; @@ -72,7 +73,7 @@ class Surface virtual int fillblt(int x, int y, int width, int height, const DrawStyle& c)=0; virtual void drawHorzLine(int x1, int x2, int y, const DrawStyle& c)=0; virtual void drawVertLine(int x, int y1, int y2, const DrawStyle& c)=0; - virtual void drawBitmap(int x, int y, const Bitmap& bm)=0; + virtual void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region)=0; virtual void drawPoint(int x, int y, DrawStyle& c, bool fastdraw=false); // This draws a point, must not be a pixel virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour); virtual int updateToScreen(int sx, int sy, int w, int h, int dx, int dy)=0; diff --git a/surfacemvp.cc b/surfacemvp.cc index d7d4fc7..a710d5d 100644 --- a/surfacemvp.cc +++ b/surfacemvp.cc @@ -263,7 +263,7 @@ void SurfaceMVP::drawVertLine(int x, int y1, int y2, const DrawStyle& c) fillblt(x, y1, 1, y2-y1, c); } -void SurfaceMVP::drawBitmap(int x, int y, const Bitmap& bm) +void SurfaceMVP::drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region) // region should not matter for SD { UINT bmw = bm.getWidth(); UINT bmh = bm.getHeight(); if (bmw == 0 || bmh == 0) return; diff --git a/surfaceopengl.cc b/surfaceopengl.cc index f1348a0..578fb3d 100644 --- a/surfaceopengl.cc +++ b/surfaceopengl.cc @@ -198,7 +198,7 @@ void SurfaceOpenGL::drawVertLine(int x, int y1, int y2, const DrawStyle& c) fillblt(x, y1, 1, y2-y1, c); } -void SurfaceOpenGL::drawBitmap(int x, int y, const Bitmap& bm) +void SurfaceOpenGL::drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region) //region should not matter for SD { // Temporary code? Draw one pixel at a time using drawPixel() startFastDraw(); diff --git a/surfaceopengl.h b/surfaceopengl.h index 51198c9..81d0809 100644 --- a/surfaceopengl.h +++ b/surfaceopengl.h @@ -42,7 +42,7 @@ class SurfaceOpenGL : public Surface void drawHorzLine(int x1, int x2, int y, const DrawStyle& c); void drawVertLine(int x, int y1, int y2, const DrawStyle& c); - void drawBitmap(int x, int y, const Bitmap& bm); + void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region); int updateToScreen(int sx, int sy, int w, int h, int dx, int dy); void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b); void screenShot(const char* fileName); diff --git a/surfacevector.cc b/surfacevector.cc index 9bec0aa..6203c47 100644 --- a/surfacevector.cc +++ b/surfacevector.cc @@ -158,7 +158,7 @@ void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int * { command_mutex.Lock(); ImageIndex image=osd->getJpegRef(fileName,width,height); - commands.push_back(SVGCommand(x,y,*height,*width,image,0)); + commands.push_back(SVGCommand(x,y,*width,*height,image,0)); command_mutex.Unlock(); } @@ -198,21 +198,34 @@ void SurfaceVector::drawVertLine(int x, int y1, int y2, const DrawStyle& c){ command_mutex.Unlock(); } -void SurfaceVector::drawBitmap(int x, int y, const Bitmap& bm) +void SurfaceVector::drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region) { //this is complicated command_mutex.Lock(); - ImageIndex image=osd->getImageRGBA(bm.getWidth(),bm.getHeight()); - unsigned int * data=(unsigned int*)malloc(sizeof(unsigned int)*bm.getWidth()); +/* + unsigned int * data=(unsigned int*)malloc(sizeof(unsigned int)*bm.getWidth()*bm.getHeight()); for (UINT j = 0; j < bm.getHeight(); ++j){ for (UINT i = 0; i < bm.getWidth(); ++i) { - data[i]=bm.getColour(i,j); + data[i+j*bm.getHeight()]=bm.getColour(i,j); } - osd->imageUploadLine(image,j,bm.getWidth(),data); - } - free(data); - commands.push_back(SVGCommand(x,y,bm.getHeight(),bm.getWidth(),image,0)); + }*/ + ImageIndex image=osd->getImagePalette(bm.getWidth(),bm.getHeight(),&(bm.rawData()[0]), + (const unsigned int*)&bm.palette.getColourVector()[0]); // data is freed by the OSD + //free(data); + float tx=x+region.windowx; + float ty=y+region.windowy; + float th=bm.getHeight(); + float tw=bm.getWidth(); + + float scalex=720.f/((float) (region.framewidth+1)); + float scaley=576.f/((float) (region.frameheight+1)); + tx*=scalex; + ty*=scaley; + tw*=scalex; + th*=scaley; + SVGCommand temp=SVGCommand(tx,ty,tw,th,image,0); + commands.push_back(temp); command_mutex.Unlock(); } diff --git a/surfacevector.h b/surfacevector.h index 9a78174..51a82a6 100644 --- a/surfacevector.h +++ b/surfacevector.h @@ -50,7 +50,7 @@ class SurfaceVector : public Surface int fillblt(int x, int y, int width, int height, const DrawStyle& c); void drawHorzLine(int x1, int x2, int y, const DrawStyle& c); void drawVertLine(int x, int y1, int y2, const DrawStyle& c); - void drawBitmap(int x, int y, const Bitmap& bm); + void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region); void drawPoint(int x, int y, DrawStyle& c, bool fastdraw=false); // This draws a point, must not be a pixel void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour); int updateToScreen(int sx, int sy, int w, int h, int dx, int dy); diff --git a/vvideolivetv.cc b/vvideolivetv.cc index 4256004..b199843 100644 --- a/vvideolivetv.cc +++ b/vvideolivetv.cc @@ -1187,9 +1187,9 @@ void VVideoLiveTV::toggleChopSides() } } -void VVideoLiveTV::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm) +void VVideoLiveTV::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm, const DisplayRegion& region) { - drawBitmap(posX, posY, bm); + drawBitmap(posX, posY, bm,region); Region r; r.x = posX; r.y = posY; r.w = bm.getWidth(); r.h = bm.getHeight(); boxstack->update(this, &r); @@ -1201,10 +1201,17 @@ void VVideoLiveTV::clearOSD() boxstack->update(this, &area); } -void VVideoLiveTV::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height) +void VVideoLiveTV::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region) { Region r; - r.x = posX; r.y = posY; r.w = width; r.h = height; + r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height; + //now convert to our display + float scalex=720.f/((float) (region.framewidth+1)); + float scaley=576.f/((float) (region.frameheight+1)); + r.x=floor(scalex*((float)r.x)); + r.y=floor(scaley*((float)r.y)); + r.w=ceil(scalex*((float)r.w)); + r.h=ceil(scaley*((float)r.h)); rectangle(r, DrawStyle(0,0,0,0)); boxstack->update(this, &r); } diff --git a/vvideolivetv.h b/vvideolivetv.h index 3c9eede..9f1f767 100644 --- a/vvideolivetv.h +++ b/vvideolivetv.h @@ -73,9 +73,9 @@ class VVideoLiveTV : public Boxx, public TimerReceiver, public OSDReceiver void timercall(int ref); - void drawOSDBitmap(UINT posX, UINT posY, const Bitmap&); + void drawOSDBitmap(UINT posX, UINT posY, const Bitmap&, const DisplayRegion& region); void clearOSD(); - void clearOSDArea(UINT posX, UINT posY, UINT width, UINT height); + void clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region); private: BoxStack* boxstack; diff --git a/vvideorec.cc b/vvideorec.cc index 7824329..65b45f9 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -1079,9 +1079,9 @@ void VVideoRec::removeSummary() } } -void VVideoRec::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm) +void VVideoRec::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm, const DisplayRegion& region) { - drawBitmap(posX, posY, bm); + drawBitmap(posX, posY, bm, region); Region r; r.x = posX; r.y = posY; r.w = bm.getWidth(); r.h = bm.getHeight(); boxstack->update(this, &r); @@ -1093,10 +1093,18 @@ void VVideoRec::clearOSD() boxstack->update(this, &area); } -void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height) +void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region) { Region r; - r.x = posX; r.y = posY; r.w = width; r.h = height; + r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height; + //now convert to our display + float scalex=720.f/((float) (region.framewidth+1)); + float scaley=576.f/((float) (region.frameheight+1)); + r.x=floor(scalex*((float)r.x)); + r.y=floor(scaley*((float)r.y)); + r.w=ceil(scalex*((float)r.w)); + r.h=ceil(scaley*((float)r.h)); + rectangle(r, transparent); boxstack->update(this, &r); } diff --git a/vvideorec.h b/vvideorec.h index ab7dd6f..6620c20 100644 --- a/vvideorec.h +++ b/vvideorec.h @@ -62,9 +62,9 @@ class VVideoRec : public Boxx, public TimerReceiver, public OSDReceiver void timercall(int clientReference); void processMessage(Message* m); - void drawOSDBitmap(UINT posX, UINT posY, const Bitmap&); + void drawOSDBitmap(UINT posX, UINT posY, const Bitmap&, const DisplayRegion& region); void clearOSD(); - void clearOSDArea(UINT posX, UINT posY, UINT width, UINT height); + void clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region); void doTeletext(); -- 2.39.2