]> git.vomp.tv Git - vompclient.git/commitdiff
Clean up screenShot() - all params, return types, function names
authorChris Tallon <chris@vomp.tv>
Thu, 21 May 2020 15:14:28 +0000 (16:14 +0100)
committerChris Tallon <chris@vomp.tv>
Thu, 21 May 2020 15:14:28 +0000 (16:14 +0100)
21 files changed:
osd.h
osddirectfb.cc
osddirectfb.h
osdopengl.cc
osdopengl.h
osdopenvg.cc
osdopenvg.h
osdvector.cc
osdvector.h
osdwinpixel.cc
osdwinpixel.h
osdwinvector.cc
osdwinvector.h
surface.h
surfacedirectfb.cc
surfacedirectfb.h
surfaceopengl.cc
surfaceopengl.h
surfacevector.h
surfacewin.cc
surfacewin.h

diff --git a/osd.h b/osd.h
index 003a33d7041fc810052ec63390e4eb751c5ed9e7..1aa473f542bcdb61958722ec879a89c0d8e534c5 100644 (file)
--- a/osd.h
+++ b/osd.h
@@ -39,7 +39,7 @@ class Osd
 
     bool isInitted() { return initted; };
 
-    virtual void screenShot(const char* fileName)=0;
+    virtual bool screenShot(const char* fileName)=0;
 
     virtual int getFontNames(const char*** /* names */,const char*** /* names_keys */) { return 0; };
     virtual void setFont(const char* /* fontname */) {};
index 923318c85e8a765e494688cbba23b481eba8012b..826cbf6d8bbba20f1b58222c8f39b71bcf27024d 100644 (file)
@@ -94,7 +94,7 @@ int OsdDirectFB::shutdown()
   return 1;
 }
 
-void OsdDirectFB::screenShot(char* fileName)
+bool OsdDirectFB::screenShot(const char* fileName)
 {
-  screen->screenShot(fileName);
+  return screen->screenShot(fileName);
 }
index 48caf7051c1c1d957f0eb3a24be60e62d0bd2553..7814cfdcdd97438d90e552173180e5bbfd624162 100644 (file)
@@ -42,7 +42,7 @@ class OsdDirectFB : public Osd
     int init();
     int shutdown();
 
-    void screenShot(char* fileName);
+    bool screenShot(const char* fileName);
     
     IDirectFB* getDfb() {return dfb;};
     IDirectFBDisplayLayer* getOsdLayer(){return osd_layer;};
index 9f0d9a0ec353dcf0d0f1b09dce370d8f862d5ab3..f7f26432f51468e6bc79b35fada9c2e8d283e069 100644 (file)
@@ -292,11 +292,12 @@ int OsdOpenGL::shutdown()
   return 1;
 }
 
-void OsdOpenGL::screenShot(const char* fileName)
+bool OsdOpenGL::screenShot(const char* fileName)
 {
   BeginPainting();
-  screen->screenShot(fileName);
+  bool ret = screen->screenShot(fileName);
   EndPainting();
+  return ret;
 }
 
 void OsdOpenGL::threadMethod()
index 867956ebc1b2d8f1387653a595557bea6ab26799..730d0c54508c6964170c4170908657d56c40377b 100644 (file)
@@ -61,7 +61,7 @@ class OsdOpenGL : public Osd, public Thread_TYPE
     int init();
     int shutdown();
 
-    void screenShot(const char* fileName);
+    bool screenShot(const char* fileName);
 
     Surface * createNewSurface();
 
index 25f1e54b124a5d086b23a16db6d85ca3ccbf347c..c79eaa5510e7f5243238767f177592cb908e7e4e 100644 (file)
@@ -645,7 +645,7 @@ void OsdOpenVG::getRealScreenSize(int& width, int& height)
   height = display_height;
 }
 
-bool OsdOpenVG::screenShot(void* buffer, int width, int height, bool osd /*include osd*/)
+bool OsdOpenVG::screenShotInternal(void* buffer, int width, int height, bool includeOSD)
 {
   if (!initted) return false;
 
@@ -659,7 +659,7 @@ bool OsdOpenVG::screenShot(void* buffer, int width, int height, bool osd /*inclu
   res = vc_dispmanx_resource_create(VC_IMAGE_RGBA32, width, height, &image_ptr);
   display = vc_dispmanx_display_open(0);
 
-  if (!osd)
+  if (!includeOSD)
   {
     vc_dispmanx_snapshot(display, res,
                          static_cast<DISPMANX_TRANSFORM_T>(DISPMANX_SNAPSHOT_NO_RGB | DISPMANX_SNAPSHOT_FILL/*|DISPMANX_SNAPSHOT_PACK*/));
