]> git.vomp.tv Git - vompclient.git/commitdiff
OsdOpenVG: Some renames, some CWFs
authorChris Tallon <chris@vomp.tv>
Wed, 20 May 2020 13:11:16 +0000 (14:11 +0100)
committerChris Tallon <chris@vomp.tv>
Wed, 20 May 2020 13:11:16 +0000 (14:11 +0100)
osdopenvg.cc
osdopenvg.h
osdvector.cc

index f1fa05655f2748f3ce01dafc052b64d1fac0496c..ac2bd0db764ea6d4296c30065d111b197d2403ad 100644 (file)
@@ -72,33 +72,8 @@ OsdOpenVG::~OsdOpenVG()
 
   if (freetype_inited) FT_Done_Face(ft_face);
 
-  // I think the following is broken as it is, but also possibly it shouldn't be free()ing the memory
-  // pointed at anyway, so it's correctly not working?!
-
-  if (!fontnames.size())
-  {
-    std::vector<char*>::iterator itty = fontnames.begin();
-
-    while (itty != fontnames.end())
-    {
-      free(*itty);
-      itty++;
-    }
-  }
-
-  // end
-
-
-  if (fontnames_keys.size())
-  {
-    std::vector<char*>::iterator itty = fontnames_keys.begin();
-
-    while (itty != fontnames_keys.end())
-    {
-      free(*itty);
-      itty++;
-    }
-  }
+  for (char* c : fontnames) free(c);
+  for (char* c : fontnames_keys) free(c);
 
   vgmutex.unlock();
   taskmutex.unlock();
@@ -455,7 +430,7 @@ void OsdOpenVG::destroyPaths()
 int OsdOpenVG::stopUpdate()
 {
   threadStop();
-  processTasks();
+  processOpenVGCommands();
   return 1;
 }
 
@@ -524,7 +499,7 @@ int OsdOpenVG::shutdown()
   }
 
   Log::getInstance()->log("OSD", Log::DEBUG, "shutdown mark2");
-  processTasks();
+  processOpenVGCommands();
   Log::getInstance()->log("OSD", Log::DEBUG, "shutdown mark3");
 
   taskmutex.lock();
@@ -613,7 +588,7 @@ void OsdOpenVG::threadMethod()
         ts = time1 - lastrendertime;
       }
 
-      if (processTasks()) ts = 0;
+      if (processOpenVGCommands()) ts = 0;
     }
 
     if (!threadIsActive())
@@ -1241,7 +1216,7 @@ void OsdOpenVG::executeDrawCommand(SVGCommand& command)
 }
 
 //int imcount=0;// this is debug code and should not go into release
-unsigned int OsdOpenVG::handleTask(OpenVGCommand& command)
+unsigned int OsdOpenVG::handleOpenVGCommand(OpenVGCommand& command)
 {
   switch (command.task)
   {
@@ -1463,17 +1438,17 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command)
         for (int i = 0; i < (style->num_colors - 1); i++)
         {
           colorramp[0 + (i + 1) * 5] = style->grad_pos[i];
-          colorramp[1 + (i + 1) * 5] = style->grad_col[i].red / 255.f;
-          colorramp[2 + (i + 1) * 5] = style->grad_col[i].green / 255.f;
-          colorramp[3 + (i + 1) * 5] = style->grad_col[i].blue / 255.f;
-          colorramp[4 + (i + 1) * 5] = style->grad_col[i].alpha / 255.f;
+          colorramp[1 + (i + 1) * 5] = static_cast<float>(style->grad_col[i].red) / 255.f;
+          colorramp[2 + (i + 1) * 5] = static_cast<float>(style->grad_col[i].green) / 255.f;
+          colorramp[3 + (i + 1) * 5] = static_cast<float>(style->grad_col[i].blue) / 255.f;
+          colorramp[4 + (i + 1) * 5] = static_cast<float>(style->grad_col[i].alpha) / 255.f;
         }
 
         colorramp[0 + (style->num_colors) * 5] = 1.f;
-        colorramp[1 + (style->num_colors) * 5] = style->grad_col[style->num_colors - 1].red / 255.f;
-        colorramp[2 + (style->num_colors) * 5] = style->grad_col[style->num_colors - 1].green / 255.f;
-        colorramp[3 + (style->num_colors) * 5] = style->grad_col[style->num_colors - 1].blue / 255.f;
-        colorramp[4 + (style->num_colors) * 5] = style->grad_col[style->num_colors - 1].alpha / 255.f;
+        colorramp[1 + (style->num_colors) * 5] = static_cast<float>(style->grad_col[style->num_colors - 1].red) / 255.f;
+        colorramp[2 + (style->num_colors) * 5] = static_cast<float>(style->grad_col[style->num_colors - 1].green) / 255.f;
+        colorramp[3 + (style->num_colors) * 5] = static_cast<float>(style->grad_col[style->num_colors - 1].blue) / 255.f;
+        colorramp[4 + (style->num_colors) * 5] = static_cast<float>(style->grad_col[style->num_colors - 1].alpha) / 255.f;
         vgSetParameteri(handle, VG_PAINT_COLOR_RAMP_SPREAD_MODE, VG_COLOR_RAMP_SPREAD_REFLECT);
         vgSetParameteri(handle, VG_PAINT_COLOR_RAMP_PREMULTIPLIED, VG_FALSE);
         vgSetParameterfv(handle, VG_PAINT_COLOR_RAMP_STOPS, 5 + (style->num_colors) * 5, colorramp);
@@ -1489,7 +1464,7 @@ unsigned int OsdOpenVG::handleTask(OpenVGCommand& command)
   return 0;
 }
 
-bool OsdOpenVG::processTasks()
+bool OsdOpenVG::processOpenVGCommands()
 {
   bool worked = false;
   taskmutex.lock();
@@ -1502,7 +1477,7 @@ bool OsdOpenVG::processTasks()
     taskmutex.unlock();
 
     OpenVGResponse resp;
-    resp.result = handleTask(comm);
+    resp.result = handleOpenVGCommand(comm);
     resp.id = comm.id;
     taskmutex.lock();
 
index c66469cd3a6a6f0d99d913bc6780c23807ad5ae6..df91d52eed940291f5b8224a63a782ab3fed7192 100644 (file)
@@ -131,9 +131,9 @@ class OsdOpenVG : public OsdVector, public Thread_TYPE
 
     std::deque<OpenVGCommand> vgcommands;
     std::deque<OpenVGResponse> vgresponses;
-    bool processTasks();
+    bool processOpenVGCommands();
     unsigned int putOpenVGCommand(OpenVGCommand& comm, bool wait);
-    unsigned int handleTask(OpenVGCommand& command);
+    unsigned int handleOpenVGCommand(OpenVGCommand& command);
     //void purgeAllReferences();
     unsigned int wait_id{1};
 
index 9657d8ad85ea5d8ece98fa98a92b5b16369c638c..453be1365f0fe97f369f2ac7f669df787ff26d49 100644 (file)
@@ -670,6 +670,8 @@ VectorHandle OsdVector::getDrawStyleHandle(const DrawStyle& c)
 #if DEV
 void OsdVector::dumpStyles()
 {
+  return;
+
   std::map<DrawStyle, VectorHandle>::iterator i;
   for(i = drawstyleHandles.begin(); i != drawstyleHandles.end(); i++)
   {