]> git.vomp.tv Git - vompclient.git/commitdiff
Reshuffle OsdVector header a bit
authorChris Tallon <chris@vomp.tv>
Mon, 11 May 2020 22:51:03 +0000 (23:51 +0100)
committerChris Tallon <chris@vomp.tv>
Mon, 11 May 2020 22:51:03 +0000 (23:51 +0100)
osdvector.cc
osdvector.h

index e662afcaa0c902380380057fc92739295915ebd5..3cfad72120f74c24f73f8b3498c717ac70c132a7 100644 (file)
@@ -117,11 +117,6 @@ OsdVector::OsdVector()
 #ifdef PICTURE_DECODER_MAGICK
   reader.addDecoder(new MagickDecoder(&reader));
 #endif
-
-  for (int i = 0; i < 256; i++)
-  {
-    byte_char_width[i] = 0.f;
-  }
 }
 
 void OsdVector::screenShot(const char* fileName)
index 6695e99bec481e06b9f452177a6b7bdd85bbb600..269651cc4867d547d58596408c01b07a81e4a9cf 100644 (file)
@@ -17,9 +17,9 @@
     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
-
 #ifndef OSDVECTOR_H
 #define OSDVECTOR_H
+
 #include <set>
 #include <list>
 #include <vector>
@@ -34,7 +34,6 @@
 #include "colour.h"
 #include "tvmedia.h"
 #include "vdr.h"
-
 #include "teletextdecodervbiebu.h"
 
 enum SVGCommandInstr
@@ -47,6 +46,7 @@ enum SVGCommandInstr
   DrawClipping,
   DrawImageLoading
 };
+
 enum PathIndex
 {
   PIHorzLine,
@@ -66,19 +66,12 @@ enum Corner
   TopLeftLimited
 };
 
-typedef  VectorHandle ImageIndex;
+typedef VectorHandle ImageIndex;
 typedef unsigned long long LoadIndex;
 
 class SVGCommand
 {
   public:
-    SVGCommand()
-    {
-      instr = DrawNoop;
-      x = y = w = h = 0;
-      reference = VECTOR_HANDLE_INIT;
-    };
-
     inline static SVGCommand PaintPath(float ix, float iy, float iw, float ih, PathIndex path, VectorHandle ref)
     {
       SVGCommand nc;
@@ -120,8 +113,6 @@ class SVGCommand
       return nc;
     };
 
-
-
     inline static SVGCommand PaintTTchar(float ix, float iy, float iw, float ih, unsigned int ttchar_in)
     {
       SVGCommand nc;
@@ -135,6 +126,7 @@ class SVGCommand
       nc.corner = TopLeft;
       return nc;
     };
+
     inline static SVGCommand PaintClipping(float ix, float iy, float iw, float ih)
     {
       SVGCommand nc;
@@ -148,7 +140,6 @@ class SVGCommand
       return nc;
     };
 
-
     inline static void PaintGlyph(SVGCommand& nc, float ix, float iy, wchar_t char_in, VectorHandle ref)
     {
       nc.instr = DrawGlyph;
@@ -164,41 +155,46 @@ class SVGCommand
     {
       return (x >= tx) && (y >= ty) && ((x + w) <= (tx + tw)) && ((y + h) <= (ty + th));
     }
+
     bool TTTest(float tox, float toy, float tx, float ty)
     {
       return (x == tox) && (toy == y) && (w == tx) && (h == ty);
     }
+
     bool Outside(float tx, float ty, float tw, float th)
     {
       return ((x + w) < tx) || ((y + h) < ty) || ((tx + tw) < x) || ((ty + th) < y);
     }
 
-    VectorHandle getRef() { return reference; };
+    VectorHandle getRef()
+    {
+      return reference;
+    };
+
     ImageIndex getImageIndex()
     {
       if (instr != DrawImage) return 0;
       else return target.image;
     };
+
     LoadIndex getLoadIndex()
     {
       if (instr != DrawImageLoading) return 0;
       else return target.loadindex;
     };
 
-    SVGCommandInstr instr;
+    SVGCommandInstr instr{DrawNoop};
     Corner corner;
-    float x, y, w, h;
-    VectorHandle reference;
+    float x{}, y{}, w{}, h{};
+    VectorHandle reference{VECTOR_HANDLE_INIT};
     union
     {
-      PathIndex path_index; //path_index
+      PathIndex path_index;
       wchar_t textchar;
       ImageIndex image;
       unsigned int ttchar;
       LoadIndex loadindex;
     } target;
-
-
 };
 
 class SurfaceVector;
@@ -211,7 +207,6 @@ struct SurfaceInfo
   float x, y, w, h;
 };
 
