From 0f1062185eb8933d148344b6dd959a2ee2ed5032 Mon Sep 17 00:00:00 2001
From: Marten Richter <marten.richter@freenet.de>
Date: Tue, 18 Sep 2012 08:06:44 +0200
Subject: [PATCH] Some mvpcompile fixes

---
 surface.h     |  3 ++-
 vmediaview.cc | 50 +++++++++++++++++++++++++-------------------------
 vmediaview.h  | 14 +++++++-------
 3 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/surface.h b/surface.h
index 9d5aad6..3399fea 100644
--- a/surface.h
+++ b/surface.h
@@ -48,7 +48,8 @@ class Bitmap;
 
 class Surface
 {
-  friend class Wwss;
+  friend class Wwss; // classes that need surface access, their usage is forbidden for vector based
+  friend class WJpegComplex;// implementations of osd
   public:
     Surface(int id = 0);
     virtual ~Surface();
diff --git a/vmediaview.cc b/vmediaview.cc
index 0e9f274..521f7af 100644
--- a/vmediaview.cc
+++ b/vmediaview.cc
@@ -172,7 +172,7 @@ class DrawingThread : public Thread_TYPE {
   private:
     VMediaView *_parent;
     VPreader * _reader;
-    WJpeg::JpegControl *_ctl;
+    WJpegComplex::JpegControl *_ctl;
     Surface *_sfc;
     Colour _colour;
     bool _interrupted;
@@ -263,7 +263,7 @@ VMediaView::VMediaView(VMediaList *p)
 
   //picture settings
   showtime=INITIAL_SHOWTIME;
-  rotate=WJpeg::ROT_0;
+  rotate=WJpegComplex::ROT_0;
   currentScale=1;
   options=MediaOptions::getInstance();
   VColourTuner::initFactors();
@@ -274,9 +274,9 @@ VMediaView::VMediaView(VMediaList *p)
   ctl.enlarge=false;
   ctl.scaleafter=options->getIntOption("ScaleFactor");
   const char * mode=options->getStringOption("PictureMode");
-  if (strcmp(mode,"clip") == 0) ctl.mode=WJpeg::CROP;
-  else if (strcmp(mode,"letter") == 0) ctl.mode=WJpeg::LETTER;
-  else if (strcmp(mode,"clipfactor") == 0) ctl.mode=WJpeg::CROPPERCENT;
+  if (strcmp(mode,"clip") == 0) ctl.mode=WJpegComplex::CROP;
+  else if (strcmp(mode,"letter") == 0) ctl.mode=WJpegComplex::LETTER;
+  else if (strcmp(mode,"clipfactor") == 0) ctl.mode=WJpegComplex::CROPPERCENT;
   ctl.scaleAmount=options->getIntOption("PictureSize");
   if (ctl.scaleAmount < 10) ctl.scaleAmount=10;
   if (ctl.scaleAmount > 200) ctl.scaleAmount=200;
@@ -448,7 +448,7 @@ int VMediaView::handleCommand(int command)
       case Remote::DF_UP:
       case Remote::UP:
       case Remote::SKIPBACK:
-        rotate=WJpeg::ROT_0;
+        rotate=WJpegCmplex::ROT_0;
         showPicture(VMediaList::MV_PREV,slideshow,true);
         rt= 2;
         break;
@@ -459,7 +459,7 @@ int VMediaView::handleCommand(int command)
       case Remote::DF_DOWN:
       case Remote::DOWN:
       case Remote::SKIPFORWARD:
-        rotate=WJpeg::ROT_0;
+        rotate=WJpegComplex::ROT_0;
         showPicture(VMediaList::MV_NEXT,slideshow,true);
         rt= 2;
         break;
@@ -484,7 +484,7 @@ int VMediaView::handleCommand(int command)
       case Remote::PLAY:
       {
         slideshow=true;
-        rotate=WJpeg::ROT_0;
+        rotate=WJpegComplex::ROT_0;
         showPicture(VMediaList::MV_NEXT,slideshow,true);
         rt= 2;
       }
@@ -496,7 +496,7 @@ int VMediaView::handleCommand(int command)
         }
         else {
           slideshow=true;
-          rotate=WJpeg::ROT_0;
+          rotate=WJpegComplex::ROT_0;
           showPicture(VMediaList::MV_NEXT,slideshow,true);
         }
         rt= 2;
@@ -509,17 +509,17 @@ int VMediaView::handleCommand(int command)
         break;
       case Remote::RED:
         switch(rotate) {
-          case WJpeg::ROT_0:
+          case WJpegComplex::ROT_0:
             rotate=WJpeg::ROT_90;
             break;
-          case WJpeg::ROT_90:
-            rotate=WJpeg::ROT_180;
+          case WJpegComplex::ROT_90:
+            rotate=WJpegComplex::ROT_180;
             break;
-          case WJpeg::ROT_180:
-            rotate=WJpeg::ROT_270;
+          case WJpegComplex::ROT_180:
+            rotate=WJpegComplex::ROT_270;
             break;
-          case WJpeg::ROT_270:
-            rotate=WJpeg::ROT_0;
+          case WJpegComplex::ROT_270:
+            rotate=WJpegComplex::ROT_0;
             break;
           }
         showPicture(VMediaList::MV_NONE,slideshow,true);
@@ -532,14 +532,14 @@ int VMediaView::handleCommand(int command)
         break;
       case Remote::BLUE:
         switch (cropmode) {
-          case WJpeg::CROP:
+          case WJpegComplex::CROP:
             cropmode=WJpeg::LETTER;
             break;
-          case WJpeg::LETTER:
+          case WJpegComplex::LETTER:
             cropmode=WJpeg::CROPPERCENT;
             break;
           default:
-            cropmode=WJpeg::CROP;
+            cropmode=WJpegComplex::CROP;
             break;
         }
         showPicture(VMediaList::MV_NONE,slideshow,true);
@@ -725,7 +725,7 @@ void VMediaView::processMessage(Message* m)
         //if (! audioEnabled) {
         if (true) {
           if (slideshow) {
-            rotate=WJpeg::ROT_0;
+            rotate=WJpegComplex::ROT_0;
             showPicture(VMediaList::MV_NEXT,true,false);
             startSlideshow();
           }
@@ -859,7 +859,7 @@ int VMediaView::loadPicture(Media *md,bool activateBanner) {
      //now we can really draw
      //get the surface for drawing
      Surface * drawSurface=NULL;
-     WJpeg::JpegControl *drawCtl=NULL;
+     WJpegComplex::JpegControl *drawCtl=NULL;
      getDrawingParam(drawSurface,drawCtl);
      drawCtl->error[0]=0;
      drawCtl->rotation=rotate;
@@ -877,7 +877,7 @@ int VMediaView::loadPicture(Media *md,bool activateBanner) {
      return 0;
 #else
      //here we could hand this over to the drawing thread
-     bool ok=WJpeg::drawJpeg(drawCtl,drawSurface,reader,pictureBack);
+     bool ok=WJpegComplex::drawJpeg(drawCtl,drawSurface,reader,pictureBack);
      drawingDone(!ok);
      return ok?0:1;
 #endif
@@ -1026,10 +1026,10 @@ void VMediaView::showPictureInfo(){
   //modes should come from mediaoptions...
   const char *mode=NULL;
   switch (currentControl->mode) {
-    case WJpeg::CROPPERCENT:
+    case WJpegComplex::CROPPERCENT:
       mode="clipfactor";
       break;
-    case WJpeg::LETTER:
+    case WJpegComplex::LETTER:
       mode="letter";
       break;
     default:
@@ -1102,7 +1102,7 @@ void VMediaView::enableBanner(bool enable) {
   updatePictureBanner();
 }
 
-void VMediaView::getDrawingParam(Surface *&sfc,WJpeg::JpegControl *&c){
+void VMediaView::getDrawingParam(Surface *&sfc,WJpegComplex::JpegControl *&c){
   if (secondSurface()) {
     //we currently display on sfc2
     sfc=sfc1;
diff --git a/vmediaview.h b/vmediaview.h
index 14073e4..5ed240d 100644
--- a/vmediaview.h
+++ b/vmediaview.h
@@ -51,7 +51,7 @@ class VMediaView : public Boxx, public TimerReceiver
 {
   friend class VPReader;
   public:
-    ~VMediaView();
+    virtual ~VMediaView();
 
     void processMessage(Message* m);
     int handleCommand(int command);
@@ -117,7 +117,7 @@ class VMediaView : public Boxx, public TimerReceiver
     void updatePictureInfo();
     void destroyInfo(bool fromTimer=false);
     int  loadPicture(Media *m,bool forceBanner);
-    void getDrawingParam(Surface *&sfc,WJpeg::JpegControl *&ctl);
+    void getDrawingParam(Surface *&sfc,WJpegComplex::JpegControl *&ctl);
     void switchSurface(); //will switch surface and currentControl
     void drawingDone(bool hasError);
 
@@ -133,17 +133,17 @@ class VMediaView : public Boxx, public TimerReceiver
     const char * pictureError;
     Media * currentPicture;
     const static int INITIAL_SHOWTIME=5;
-    WJpeg::Rotation rotate;
-    WJpeg::ScaleMode cropmode;
+    WJpegComplex::Rotation rotate;
+    WJpegComplex::ScaleMode cropmode;
     VInfo * info;
     static Colour pictureBack;
     static Colour infoBack;
     static Colour audioBannerBack;
     int currentScale;
     MediaOptions *options;
-    WJpeg::JpegControl ctl;
-    WJpeg::JpegControl ctl2;
-    WJpeg::JpegControl *currentControl;
+    WJpegComplex::JpegControl ctl;
+    WJpegComplex::JpegControl ctl2;
+    WJpegComplex::JpegControl *currentControl;
     Surface *sfc1;
     Surface *sfc2;
     //which is the active surface
-- 
2.39.5