]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Fixed Scaling in Jpeg handling, add Subtitles handling for HD resolutions(untested...
authorMarten Richter <marten.richter@freenet.de>
Sun, 7 Oct 2012 16:20:41 +0000 (18:20 +0200)
committerMarten Richter <marten.richter@freenet.de>
Sun, 7 Oct 2012 16:20:41 +0000 (18:20 +0200)
21 files changed:
bitmap.cc
bitmap.h
boxx.cc
boxx.h
dvbsubtitles.cc
dvbsubtitles.h
osdopenvg.cc
osdopenvg.h
osdreceiver.h
osdvector.cc
osdvector.h
surface.h
surfacemvp.cc
surfaceopengl.cc
surfaceopengl.h
surfacevector.cc
surfacevector.h
vvideolivetv.cc
vvideolivetv.h
vvideorec.cc
vvideorec.h

index 29e62b6a6c2bd535a09282a8a117b960eb9df6b7..7dde8848b1e7e8b9ca33919556dae8fd617bdf5c 100644 (file)
--- a/bitmap.cc
+++ b/bitmap.cc
 */
 #include "bitmap.h"
 
+
+DisplayRegion::DisplayRegion()
+{
+       framewidth=720;
+       frameheight=576;
+       windowx=0;
+       windowy=0;
+       windoww=719;
+       windowh=575;
+}
+
 Palette::Palette(UCHAR tBpp)
 {
   numColours = 0;
index 115cf311936d7a67e9a98e18f7b327c296d3a352..c15a3941b2a948647e2ff91db88234f57ed361ee 100644 (file)
--- a/bitmap.h
+++ b/bitmap.h
 #include "defines.h"
 #include <vector>
 
+class DisplayRegion {
+public:
+       DisplayRegion();
+    UINT windowx, windowy,windoww,windowh;
+    UINT framewidth,frameheight;
+};
+
+
+
 class Palette
 {
   public:
diff --git a/boxx.cc b/boxx.cc
index 4645d60fbe8969207ae65d5c5f951d085439e16a..af2464dcc92597bb405f356c5092f8c1043d0553 100644 (file)
--- a/boxx.cc
+++ b/boxx.cc
@@ -391,10 +391,10 @@ void Boxx::drawTTChar(int ox, int oy,int x, int y, cTeletextChar c)
 \r
 }\r
 \r
-void Boxx::drawBitmap(UINT x, UINT y, const Bitmap& bm)\r
+void Boxx::drawBitmap(UINT x, UINT y, const Bitmap& bm, const DisplayRegion & region)\r
 {\r
-  if (parent) parent->drawBitmap(area.x + x, area.y + y, bm);\r
-  else  if (surface) surface->drawBitmap(x, y, bm);\r
+  if (parent) parent->drawBitmap(area.x + x, area.y + y, bm, region);\r
+  else  if (surface) surface->drawBitmap(x, y, bm, region);\r
 }\r
 \r
 void Boxx::drawJpeg(const char *fileName,int x, int y,int *width, int *height)\r
diff --git a/boxx.h b/boxx.h
index 887d03dbd105a9b6f28d4368b9a29af403aa4f09..6755cb74cc277c46f04a8015d1db362122f8668b 100644 (file)
--- a/boxx.h
+++ b/boxx.h
@@ -103,7 +103,7 @@ class Boxx
     void drawTextCentre(const char* text, int x, int y, const DrawStyle& colour);\r
     //Now deprecated\r
     //void drawPixel(UINT x, UINT y, const Colour& colour, bool fastdraw=false);\r
-    void drawBitmap(UINT x, UINT y, const Bitmap& bm);\r
+    void drawBitmap(UINT x, UINT y, const Bitmap& bm, const DisplayRegion & region);\r
    //Now deprecated\r
     // void drawPixelAlpha(UINT x, UINT y, const Colour& colour,bool fastdraw=false);\r
     int getFontHeight();\r
index f1be7a80399e73cb5cb9abf5e8be5ae0db5bbf0c..b0da569e0299d22e3abaa597851042f117453438 100644 (file)
@@ -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();
index d72039673a092fd2fdf758a94d6ba53221177a56..db6575006e174d927f475424fd5fc0325066c1c1 100644 (file)
@@ -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;
index 955f78b6afd41a0164a67b425b008e051b0e02c8..4d8c419484d0c73d02b8fa477b61d2c929c2f985 100644 (file)
@@ -657,9 +657,15 @@ void OsdOpenVG::executeDrawCommand(SVGCommand & command)
                        vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);\r
                        vgScale(aspect_correction,1.f);\r
                } else {\r
+                       VGfloat imagewidth=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_WIDTH);\r
+                       VGfloat imageheight=vgGetParameteri((VGImage) command.target.image, VG_IMAGE_HEIGHT);\r
                        //vgScale(720.f/((float)BACKBUFFER_WIDTH), 576.f/((float)BACKBUFFER_HEIGHT));\r