-
 class OsdVector : public Osd
 {
   public:
@@ -254,8 +249,6 @@ class OsdVector : public Osd
     void informPicture(LoadIndex index, ImageIndex i_index);
 
 
-
-
     int charSet() {return 2;}; //UTF-8
 
 
@@ -306,30 +299,20 @@ class OsdVector : public Osd
     class PictureReader: public Thread_TYPE
     {
       public:
-
         ~PictureReader();
-
         void init();
         void addDecoder(PictureDecoder*);
         void removeDecoder(PictureDecoder*);
-
         void shutdown();
-
-
         bool processReceivedPictures();
 
         // should be called from control thread
         void receivePicture(VDR_ResponsePacket* vresp);
 
         void addStaticImage(unsigned int id);
-
         void invalidateLoadIndex(LoadIndex index);
-
         void informFallback(LoadIndex index, int fallback);
 
-
-
-
       protected:
 
         void threadMethod();
@@ -343,52 +326,24 @@ class OsdVector : public Osd
         std::set<LoadIndex> invalid_loadindex;
 
         bool picture_update;
-
     };
 
-    PictureReader* getPictReader() { return &reader;};
-
-
+    PictureReader* getPictReader() { return &reader; };
 
   protected:
 
     PictureReader reader;
 
-    void incImageRef(ImageIndex index);
-    int getImageRef(ImageIndex index);
-    virtual void destroyImageRef(ImageIndex index) = 0;
-    void incLoadIndexRef(LoadIndex index);
-    int getLoadIndexRef(LoadIndex index);
-
-
-    //virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0;
-    virtual ImageIndex createMonoBitmap(void* base, int width, int height) = 0;
-    virtual ImageIndex createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data) = 0;
-    virtual void createPicture(struct PictureInfo& pict_inf) = 0;
-
-    virtual LoadIndex loadTVMedia(TVMediaInfo& tvmedia);
-
-
-
     std::map<ImageIndex, int> images_ref;
     std::map<void*, ImageIndex> monobitmaps;
     //map<string,ImageIndex> jpegs;
     std::map<TVMediaInfo, ImageIndex> tvmedias;
     std::list<ImageIndex> palettepics;
-
-
-
     std::map<LoadIndex, int> loadindex_ref;
     std::map<TVMediaInfo, LoadIndex> tvmedias_load;
     std::map<LoadIndex, TVMediaInfo> tvmedias_load_inv;
     std::map<LoadIndex, ImageIndex> tvmedias_loaded;
 
-
-
-    void incrementStyleRefCount(VectorHandle index);
-    virtual void destroyStyleRef(VectorHandle index) = 0;
-
-
     std::map<DrawStyle, VectorHandle> styles;
     std::map<VectorHandle, int> styles_ref;
     std::map<DrawStyle, VectorHandle>::iterator styles_lastit;
@@ -396,24 +351,37 @@ class OsdVector : public Osd
     std::map<VectorHandle, int>::iterator styles_ref_lastit;
     bool styles_ref_lastit_valid{};
 
-    virtual VectorHandle createStyleRef(const DrawStyle& c) = 0;
+    std::list<SurfaceInfo> surfaces;
+    using SurfacesIterator = std::list<SurfaceInfo>::iterator;
 
-    void decrementAllRefCounts(std::vector<SVGCommand>& commands);
-    void incrementAllRefCounts(std::vector<SVGCommand>& commands);
-    void cleanupOrphanedRefs();
+    std::mutex surfaces_mutex;
 
+    float byte_char_width[256]{};
 
+    void incImageRef(ImageIndex index);
+    int getImageRef(ImageIndex index);
+    virtual void destroyImageRef(ImageIndex index) = 0;
+    void incLoadIndexRef(LoadIndex index);
+    int getLoadIndexRef(LoadIndex index);
 
-    virtual void drawSetTrans(SurfaceInfo& sc) = 0;
-    virtual void executeDrawCommand(SVGCommand& command) = 0;
+    //virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0;
+    virtual ImageIndex createMonoBitmap(void* base, int width, int height) = 0;
+    virtual ImageIndex createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data) = 0;
+    virtual void createPicture(struct PictureInfo& pict_inf) = 0;
 
+    virtual LoadIndex loadTVMedia(TVMediaInfo& tvmedia);
 
-    std::list<SurfaceInfo> surfaces;
-    using SurfacesIterator = std::list<SurfaceInfo>::iterator;
+    void incrementStyleRefCount(VectorHandle index);
+    virtual void destroyStyleRef(VectorHandle index) = 0;
 
-    std::mutex surfaces_mutex;
+    virtual VectorHandle createStyleRef(const DrawStyle& c) = 0;
 
-    float byte_char_width[256];
+    void decrementAllRefCounts(std::vector<SVGCommand>& commands);
+    void incrementAllRefCounts(std::vector<SVGCommand>& commands);
+    void cleanupOrphanedRefs();
+
+    virtual void drawSetTrans(SurfaceInfo& sc) = 0;
+    virtual void executeDrawCommand(SVGCommand& command) = 0;
 
     void drawSurfaces();
 };