]> git.vomp.tv Git - vompclient.git/commitdiff
Improved background color/gradient handling and radio recording menu
authorMarten Richter <marten.richter@freenet.de>
Sat, 4 Apr 2015 12:27:53 +0000 (14:27 +0200)
committerMarten Richter <marten.richter@freenet.de>
Sat, 4 Apr 2015 12:27:53 +0000 (14:27 +0200)
command.cc
osdopenvg.cc
osdopenvg.h
osdvector.h
recording.cc
vradiorec.cc
vradiorec.h
vvideolivetv.cc
vvideorec.cc

index 24cd8152b8725de90c39929e8065b4419bf83948..121c11f6e35ba63bdd6fe592c011747daa11b90a 100644 (file)
@@ -181,6 +181,12 @@ void Command::doWallpaper()
        boxstack->add(wallpaper);
        boxstack->update(wallpaper);
 
+    OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
+    if (osdv)
+    {
+         osdv->updateBackgroundColor(DrawStyle::WALLPAPER);
+    }
+
 
 
 }
index 584d337e2dbaee75219ccf547cd42d150a75c466..f034b1457766fbebfd767618ded1dc56240f66b7 100644 (file)
@@ -58,6 +58,8 @@ OsdOpenVG::OsdOpenVG()
   mode=0;
   aspect_correction=1.;
 
+  bcm_backres=NULL;
+
   freetype_inited=false;
   wait_id=1;
   const char *fontname="Droid Sans:style=Regular";
@@ -192,23 +194,11 @@ int OsdOpenVG::init(void* device)
 
    uint32_t back_image_ptr;
    bcm_backres=vc_dispmanx_resource_create(VC_IMAGE_RGBX32,16,16,&back_image_ptr);
-   unsigned int color[16*16];
-   DrawStyle bg=DrawStyle::WALLPAPER;
-   if (bg.ft!=DrawStyle::GradientLinear) {
-          bg.grad_col[0]=bg;
-   }
-   //memset(color,0xFF,sizeof(unsigned int)*4*8);
-   for (int j=0;j<16;j++) {
-          int helpr=(((15-j)*bg.red)+(j*bg.grad_col[0].red))/15;
-          int helpb=(((15-j)*bg.blue)+(j*bg.grad_col[0].blue))/15;
-          int helpg=(((15-j)*bg.green)+(j*bg.grad_col[0].green))/15;
-          //unsigned int cur_col=help | (help<< 8)  | (help<< 16)  | (0xFF<< 24);
-          unsigned int cur_col=helpr  | (helpg<< (8))  | (helpb<< (16))  | (0xFF<< (24));
-          for (int i=0;i<16;i++) {
-                  color[i+16*j]=cur_col;
-          }
-   }
-   vc_dispmanx_resource_write_data(bcm_backres,VC_IMAGE_RGBX32,16*4,color,&src_rect_im);
+
+
+   updateBackgroundColor(DrawStyle::WALLPAPER);
+
+
 
    DISPMANX_UPDATE_HANDLE_T  bcm_update;
    bcm_display=vc_dispmanx_display_open(0);
@@ -333,6 +323,29 @@ int OsdOpenVG::init(void* device)
   return 1;
 }
 
+void OsdOpenVG::updateBackgroundColor(DrawStyle bg)
+{
+       unsigned int color[16*16];
+       if (!bcm_backres) return;
+       VC_RECT_T src_rect_im={0,0,16,16};
+
+       if (bg.ft!=DrawStyle::GradientLinear) {
+               bg.grad_col[0]=bg;
+       }
+       //memset(color,0xFF,sizeof(unsigned int)*4*8);
+       for (int j=0;j<16;j++) {
+               int helpr=(((15-j)*bg.red)+(j*bg.grad_col[0].red))/15;
+               int helpb=(((15-j)*bg.blue)+(j*bg.grad_col[0].blue))/15;
+               int helpg=(((15-j)*bg.green)+(j*bg.grad_col[0].green))/15;
+               //unsigned int cur_col=help | (help<< 8)  | (help<< 16)  | (0xFF<< 24);
+               unsigned int cur_col=helpr  | (helpg<< (8))  | (helpb<< (16))  | (0xFF<< (24));
+               for (int i=0;i<16;i++) {
+                       color[i+16*j]=cur_col;
+               }
+       }
+       vc_dispmanx_resource_write_data(bcm_backres,VC_IMAGE_RGBX32,16*4,color,&src_rect_im);
+}
+
 void OsdOpenVG::getScreenSize(int &width, int &height)
 {
        width=BACKBUFFER_WIDTH;
@@ -524,6 +537,7 @@ int OsdOpenVG::shutdown()
   vc_dispmanx_element_remove(bcm_update,bcm_background);
   vc_dispmanx_update_submit_sync(bcm_update);
   vc_dispmanx_resource_delete(bcm_backres);
+  bcm_backres=NULL;
   vc_dispmanx_display_close(bcm_display);
 
 
index 2367cbe9a76635fcc23ccb409f6f092eed8f1900..77d75cb9ca81739f3567b291c78be945dc67957c 100644 (file)
@@ -102,6 +102,8 @@ class OsdOpenVG : public OsdVector, public Thread_TYPE, public EGLPictureCreator
 
     bool getEGLPicture(struct OsdVector::PictureInfo & info, EGLDisplay * display);
 
+    void updateBackgroundColor(DrawStyle bg);
+
 
 protected:
 
index 5bb45de022f5d09b74de5bf25a214b1463bd8ec5..41935b20850fd88c6adcb8bd401dd8f81b1d5383 100644 (file)
@@ -220,6 +220,7 @@ class OsdVector : public Osd
     Surface * createNewSurface();
 
        void Blank();
+       virtual void updateBackgroundColor(DrawStyle bg) {};
 
        void updateOrAddSurface(const SurfaceVector *surf,float x,float y,float height,float width,
                        std::vector<SVGCommand>& commands);
@@ -415,4 +416,4 @@ protected:
 
 
 
-#endif
\ No newline at end of file
+#endif
index 83e8ee3a852e5938d4d2402d995c0dd3f8097dec..374f3ff6e46aad021c0c0042ae9184c4bb7a9626 100644 (file)
@@ -128,7 +128,6 @@ void Recording::loadRecInfo()
   seriesInfo = NULL;
   movieID = 0;
   seriesID =0;
-
   vdr->getScraperEventType(fileName, movieID, seriesID, episodeID);
   Log::getInstance()->log("Recording", Log::DEBUG, "Got Scraper EventType %d %d %d",
                  movieID, seriesID, episodeID);
index 5575b63ea3d57d7fac3f2bb27bf3a3a6db0b1032..04f2cc3e03ae8c5d45cfa09d9ea76c67761acc8e 100644 (file)
@@ -75,6 +75,8 @@ VRadioRec::VRadioRec(Recording* rec)
 
   setSize(video->getScreenWidth(), video->getScreenHeight());
   createBuffer();
+  transparent.set(0, 0, 0, 0);
+  setBackgroundColour(transparent);
   setPosition(0, 0);
 
   barRegion.x = 0;
@@ -88,7 +90,7 @@ VRadioRec::VRadioRec(Recording* rec)
   clocksRegion.h = getFontHeight();
 
 
-  barBlue.set(0, 0, 150, 150);
+  barBlue.set(0, 0, 0, 128);
 
   barShowing = false;
 }