-                       vgScale(aspect_correction,1.f);\r
+                       float scalex=command.w/imagewidth;\r
+                       float scaley=command.h/imageheight;\r
+                       //vgScale(command.w/imagewidth,command.h/imageheight);\r
+                       vgScale(scalex,scaley);\r
                        vgSeti(VG_IMAGE_MODE,VG_DRAW_IMAGE_NORMAL);\r
+                       //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Image Scale  %g %g %g %g %g %g",command.w,imagewidth,command.h,imageheight,scalex,scaley);\r
                }\r
 \r
 \r
@@ -756,10 +762,27 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command)
                vgDestroyPaint((VGPaint)command.param1);\r
                return 0;\r
        } break;\r
-       case OVGcreateImageRGBA: {\r
-               return vgCreateImage(VG_sRGBA_8888,command.param1, command.param2,\r
-                                       VG_IMAGE_QUALITY_NONANTIALIASED|\r
-                                       VG_IMAGE_QUALITY_FASTER|VG_IMAGE_QUALITY_BETTER);\r
+       case OVGcreateImagePalette: {\r
+               VGImage input=vgCreateImage(VG_A_8,command.param1, command.param2,\r
+                               VG_IMAGE_QUALITY_NONANTIALIASED|\r
+                               VG_IMAGE_QUALITY_FASTER|VG_IMAGE_QUALITY_BETTER);\r
+               vgImageSubData(input,command.data,command.param1,\r
+                                                       VG_A_8,0,0,command.param1, command.param2); // upload palettized image data\r
+               VGImage handle=vgCreateImage(VG_sRGBA_8888,command.param1, command.param2,\r
+                                               VG_IMAGE_QUALITY_NONANTIALIASED|\r
+                                               VG_IMAGE_QUALITY_FASTER|VG_IMAGE_QUALITY_BETTER);\r
+               VGuint *palette=(VGuint*)malloc(256*sizeof(VGuint));\r
+               VGuint *in_palette=(VGuint*)command.data2;\r
+               for (int i=0;i<256;i++) {\r
+                       VGuint color=in_palette[i];\r
+                       palette[i]=color<<8 | (color &0xff000000)>>24;\r
+               }\r
+\r
+               vgLookupSingle(handle,input,palette,VG_ALPHA,VG_FALSE,VG_FALSE);\r
+               free(palette);\r
+               vgDestroyImage(input);\r
+\r
+               return handle;\r
        } break;\r
        case OVGcreateMonoBitmap: {\r
                VGImage handle=vgCreateImage(VG_A_1,command.param1, command.param2,\r
@@ -980,12 +1003,14 @@ ImageIndex OsdOpenVG::createMonoBitmap(void *base,int width,int height)
        return putOpenVGCommand(comm,true);\r
 }\r
 \r
-ImageIndex OsdOpenVG::createImageRGBA(int width,int height)\r
+ImageIndex OsdOpenVG::createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data)\r
 {\r
     struct OpenVGCommand comm;\r
-    comm.task=OVGcreateImageRGBA;\r
+    comm.task=OVGcreateImagePalette;\r
     comm.param1=width;\r
     comm.param2=height;\r
+    comm.data=image_data;\r
+    comm.data2=palette_data;\r
     return putOpenVGCommand(comm,true);\r
 }\r
 \r
index 3769d73241151d4cbbfe72013a16f72bf062025d..29bcfe534f77eb97dcae9457626e993e3ef1ee01 100644 (file)
@@ -46,7 +46,7 @@
 enum OpenVGTask {\r
        OVGdestroyImageRef,\r
        OVGdestroyPaint,\r
-       OVGcreateImageRGBA,\r
+       OVGcreateImagePalette,\r
        OVGcreateMonoBitmap,\r
        OVGcreateColorRef,\r
        OVGimageUploadLine,\r
@@ -57,6 +57,7 @@ struct OpenVGCommand
 {\r
        enum OpenVGTask task;\r
        const void *data;\r
+       const void *data2;\r
        unsigned int param1,param2,param3;\r
        unsigned int id; //only set an id if you are waiting\r
 };\r
@@ -87,7 +88,7 @@ protected:
     void destroyImageRef(ImageIndex index);\r
     ImageIndex createJpeg(const char* fileName, int *width,int *height);\r
     ImageIndex createMonoBitmap(void *base,int width,int height);\r
-    ImageIndex createImageRGBA(int width,int height);\r
+    ImageIndex createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data);\r
     void destroyStyleRef(unsigned int index);\r
        unsigned int createStyleRef(const DrawStyle &c);\r
        unsigned int createColorRef(const Colour &c);\r
index 4fb350db017204506e3dec3364ea66c181b02b31..37f41dc15dbbfb44f9f4705d93a707584b8f9350 100644 (file)
 #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
index 5663fa9022c176bfb88fa4e7224aa9bd61ac17e0..791f36ab97fc86b61d4be84bbc233209a51373f7 100644 (file)
@@ -327,10 +327,10 @@ ImageIndex OsdVector::getMonoBitmapRef(void *base,int width,int height)
        return image_handle;\r
 }\r
 \r