index 4c1b5542202185720f85dc4c9c3f999b2fec7548..45e9915eda56d2ed914948be76362ff4b4d18015 100644 (file)
@@ -88,7 +88,7 @@ class OsdOpenVG : public OsdVector
     int shutdown();
     int stopUpdate();
 
-    bool screenShot(void* buffer, int width, int height, bool osd /*include osd*/);
+    bool screenShotInternal(void* buffer, int width, int height, bool includeOSD);
 
     float getFontHeight();
     float getCharWidth(wchar_t c);
index 57796377e1d35c91e5aae133efa30234c0cf2ddc..74f783f1cf32cc4f443094c7a34a0d255636c80f 100644 (file)
@@ -119,7 +119,7 @@ OsdVector::OsdVector()
 #endif
 }
 
-void OsdVector::screenShot(const char* fileName)
+bool OsdVector::screenShot(const char* fileName)
 {
   //Do nothing, if no libmagick is there
 #ifdef PICTURE_DECODER_MAGICK
@@ -132,11 +132,11 @@ void OsdVector::screenShot(const char* fileName)
   {
     Blob myblob;
 
-    if (!screenShot(mem, width, height, true))
+    if (!screenShotInternal(mem, width, height, true))
     {
       Log::getInstance()->log("OsdVector", Log::DEBUG, "Screenshot failed!");
       free(mem);
-      return;
+      return false;
     }
 
     myblob.updateNoCopy(mem, length, Blob::MallocAllocator);
@@ -146,10 +146,12 @@ void OsdVector::screenShot(const char* fileName)
   catch ( Exception& error_ )
   {
     Log::getInstance()->log("MagickEncoder", Log::DEBUG, "Libmagick: %s", error_.what());
-
+    return false;
   }
 
+  return true;
 #endif
+  return false;
 }
 
 Surface* OsdVector::createNewSurface()
index 713879e64f81a5b7b746c2c894d1a416f095aeaf..34b62239bae43871f389801bab118a214459b5df 100644 (file)
@@ -214,8 +214,8 @@ class OsdVector : public Osd
 
     int restore();
 
-    void screenShot(const char* fileName);
-    virtual bool screenShot(void* buffer, int width, int height, bool osd /*include osd*/) = 0;
+    bool screenShot(const char* fileName);
+    virtual bool screenShotInternal(void* buffer, int width, int height, bool osd /*include osd*/) = 0;
 
     Surface* createNewSurface();
 
index e4cc117a6fcf5968fdf6dbee074baa8a6ffd5dbb..aba06e65610eb1286023282a1f962b77179c1cd2 100644 (file)
@@ -84,9 +84,9 @@ int OsdWinPixel::shutdown()
   return 1;
 }
 
-void OsdWinPixel::screenShot(const char* fileName)
+bool OsdWinPixel::screenShot(const char* fileName)
 {
-  screen->screenShot(fileName);
+  return screen->screenShot(fileName);
 }
 
 LPDIRECT3DTEXTURE9 OsdWinPixel::getNextOsdTexture()
index caf332196dc73f6f723d20950cedd3aeddc272ba..190a40b0760f14df15997d42c674557eaf0bfd50 100644 (file)
@@ -41,7 +41,7 @@ class OsdWinPixel : public Osd, public WindowsOsd
 
        bool isInitialized() { return initted; }
 
-    void screenShot(const char* fileName);
+    bool screenShot(const char* fileName);
 
     Surface * createNewSurface();
 
index 612d4d768d067b9fc76b35f718c0ac5ae94ebece..1f60b9e4e3ee828bd8b9343c25fbe13368a5d554 100644 (file)
@@ -1081,7 +1081,7 @@ void OsdWinVector::getRealScreenSize(int &width, int &height)
        height = BACKBUFFER_HEIGHT;
 }
 
