std::lock_guard<std::mutex> lg(surfaces_mutex);
SurfacesIterator si;
+ #if DEV
+ Log::getInstance()->log("OsdVector", Log::CRAZY, "updateOrAddSurface, surfaces.length %i", surfaces.size());
+ dumpStyles();
+ #endif
+
// First determine it is already in our system
for(si = surfaces.begin(); si != surfaces.end(); si++)
{
incrementAllRefCounts(si->commands);
cleanupOrphanedRefs();
+
+ #if DEV
+ Log::getInstance()->log("OsdVector", Log::CRAZY, "After UOAS:");
+ dumpStyles();
+ #endif
}
void OsdVector::removeSurface(const SurfaceVector* surf)
{
for (SVGCommand& command : commands)
{
- decrementDrawStyleHandleRefCount(command.getHandle()); // FIXME BUG BUG BUG
+ VectorHandle handle = command.getHandle();
+ if (handle != 0) // command might not have a handle
+ decrementDrawStyleHandleRefCount(handle);
ImageIndex ii = command.getImageIndex();
if (ii) removeImageRef(ii);
{
for (SVGCommand& command : commands)
{
- incrementDrawStyleHandleRefCount(command.getHandle()); // FIXME BUG BUG BUG
+ VectorHandle handle = command.getHandle();
+ if (handle != 0) // command might not have a handle
+ incrementDrawStyleHandleRefCount(handle);
ImageIndex ii = command.getImageIndex();
if (ii) incImageRef(ii);
surfaces_mutex.lock();
VectorHandle style_handle = 0;
+ #if DEV
+ dumpStyles();
+ #endif
+
if (!drawstyleHandles_lastit_valid || (drawstyleHandles_lastit->first != c))
{
drawstyleHandles_lastit_valid = false;
return style_handle;
}
+#if DEV
+void OsdVector::dumpStyles()
+{
+ std::map<DrawStyle, VectorHandle>::iterator i;
+ for(i = drawstyleHandles.begin(); i != drawstyleHandles.end(); i++)
+ {
+ const DrawStyle* test = &(i->first);
+ Log::getInstance()->log("OsdVector", Log::DEBUG, "DumpStyles: %p %i", test , i->second);
+ }
+
+ std::map<VectorHandle, int>::iterator i2;
+ for (i2 = drawstyleHandlesRefCounts.begin(); i2 != drawstyleHandlesRefCounts.end(); i2++)
+ {
+ Log::getInstance()->log("OsdVector", Log::DEBUG, "DumpStylesRef: %i %i", i2->first, i2->second);
+ }
+}
+#endif
+
LoadIndex OsdVector::getTVMediaRef(TVMediaInfo& tvmedia, ImageIndex& image)
{
ImageIndex image_handle = 0;
return osd->getCharWidth(c);
}
+/*
+ * By current design it's not permitted to have a surface without the first drawing being to
+ * fill with a background colour. The fillblt calls removeCommands which deletes all the old
+ * commands before the background colour becomes the new first command, then all the rest are
+ * redrawn on top. If you want to change this in future then do this as the first thing in
+ * Boxx::draw():
+ * surface->clear();
+ * and have this function in here:
+ * void SurfaceVector::clear()
+ * {
+ * removeCommands(0, 0, swidth, sheight);
+ * }
+ * Or preferably a simpler one that doesn't do all the comparison work.
+*/
+
int SurfaceVector::drawText(const char* text, int x, int y, const DrawStyle& c)
{
return drawText(text, x, y, 0, c);