@@ -112,7 +114,7 @@ VRadioRec::~VRadioRec()
 
 void VRadioRec::draw()
 {
-  fillColour(DrawStyle::BLACK);
+  fillColour(transparent);
 }
 
 void VRadioRec::go()
@@ -541,7 +543,7 @@ void VRadioRec::removeBar()
   if (!barShowing) return;
   timers->cancelTimer(this, 2);
   barShowing = false;
-  rectangle(barRegion, DrawStyle::BLACK);
+  rectangle(barRegion, transparent);
   boxstack->update(this, &barRegion);
 }
 
index 70bf3ece8c535f02f765fa0cb31c8e15e97ed8b0..543fb08db43a30ce376f99b9cdf74b5182729435 100644 (file)
@@ -59,6 +59,7 @@ class VRadioRec : public Boxx, public TimerReceiver
     BoxStack* boxstack;
 
     DrawStyle barBlue;
+    DrawStyle transparent;
 
     bool playing;
     bool barShowing;
index 552c853f393df9fd8167d1071c9360ac4f24f9a2..d140d24b4e5b8db380d8d1ccc3ed686c4b3df729 100644 (file)
@@ -305,6 +305,11 @@ VVideoLiveTV::~VVideoLiveTV()
   delete player;
   video->setDefaultAspect();
   delData();
+  OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
+  if (osdv)
+  {
+         osdv->updateBackgroundColor(DrawStyle::WALLPAPER);
+  }
 }
 
 void VVideoLiveTV::delData()
@@ -1140,6 +1145,12 @@ void VVideoLiveTV::processMessage(Message* m)
         }
 #endif
         
+        OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
+        if (osdv)
+        {
+         osdv->updateBackgroundColor(DrawStyle::BLACK);
+        }
+
         sAspectRatio.nextSymbol = WSymbol::VIDEOASPECT43;
         sAspectRatio.setVisible(true);
         
@@ -1166,6 +1177,13 @@ void VVideoLiveTV::processMessage(Message* m)
         sAspectRatio.nextSymbol = WSymbol::VIDEOASPECT169;
         sAspectRatio.setVisible(true);
 
+        OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
+        if (osdv)
+        {
+         osdv->updateBackgroundColor(DrawStyle::WALLPAPER);
+        }
+
+
         if (osd.getVisible()) // don't wake up the whole osd just for a aspect change
         {
           osd.draw();
index 3cc7c9d058d8e21ea52c1973a2de62f48bbfbc3e..8fca5896c0687cfa2457cd044703784b7da1818a 100644 (file)
@@ -93,6 +93,12 @@ VVideoRec::VVideoRec(Recording* rec, bool ish264)
   transparent.set(0, 0, 0, 0);
   setBackgroundColour(transparent);
 
+  OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
+  if (osdv)
+  {
+         osdv->updateBackgroundColor(DrawStyle::BLACK);
+  }
+
   barRegion.x = 0;
   barRegion.y = video->getScreenHeight() - 58;   // FIXME, need to be - 1? and below?
   barRegion.w = video->getScreenWidth();
@@ -167,6 +173,12 @@ VVideoRec::~VVideoRec()
   myRec->dropRecInfo();
   // FIXME - do this properly - save the resume point back to the server manually and update
   // rec->recInfo->resumePoint - this will fix the ~10s offset problem as well
+
+  OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
+  if (osdv)
+  {
+         osdv->updateBackgroundColor(DrawStyle::WALLPAPER);
+  }
 }
 
 void VVideoRec::go(bool resume)