void OsdOpenVG::purgeAllReferences()
{
images_ref.clear();
- styles_ref.clear(); // remove all references
+ drawstyleHandlesRefCounts.clear(); // remove all references
map<void *,ImageIndex>::iterator mitty=monobitmaps.begin();
}
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();
}*/
return putOpenVGCommand(comm, true);
}
-void OsdOpenVG::destroyStyleRef(VectorHandle index)
+void OsdOpenVG::destroyDrawStyleHandle(VectorHandle index)
{
struct OpenVGCommand comm;
comm.task = OVGdestroyPaint;
putOpenVGCommand(comm, false);
}
-VectorHandle OsdOpenVG::createStyleRef(const DrawStyle& c)
+VectorHandle OsdOpenVG::createDrawStyleHandle(const DrawStyle& c)
{
unsigned int col = c.rgba();
struct OpenVGCommand comm;
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);
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();
{
for (SVGCommand& command : commands)
{
- decrementStyleRefCount(command.getRef());
+ decrementDrawStyleHandleRefCount(command.getRef()); // FIXME BUG BUG BUG
ImageIndex ii = command.getImageIndex();
if (ii) removeImageRef(ii);
{
for (SVGCommand& command : commands)
{
- incrementStyleRefCount(command.getRef());
+ incrementDrawStyleHandleRefCount(command.getRef()); // FIXME BUG BUG BUG
ImageIndex ii = command.getImageIndex();
if (ii) incImageRef(ii);
}
- 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;
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;
}
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;
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;
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);
}
-void OsdWinVector::destroyStyleRef(VectorHandle index)
+void OsdWinVector::destroyDrawStyleHandle(VectorHandle index)
{
if (!initted) return;
ID2D1Brush *brush = (ID2D1Brush*)(index);
}
-VectorHandle OsdWinVector::createStyleRef(const DrawStyle &c)
+VectorHandle OsdWinVector::createDrawStyleHandle(const DrawStyle &c)
{
LockOsdDrawing();
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);
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);
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++;
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++;
}
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;
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();
}
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();
}
{
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();
{
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();
{
//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);