-bool OsdWinVector::screenShot(void *buffer, int width, int height, bool osd /*include osd*/
+bool OsdWinVector::screenShotInternal(void *buffer, int width, int height, bool includeOSD
 {
   //screen->screenShot(fileName);
        return false;
index 8318d96ac5150538a37b61a99602d5310621f5c4..3dea77a051aa9e400d7ee209575955a42f518dae 100644 (file)
@@ -53,7 +53,7 @@ class OsdWinVector : public OsdVector, public WindowsOsd
        float getFontHeight();
        float getCharWidth(wchar_t c);
 
-       bool screenShot(void *buffer, int width, int height, bool osd /*include osd*/);
+       bool screenShotInternal(void *buffer, int width, int height, bool includeOSD);
 
        int getFontNames(const char *** names, const char *** names_keys);
 
index a826d69a00042769df6367b01c0a4e8ae4a99821..ac75917a4fbce703ce23272418f7e457aaef2c5c 100644 (file)
--- a/surface.h
+++ b/surface.h
@@ -90,7 +90,7 @@ public:
     virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, DrawStyle& nextColour);
     virtual int updateToScreen(int sx, int sy, int w, int h, int dx, int dy)=0;
     virtual void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)=0;
-    virtual void screenShot(const char* fileName)=0;
+    virtual bool screenShot(const char* fileName)=0;
 
     /* This is for system which need a locking of the drawing surface to speed up drawing */
     virtual void startFastDraw() {};
index 7bcf3ebe7e6294de206308febfad2bd98154bee8..2a426c45fea7d875e590a6aa860b9c755de2eac1 100644 (file)
@@ -291,10 +291,9 @@ int SurfaceDirectFB::blt(int fd, unsigned long shandle, int sx, int sy, int widt
   return 0;
 }
 
-void SurfaceDirectFB::screenShot(const char* fileName)
+bool SurfaceDirectFB::screenShot(const char* fileName)
 {
-  return;
-  
+  return false;
 }
 
 void SurfaceDirectFB::readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)
index e9a3fff7c7e51e7e2ad522b332030979a6f414c0..373db83fed7fce0e3448adf11ca5cbe81895b08f 100644 (file)
@@ -56,7 +56,7 @@ class SurfaceDirectFB : public Surface
     void drawBitmap(int x, int y, const Bitmap& bm);
     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);
+    bool screenShot(const char* fileName);
     IDirectFBSurface* getSurfaceDFB(){return surface;};
 
 
index ed8fb3c76eea27e557e1a7c7f7d85e11a12d6408..5d3d79a4a5aa5a0f5e6d78d863e24f94c2355a41 100644 (file)
@@ -243,9 +243,10 @@ int SurfaceOpenGL::blt(int fd, unsigned long shandle, int sx, int sy, int width,
   return 0;
 }
 
-void SurfaceOpenGL::screenShot(const char* fileName)
+bool SurfaceOpenGL::screenShot(const char* fileName)
 {
   //Isn't this for debugging only, so I won't implement it yet
+  return false;  
 }
 
 void SurfaceOpenGL::readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)
index a3bec72be8532e95b5daf60eb35cc177928453ad..da679899ba5fc99b6424747c8d19be146720fa11 100644 (file)
@@ -45,7 +45,7 @@ class SurfaceOpenGL : public Surface
     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);
+    bool screenShot(const char* fileName);
   void ReleaseSurface();
     int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy);
   void drawJpeg(const char *fileName,int x, int y,int *width, int *height);
index 5c23ebbd0f4d36d6f8c885749266d4ec5ed61e70..e523023c3d79ebca6c88f758cfbf7b85a5373a82 100644 (file)
@@ -64,8 +64,8 @@ class SurfaceVector : public Surface
 
     void drawTTChar(int ox, int oy, int x, int y, cTeletextChar c);
 
-    void readPixel(int /* x */, int /* y */, unsigned char* /* r */, unsigned char* /* g */, unsigned char* /* b */) {};
-    void screenShot(const char* /* fileName */) {};
+    void readPixel(int /* x */, int /* y */, unsigned char* /* r */, unsigned char* /* g */, unsigned char* /* b */) {}
+    bool screenShot(const char* /* fileName */) { return false; }
 
   protected:
 
index da1d323e470f6524f5afd2b79bc0e89ef21ce3fa..126f50d60a00d80f3971179b244eccab4c986363 100644 (file)
@@ -281,9 +281,10 @@ int SurfaceWin::blt(int fd, unsigned long shandle, int sx, int sy, int width, in
   return 0;
 }
 
-void SurfaceWin::screenShot(const char* fileName)
+bool SurfaceWin::screenShot(const char* fileName)
 {
   //Isn't this for debugging only, so I won't implement it yet
+  return false;
 }
 
 void SurfaceWin::readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)
index 5be38cf715b7da7abf431b2714cab060f75b6a05..7e5f6d5d787977b41f9c8f87f22979d8a4bfb573 100644 (file)
@@ -44,7 +44,7 @@ class SurfaceWin : public Surface
     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);
+    bool screenShot(const char* fileName);
   void ReleaseSurface();
     int blt(int fd, unsigned long shandle, int sx, int sy, int width, int height, unsigned long dhandle, int dx, int dy);
   void drawJpeg(const char *fileName,int x, int y,int *width, int *height);