-ImageIndex  OsdVector::getImageRGBA(int width,int height)\r
+ImageIndex  OsdVector::getImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data)\r
 {\r
        ImageIndex image_handle;\r
-       image_handle=createImageRGBA(width,height);\r
+       image_handle=createImagePalette(width,height,image_data,palette_data);\r
        incImageRef(image_handle);\r
        return image_handle;\r
 }\r
index 963bbf2ec3e9bbe7f3a658238b558c0bef14d92f..028996c78471cf0b42898edde9c238fd3451a131 100644 (file)
@@ -147,7 +147,7 @@ class OsdVector : public Osd
 \r
        virtual ImageIndex getJpegRef(const char* fileName, int *width,int *height);\r
        virtual ImageIndex getMonoBitmapRef(void *base,int width,int height);\r
-       virtual ImageIndex getImageRGBA(int width,int height);\r
+       virtual ImageIndex getImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data);\r
        virtual void imageUploadLine(ImageIndex index,unsigned int j,unsigned int width,void *data)=0;\r
        void removeImageRef(const ImageIndex ref);\r
        unsigned int getColorRef(const Colour &c); //internally this is the same as getStyleRef\r
@@ -166,7 +166,7 @@ protected:
        virtual void destroyImageRef(ImageIndex index)=0;\r
        virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0;\r
        virtual ImageIndex createMonoBitmap(void *base,int width,int height)=0;\r
-       virtual ImageIndex createImageRGBA(int width,int height)=0;\r
+       virtual ImageIndex createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data)=0;\r
 \r
        map<ImageIndex,unsigned int> images_ref;\r
        map<void *,ImageIndex> monobitmaps;\r
index d92994bc7d49b5413cdcb51406ab624ccf82b89b..f970f4db979d51c72c368ffba6fec8fcee42753e 100644 (file)
--- a/surface.h
+++ b/surface.h
@@ -43,6 +43,7 @@ typedef struct bogl_font {
 extern osd_font_t font_helvB18;\r
 \r
 class Bitmap;\r
+class DisplayRegion;\r
 \r
 \r
 \r
@@ -72,7 +73,7 @@ class Surface
     virtual int fillblt(int x, int y, int width, int height, const DrawStyle& c)=0;\r
     virtual void drawHorzLine(int x1, int x2, int y, const DrawStyle& c)=0;\r
     virtual void drawVertLine(int x, int y1, int y2, const DrawStyle& c)=0;\r
-    virtual void drawBitmap(int x, int y, const Bitmap& bm)=0;\r
+    virtual void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region)=0;\r
     virtual void drawPoint(int x, int y, DrawStyle& c, bool fastdraw=false); // This draws a point, must not be a pixel\r
     virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour);\r
     virtual int updateToScreen(int sx, int sy, int w, int h, int dx, int dy)=0;\r
