]> git.vomp.tv Git - vompclient.git/commitdiff
Rename some methods and variables
authorChris Tallon <chris@vomp.tv>
Fri, 15 May 2020 17:08:32 +0000 (18:08 +0100)
committerChris Tallon <chris@vomp.tv>
Fri, 15 May 2020 17:08:32 +0000 (18:08 +0100)
* styles -> drawstyleHandles
* styles_lastit -> drawstyleHandles_lastit
* styles_lastit_valid -> drawstyleHandles_lastit_valid
* styles_ref -> drawstyleHandlesRefCounts
* styles_ref_lastit -> drawstyleHandlesRefCounts_lastit
* styles_ref_lastit_valid -> drawstyleHandlesRefCounts_lastit_valid
* getStyleRef -> getDrawStyleHandle
* destroyStyleRef -> destroyDrawStyleHandle
* createStyleRef -> createDrawStyleHandle
* incrementStyleRefCount -> incrementDrawStyleHandleRefCount
* decrementStyleRefCount -> decrementDrawStyleHandleRefCount

osdopenvg.cc
osdopenvg.h
osdvector.cc
osdvector.h
osdwinvector.cc
osdwinvector.h
surfacevector.cc

index d416b197f30aab3dbd489ade58e40959d8747095..faa4c436e4a53e2e8063729af3db2559caf4d56f 100644 (file)
@@ -506,7 +506,7 @@ int OsdOpenVG::stopUpdate()
 void OsdOpenVG::purgeAllReferences()
 {
        images_ref.clear();
-       styles_ref.clear(); // remove all references
+       drawstyleHandlesRefCounts.clear(); // remove all references
 
 
        map<void *,ImageIndex>::iterator mitty=monobitmaps.begin();
@@ -530,12 +530,12 @@ void OsdOpenVG::purgeAllReferences()
        }
        tvmedias.clear();
 
-       map<pair<Colour*,unsigned int>,unsigned int>::iterator sitty=styles.begin();
-       while (sitty!=styles.end()) {
+       map<pair<Colour*,unsigned int>,unsigned int>::iterator sitty=drawstyleHandles.begin();
+       while (sitty!=drawstyleHandles.end()) {
                vgDestroyPaint((VGPaint)(*sitty).second);
                sitty++;
        }
-       styles.clear();
+       drawstyleHandles.clear();
 
 }*/
 
@@ -1799,7 +1799,7 @@ ImageIndex OsdOpenVG::createImagePalette(int width, int height, const unsigned c
   return putOpenVGCommand(comm, true);
 }
 
-void OsdOpenVG::destroyStyleRef(VectorHandle index)
+void OsdOpenVG::destroyDrawStyleHandle(VectorHandle index)
 {
   struct OpenVGCommand comm;
   comm.task = OVGdestroyPaint;
@@ -1807,7 +1807,7 @@ void OsdOpenVG::destroyStyleRef(VectorHandle index)
   putOpenVGCommand(comm, false);
 }
 
-VectorHandle OsdOpenVG::createStyleRef(const DrawStyle& c)
+VectorHandle OsdOpenVG::createDrawStyleHandle(const DrawStyle& c)
 {
   unsigned int col = c.rgba();
   struct OpenVGCommand comm;
index a06182e0aabda39d9f4c36128e53192f4cab8a43..4a3711cf18d2a1b70d8a2111309252dfde3849c5 100644 (file)
@@ -117,8 +117,8 @@ class OsdOpenVG : public OsdVector, public Thread_TYPE
     ImageIndex createMonoBitmap(void* base, int width, int height);
     ImageIndex createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data);
     void createPicture(struct PictureInfo& pict_inf);
-    void destroyStyleRef(VectorHandle index);
-    VectorHandle createStyleRef(const DrawStyle& c);
+    void destroyDrawStyleHandle(VectorHandle index);
+    VectorHandle createDrawStyleHandle(const DrawStyle& c);
     bool getStaticImageData(unsigned int static_id, UCHAR** userdata, ULONG* length);
 
     void drawSetTrans(SurfaceInfo& sc);
index 3cfad72120f74c24f73f8b3498c717ac70c132a7..2994fa82f73e6d0894c36ee28485d0485b69ea43 100644 (file)
@@ -178,9 +178,9 @@ int OsdVector::restore()
   images_ref.clear();
   monobitmaps.clear();
   //jpegs.clear();