index d7d4fc7a57cf9628154463871dc565653c80c691..a710d5d4d35f4f0bb37bc31241e0e22551177bcf 100644 (file)
@@ -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;
index f1348a089f68ed6ebbcabf60ef97aec202ba261b..578fb3dab3482a25b731254e09c5c40942cdee86 100644 (file)
@@ -198,7 +198,7 @@ void SurfaceOpenGL::drawVertLine(int x, int y1, int y2, const DrawStyle& c)
   fillblt(x, y1, 1, y2-y1, c);\r
 }\r
 \r
-void SurfaceOpenGL::drawBitmap(int x, int y, const Bitmap& bm)\r
+void SurfaceOpenGL::drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region) //region should not matter for SD\r
 {\r
   // Temporary code? Draw one pixel at a time using drawPixel()\r
   startFastDraw();\r
index 51198c9b10386a50da67182dee36e658feff3773..81d0809ad05ca93bc0a69dfce16e549c661a4766 100644 (file)
@@ -42,7 +42,7 @@ class SurfaceOpenGL : public Surface
 \r
     void drawHorzLine(int x1, int x2, int y, const DrawStyle& c);\r
     void drawVertLine(int x, int y1, int y2, const DrawStyle& c);\r
-    void drawBitmap(int x, int y, const Bitmap& bm);\r
+    void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region);\r
     int updateToScreen(int sx, int sy, int w, int h, int dx, int dy);\r
     void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b);\r
     void screenShot(const char* fileName);\r
index 9bec0aa9f67d08990d81bd33ac4a216c83adf76c..6203c472a11fab6d550162d7797f9eda0893d329 100644 (file)
@@ -158,7 +158,7 @@ void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int *
 {\r
        command_mutex.Lock();\r
        ImageIndex image=osd->getJpegRef(fileName,width,height);\r
-       commands.push_back(SVGCommand(x,y,*height,*width,image,0));\r
+       commands.push_back(SVGCommand(x,y,*width,*height,image,0));\r
        command_mutex.Unlock();\r
 }\r
 \r
@@ -198,21 +198,34 @@ void SurfaceVector::drawVertLine(int x, int y1, int y2, const DrawStyle& c){
        command_mutex.Unlock();\r
 }\r
 \r
-void SurfaceVector::drawBitmap(int x, int y, const Bitmap& bm)\r
+void SurfaceVector::drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region)\r
 {\r
        //this is complicated\r
        command_mutex.Lock();\r
-       ImageIndex image=osd->getImageRGBA(bm.getWidth(),bm.getHeight());\r
-       unsigned int * data=(unsigned int*)malloc(sizeof(unsigned int)*bm.getWidth());\r
+/*\r
+       unsigned int * data=(unsigned int*)malloc(sizeof(unsigned int)*bm.getWidth()*bm.getHeight());\r
        for (UINT j = 0; j < bm.getHeight(); ++j){\r
           for (UINT i = 0; i < bm.getWidth(); ++i)\r
           {\r
-                  data[i]=bm.getColour(i,j);\r
+                  data[i+j*bm.getHeight()]=bm.getColour(i,j);\r
           }\r
-          osd->imageUploadLine(image,j,bm.getWidth(),data);\r
-    }\r
-       free(data);\r
-       commands.push_back(SVGCommand(x,y,bm.getHeight(),bm.getWidth(),image,0));\r
+    }*/\r
+       ImageIndex image=osd->getImagePalette(bm.getWidth(),bm.getHeight(),&(bm.rawData()[0]),\r
+                       (const unsigned int*)&bm.palette.getColourVector()[0]); // data is freed by the OSD\r
+       //free(data);\r
+       float tx=x+region.windowx;\r
+       float ty=y+region.windowy;\r
+       float th=bm.getHeight();\r
+       float tw=bm.getWidth();\r
+\r
+       float scalex=720.f/((float) (region.framewidth+1));\r
+       float scaley=576.f/((float) (region.frameheight+1));\r
+       tx*=scalex;\r
+       ty*=scaley;\r
+       tw*=scalex;\r
+       th*=scaley;\r
+       SVGCommand temp=SVGCommand(tx,ty,tw,th,image,0);\r
+       commands.push_back(temp);\r
        command_mutex.Unlock();\r
 }\r
 \r