-  styles.clear();
-  styles_ref.clear();
-  styles_lastit_valid = styles_ref_lastit_valid = false;
+  drawstyleHandles.clear();
+  drawstyleHandlesRefCounts.clear();
+  drawstyleHandles_lastit_valid = drawstyleHandlesRefCounts_lastit_valid = false;
   palettepics.clear();
 
   tvmedias.clear();
@@ -344,7 +344,7 @@ void OsdVector::decrementAllRefCounts(std::vector<SVGCommand>& commands)
 {
   for (SVGCommand& command : commands)
   {
-    decrementStyleRefCount(command.getRef());
+    decrementDrawStyleHandleRefCount(command.getRef()); // FIXME BUG BUG BUG
 
     ImageIndex ii = command.getImageIndex();
     if (ii) removeImageRef(ii);
@@ -358,7 +358,7 @@ void OsdVector::incrementAllRefCounts(std::vector<SVGCommand>& commands)
 {
   for (SVGCommand& command : commands)
   {
-    incrementStyleRefCount(command.getRef());
+    incrementDrawStyleHandleRefCount(command.getRef()); // FIXME BUG BUG BUG
 
     ImageIndex ii = command.getImageIndex();
     if (ii) incImageRef(ii);
@@ -536,20 +536,20 @@ void OsdVector::cleanupOrphanedRefs()
   }
 
 
-  std::map<DrawStyle, VectorHandle>::iterator sitty = styles.begin();
+  std::map<DrawStyle, VectorHandle>::iterator sitty = drawstyleHandles.begin();
 
-  while (sitty != styles.end())
+  while (sitty != drawstyleHandles.end())
   {
-    std::map<VectorHandle, int>::iterator curitty = styles_ref.find((*sitty).second);
+    std::map<VectorHandle, int>::iterator curitty = drawstyleHandlesRefCounts.find((*sitty).second);
     int count = (*curitty).second;
 
     if (count == 0)
     {
       VectorHandle ref = (*curitty).first;
-      styles.erase(sitty++);
-      styles_ref.erase(curitty++);
-      styles_lastit_valid = styles_ref_lastit_valid = false;
-      destroyStyleRef(ref);
+      drawstyleHandles.erase(sitty++);
+      drawstyleHandlesRefCounts.erase(curitty++);
+      drawstyleHandles_lastit_valid = drawstyleHandlesRefCounts_lastit_valid = false;
+      destroyDrawStyleHandle(ref);
 
     }
     else ++sitty;
@@ -573,78 +573,78 @@ int OsdVector::getImageRef(ImageIndex index)
   surfaces_mutex.unlock();
 }
 
-void OsdVector::incrementStyleRefCount(VectorHandle index)
+void OsdVector::incrementDrawStyleHandleRefCount(VectorHandle index)
 {
-  if (!styles_ref_lastit_valid || (styles_ref_lastit->first != index))
+  if (!drawstyleHandlesRefCounts_lastit_valid || (drawstyleHandlesRefCounts_lastit->first != index))
   {
-    styles_ref_lastit = styles_ref.find(index);
-    if (styles_ref_lastit == styles_ref.end())
+    drawstyleHandlesRefCounts_lastit = drawstyleHandlesRefCounts.find(index);
+    if (drawstyleHandlesRefCounts_lastit == drawstyleHandlesRefCounts.end())
     {
-      styles_ref_lastit = styles_ref.insert(std::pair<VectorHandle, int>(index, 0)).first;
+      drawstyleHandlesRefCounts_lastit = drawstyleHandlesRefCounts.insert(std::pair<VectorHandle, int>(index, 0)).first;
     }
   }
 
-  styles_ref_lastit->second++;
-  styles_ref_lastit_valid = true;
+  drawstyleHandlesRefCounts_lastit->second++;
+  drawstyleHandlesRefCounts_lastit_valid = true;
 }
 
-void OsdVector::decrementStyleRefCount(VectorHandle index)
+void OsdVector::decrementDrawStyleHandleRefCount(VectorHandle index)
 {
-  if (!styles_ref_lastit_valid || (styles_ref_lastit->first != index))
+  if (!drawstyleHandlesRefCounts_lastit_valid || (drawstyleHandlesRefCounts_lastit->first != index))
   {
-    styles_ref_lastit_valid = false;
-    styles_ref_lastit = styles_ref.find(index);
+    drawstyleHandlesRefCounts_lastit_valid = false;
+    drawstyleHandlesRefCounts_lastit = drawstyleHandlesRefCounts.find(index);
   }
 
-  if (styles_ref_lastit != styles_ref.end())
+  if (drawstyleHandlesRefCounts_lastit != drawstyleHandlesRefCounts.end())
   {
-    styles_ref_lastit_valid = true;
-    styles_ref_lastit->second--;
+    drawstyleHandlesRefCounts_lastit_valid = true;
+    drawstyleHandlesRefCounts_lastit->second--;
   }
 }
 
-VectorHandle OsdVector::getStyleRef(const DrawStyle& c)
+VectorHandle OsdVector::getDrawStyleHandle(const DrawStyle& c)
 {
   surfaces_mutex.lock();
   VectorHandle style_handle = 0;
 
-  if (!styles_lastit_valid || (styles_lastit->first != c))
+  if (!drawstyleHandles_lastit_valid || (drawstyleHandles_lastit->first != c))
   {
-    styles_lastit_valid = false;
-    styles_lastit = styles.find(c);
+    drawstyleHandles_lastit_valid = false;
+    drawstyleHandles_lastit = drawstyleHandles.find(c);
   }
 
-  if (styles_lastit == styles.end())
+  if (drawstyleHandles_lastit == drawstyleHandles.end())
   {
     surfaces_mutex.unlock();
-    style_handle = createStyleRef(c);
+    style_handle = createDrawStyleHandle(c);
     surfaces_mutex.lock();
-    styles_lastit = styles.insert(std::pair<DrawStyle, VectorHandle>(c, style_handle)).first;
+    drawstyleHandles_lastit = drawstyleHandles.insert(std::pair<DrawStyle, VectorHandle>(c, style_handle)).first;
   }
   else
   {
-    style_handle = styles_lastit->second;
+    style_handle = drawstyleHandles_lastit->second;
 
     //Now check if the handle is valid
-    if (!styles_ref_lastit_valid || (*styles_ref_lastit).first != style_handle)
+    if (!drawstyleHandlesRefCounts_lastit_valid || (*drawstyleHandlesRefCounts_lastit).first != style_handle)
     {
-      styles_ref_lastit_valid = false;
-      styles_ref_lastit = styles_ref.find(style_handle);
+      drawstyleHandlesRefCounts_lastit_valid = false;
+      drawstyleHandlesRefCounts_lastit = drawstyleHandlesRefCounts.find(style_handle);
     }
 
-    if (styles_ref_lastit == styles_ref.end())
+    if (drawstyleHandlesRefCounts_lastit == drawstyleHandlesRefCounts.end())
     {
       //invalid handle recreate
       surfaces_mutex.unlock();
-      style_handle = createStyleRef(c);
+      style_handle = createDrawStyleHandle(c);
       surfaces_mutex.lock();
-      styles_lastit->second = style_handle;
+      drawstyleHandles_lastit->second = style_handle;
     }
-    else styles_ref_lastit_valid = true;
+    else drawstyleHandlesRefCounts_lastit_valid = true;
   }
 
-  styles_lastit_valid = true;
-  incrementStyleRefCount(style_handle);
+  drawstyleHandles_lastit_valid = true;
+  incrementDrawStyleHandleRefCount(style_handle);
   surfaces_mutex.unlock();
   return style_handle;
 }
index 269651cc4867d547d58596408c01b07a81e4a9cf..ef0ae1e1367fa0213b92d55af838c30129cbe3d5 100644 (file)
@@ -240,8 +240,8 @@ class OsdVector : public Osd
 
     void removeImageRef(const ImageIndex ref);
     void removeLoadIndexRef(const LoadIndex ref);
-    VectorHandle getStyleRef(const DrawStyle& c);
-    virtual void decrementStyleRefCount(VectorHandle ref);
+    VectorHandle getDrawStyleHandle(const DrawStyle& c);
+    virtual void decrementDrawStyleHandleRefCount(VectorHandle ref);
     virtual void getScreenSize(int& width, int& height) = 0;
     virtual void getRealScreenSize(int& width, int& height) = 0;
 
@@ -344,12 +344,13 @@ class OsdVector : public Osd
     std::map<LoadIndex, TVMediaInfo> tvmedias_load_inv;
     std::map<LoadIndex, ImageIndex> tvmedias_loaded;
 
-    std::map<DrawStyle, VectorHandle> styles;
-    std::map<VectorHandle, int> styles_ref;
-    std::map<DrawStyle, VectorHandle>::iterator styles_lastit;
-    bool styles_lastit_valid{};
-    std::map<VectorHandle, int>::iterator styles_ref_lastit;
-    bool styles_ref_lastit_valid{};
+    std::map<DrawStyle, VectorHandle> drawstyleHandles;
+    std::map<DrawStyle, VectorHandle>::iterator drawstyleHandles_lastit;
+    bool drawstyleHandles_lastit_valid{};
+
+    std::map<VectorHandle, int> drawstyleHandlesRefCounts;
+    std::map<VectorHandle, int>::iterator drawstyleHandlesRefCounts_lastit;
+    bool drawstyleHandlesRefCounts_lastit_valid{};
 
     std::list<SurfaceInfo> surfaces;
     using SurfacesIterator = std::list<SurfaceInfo>::iterator;
@@ -371,10 +372,10 @@ class OsdVector : public Osd
 
     virtual LoadIndex loadTVMedia(TVMediaInfo& tvmedia);
 
-    void incrementStyleRefCount(VectorHandle index);
-    virtual void destroyStyleRef(VectorHandle index) = 0;
+    virtual VectorHandle createDrawStyleHandle(const DrawStyle& c) = 0;
+    void incrementDrawStyleHandleRefCount(VectorHandle index);
+    virtual void destroyDrawStyleHandle(VectorHandle index) = 0;
 
-    virtual VectorHandle createStyleRef(const DrawStyle& c) = 0;
 
     void decrementAllRefCounts(std::vector<SVGCommand>& commands);
     void incrementAllRefCounts(std::vector<SVGCommand>& commands);
index 64bcd397825579175e39924b05988a553b325a1c..9a0292b950863d6e237cdde807b5bbaba2895ad5 100644 (file)
@@ -1352,7 +1352,7 @@ ImageIndex OsdWinVector::createImagePalette(int width, int height, const unsigne
 
 }
 
-void OsdWinVector::destroyStyleRef(VectorHandle index)
+void OsdWinVector::destroyDrawStyleHandle(VectorHandle index)
 {
        if (!initted) return;
        ID2D1Brush *brush = (ID2D1Brush*)(index);
@@ -1360,7 +1360,7 @@ void OsdWinVector::destroyStyleRef(VectorHandle index)
        
 }
 
-VectorHandle OsdWinVector::createStyleRef(const DrawStyle &c)
+VectorHandle OsdWinVector::createDrawStyleHandle(const DrawStyle &c)
 {
        LockOsdDrawing();
 
index e56622dd93ef87b65946d1ac2c081148de9f776d..8318d96ac5150538a37b61a99602d5310621f5c4 100644 (file)
@@ -73,8 +73,8 @@ protected:
        ImageIndex createMonoBitmap(void *base, int width, int height);
        ImageIndex createImagePalette(int width, int height, const unsigned char *image_data, const unsigned int*palette_data);
        void createPicture(struct PictureInfo& pict_inf);
-       void destroyStyleRef(VectorHandle index);
-       VectorHandle createStyleRef(const DrawStyle &c);
+       void destroyDrawStyleHandle(VectorHandle index);
+       VectorHandle createDrawStyleHandle(const DrawStyle &c);
        bool getStaticImageData(unsigned int static_id, UCHAR **userdata, ULONG *length);
 
 
index 8f5216fddc974b5d8f96ab2cec725a26cc50f54b..fa7b61f16fd26061d725ea28ca4f21c4dacebc9c 100644 (file)
@@ -36,7 +36,7 @@ SurfaceVector::~SurfaceVector()
 
   for (SVGCommand& command : commands)
   {
-    osd->decrementStyleRefCount(command.getRef()); // We remove the Style reference, so that osd can free stuff
+    osd->decrementDrawStyleHandleRefCount(command.getRef()); // We remove the Style reference, so that osd can free stuff // FIXME BUG BUG BUG
 
     ImageIndex ii = command.getImageIndex();
     if (ii) osd->removeImageRef(ii);
@@ -84,7 +84,7 @@ int SurfaceVector::drawText(const char* text, int x, int y, int width, const Dra
 
   while (num_bytes != ((size_t) -1) && num_bytes != ((size_t) -2) && length > 0)
   {
-    ref = osd->getStyleRef(c); // Need to call this each time to have OSD get the ref count right. Maybe expose incRefCount sometime
+    ref = osd->getDrawStyleHandle(c); // Need to call this each time to have OSD get the ref count right. Maybe expose incRefCount sometime
     SVGCommand::PaintGlyph(commands[commands_size + chars], x + shift, y, tempo, ref);
     chars++;
 
@@ -112,7 +112,7 @@ int SurfaceVector::drawText(const char* text, int x, int y, int width, const Dra
 
   for (int i = 0; i < real_length; i++)
   {
-    ref = osd->getStyleRef(c); // Need to call this each time to have OSD get the ref count right. Maybe expose incRefCount sometime
+    ref = osd->getDrawStyleHandle(c); // Need to call this each time to have OSD get the ref count right. Maybe expose incRefCount sometime
     SVGCommand::PaintGlyph(commands[commands_size + chars], x + shift, y, temptext[i], ref);
     chars++;
 
@@ -280,14 +280,14 @@ int SurfaceVector::create(UINT width, UINT height)
 }
 void SurfaceVector::display()
 {
-  //nothing this is really mvp specific
+  //nothing this is really mvp specific  // FIXME remove?
 }
 
 int SurfaceVector::fillblt(int x, int y, int width, int height, const DrawStyle& c)
 {
   command_mutex.lock();
   removeCommands(x, y, width, height); // remove commands below the box
-  VectorHandle ref = osd->getStyleRef(c);
+  VectorHandle ref = osd->getDrawStyleHandle(c);
   commands.push_back(SVGCommand::PaintPath(x, y, width, height, PIRectangle, ref));
   command_mutex.unlock();
   return 1;
@@ -296,7 +296,7 @@ int SurfaceVector::fillblt(int x, int y, int width, int height, const DrawStyle&
 void SurfaceVector::drawHorzLine(int x1, int x2, int y, const DrawStyle& c)
 {
   command_mutex.lock();
-  VectorHandle ref = osd->getStyleRef(c);
+  VectorHandle ref = osd->getDrawStyleHandle(c);
   commands.push_back(SVGCommand::PaintPath(x1, y, x2 - x1, 1, PIHorzLine, ref));
   command_mutex.unlock();
 }
@@ -304,7 +304,7 @@ void SurfaceVector::drawHorzLine(int x1, int x2, int y, const DrawStyle& c)
 void SurfaceVector::drawVertLine(int x, int y1, int y2, const DrawStyle& c)
 {
   command_mutex.lock();
-  VectorHandle ref = osd->getStyleRef(c);
+  VectorHandle ref = osd->getDrawStyleHandle(c);
   commands.push_back(SVGCommand::PaintPath(x, y1, 1, y2 - y1, PIVertLine, ref));
   command_mutex.unlock();
 }
@@ -345,7 +345,7 @@ void SurfaceVector::drawPoint(int x, int y, DrawStyle& c, bool fastdraw)
 {
   if (!fastdraw) command_mutex.lock();
 
-  VectorHandle ref = osd->getStyleRef(c);
+  VectorHandle ref = osd->getDrawStyleHandle(c);
   commands.push_back(SVGCommand::PaintPath(x, y, 1, 1, PIPoint, ref));
 
   if (!fastdraw)  command_mutex.unlock();
@@ -354,7 +354,7 @@ void SurfaceVector::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int hei
 {
   command_mutex.lock();
   ImageIndex image = osd->getMonoBitmapRef(base, width, height);
-  VectorHandle ref = osd->getStyleRef(nextColour);
+  VectorHandle ref = osd->getDrawStyleHandle(nextColour);
   removeCommands(dx, dy, width, height);
   commands.push_back(SVGCommand::PaintImage(dx, dy, height, width, image, ref));
   command_mutex.unlock();
@@ -381,7 +381,7 @@ int SurfaceVector::removeCommands(float x, float y, float width, float height)
     {
       //Log::getInstance()->log("OSD", Log::DEBUG, "Remove command %d %g %g %g %g %d %d",(*itty).instr,
       //(*itty).x,(*itty).y,(*itty).w,(*itty).h,(*itty).reference,(*itty).target.image);
-      osd->decrementStyleRefCount((*itty).getRef()); // We remove the Style reference, so that osd can free stuff
+      osd->decrementDrawStyleHandleRefCount((*itty).getRef()); // We remove the Style reference, so that osd can free stuff // FIXME BUG BUG BUG
       ImageIndex ii = (*itty).getImageIndex();
 
       if (ii) osd->removeImageRef(ii);