index 9a781743cc97cf472c3a313ab57194b87c62db90..51a82a6c5ff10988606b59dbe2be4a83dd6b7bcc 100644 (file)
@@ -50,7 +50,7 @@ class SurfaceVector : public Surface
     int fillblt(int x, int y, int width, int height, const DrawStyle& c);\r
     void drawHorzLine(int x1, int x2, int y, const DrawStyle& c);\r
     void drawVertLine(int x, int y1, int y2, const DrawStyle& c);\r
-    void drawBitmap(int x, int y, const Bitmap& bm);\r
+    void drawBitmap(int x, int y, const Bitmap& bm,const DisplayRegion & region);\r
     void drawPoint(int x, int y, DrawStyle& c, bool fastdraw=false); // This draws a point, must not be a pixel\r
     void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour);\r
     int updateToScreen(int sx, int sy, int w, int h, int dx, int dy);\r
index 42560049e948f02dda9e9129ffe7244e47685ec1..b1998432a87380737a23b3d6457636ec85b8d058 100644 (file)
@@ -1187,9 +1187,9 @@ void VVideoLiveTV::toggleChopSides()
   }\r
 }\r
 \r
-void VVideoLiveTV::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm)\r
+void VVideoLiveTV::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm, const DisplayRegion& region)\r
 {\r
-  drawBitmap(posX, posY, bm);\r
+  drawBitmap(posX, posY, bm,region);\r
   Region r;\r
   r.x = posX; r.y = posY; r.w = bm.getWidth(); r.h = bm.getHeight();\r
   boxstack->update(this, &r);\r
@@ -1201,10 +1201,17 @@ void VVideoLiveTV::clearOSD()
   boxstack->update(this, &area);\r
 }\r
 \r
-void VVideoLiveTV::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height)\r
+void VVideoLiveTV::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region)\r
 {\r
   Region r;\r
-  r.x = posX; r.y = posY; r.w = width; r.h = height;\r
+  r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height;\r
+  //now convert to our display\r
+  float scalex=720.f/((float) (region.framewidth+1));\r
+  float scaley=576.f/((float) (region.frameheight+1));\r
+  r.x=floor(scalex*((float)r.x));\r
+  r.y=floor(scaley*((float)r.y));\r
+  r.w=ceil(scalex*((float)r.w));\r
+  r.h=ceil(scaley*((float)r.h));\r
   rectangle(r, DrawStyle(0,0,0,0));\r
   boxstack->update(this, &r);\r
 }\r
index 3c9eede355c51b477b0ee81dfc7a15bca053ebc9..9f1f7675f0d934ebe04f00a7c1e3334ceb60c809 100644 (file)
@@ -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;
index 782432962d9a07f7e5597d7ec93ebb4ac1861823..65b45f9d4488c1c8e29ab25570fa6ae9b8f95ea0 100644 (file)
@@ -1079,9 +1079,9 @@ void VVideoRec::removeSummary()
   }\r
 }\r
 \r
-void VVideoRec::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm)\r
+void VVideoRec::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm, const DisplayRegion& region)\r
 {\r
-  drawBitmap(posX, posY, bm);\r
+  drawBitmap(posX, posY, bm, region);\r
   Region r;\r
   r.x = posX; r.y = posY; r.w = bm.getWidth(); r.h = bm.getHeight();\r
   boxstack->update(this, &r);\r
@@ -1093,10 +1093,18 @@ void VVideoRec::clearOSD()
   boxstack->update(this, &area);\r
 }\r
 \r
-void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height)\r
+void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region)\r
 {\r
   Region r;\r
-  r.x = posX; r.y = posY; r.w = width; r.h = height;\r
+  r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height;\r
+  //now convert to our display\r
+  float scalex=720.f/((float) (region.framewidth+1));\r
+  float scaley=576.f/((float) (region.frameheight+1));\r
+  r.x=floor(scalex*((float)r.x));\r
+  r.y=floor(scaley*((float)r.y));\r
+  r.w=ceil(scalex*((float)r.w));\r
+  r.h=ceil(scaley*((float)r.h));\r
+\r
   rectangle(r, transparent);\r
   boxstack->update(this, &r);\r
 }\r
index ab7dd6f1c22499ca0c63754106d9c355fa6ece08..6620c20e5f0e35e9a17ea2e808b2b9afbc984718 100644 (file)
@@ -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();