}
styles_lastit_valid = styles_ref_lastit_valid = false;
-
-}
-
-OsdVector::~OsdVector()
-{
-}
-
-
-int OsdVector::getFD()
-{
- return 0;
}
void OsdVector::screenShot(const char* fileName)
surfaces_mutex.lock();
//Now go through all surfaces and draw them
- std::list<SurfaceCommands>::iterator curdraw = scommands.begin();
+ std::list<SurfaceInfo>::iterator curdraw = surfaces.begin();
- while (curdraw != scommands.end())
+ while (curdraw != surfaces.end())
{
(*curdraw).commands.clear();
(*curdraw).commands.reserve(2048);
void OsdVector::drawSurfaces()
{
surfaces_mutex.lock();
- std::list<SurfaceCommands*> todraw; //First figure out if a surfaces is below another surface
- std::list<SurfaceCommands>::iterator itty1 = scommands.begin();
+ std::list<SurfaceInfo*> todraw; //First figure out if a surfaces is below another surface
+ std::list<SurfaceInfo>::iterator itty1 = surfaces.begin();
- while (itty1 != scommands.end())
+ while (itty1 != surfaces.end())
{
- std::list<SurfaceCommands>::iterator itty2 = itty1;
+ std::list<SurfaceInfo>::iterator itty2 = itty1;
itty2++;
bool hidden = false;
- while (itty2 != scommands.end())
+ while (itty2 != surfaces.end())
{
- SurfaceCommands& ref1 = *itty1;
- SurfaceCommands& ref2 = *itty2;
+ SurfaceInfo& ref1 = *itty1;
+ SurfaceInfo& ref2 = *itty2;
if (ref1.x >= ref2.x && ref1.y >= ref2.y
&& (ref1.x + ref1.w) <= (ref2.x + ref2.w)
int swidth, sheight;
getScreenSize(swidth, sheight);
//Now go through all surfaces and draw them
- std::list<SurfaceCommands*>::iterator curdraw = todraw.begin();
+ std::list<SurfaceInfo*>::iterator curdraw = todraw.begin();
while (curdraw != todraw.end())
{
{
surfaces_mutex.lock();
//First determine it is already in our system
- std::list<SurfaceCommands>::iterator itty = scommands.begin();
+ std::list<SurfaceInfo>::iterator itty = surfaces.begin();
- while (itty != scommands.end())
+ while (itty != surfaces.end())
{
if ((*itty).surf == surf)
{
//decrease the references
- dereferenceSVGCommand((*itty).commands);
+ decrementAllRefCounts((*itty).commands);
break;
}
}
// if not insert it
- if (itty == scommands.end())
+ if (itty == surfaces.end())
{
- SurfaceCommands new_sc;
+ SurfaceInfo new_sc;
new_sc.surf = surf;
new_sc.x = x;
new_sc.y = y;
new_sc.w = width;
new_sc.h = height;
- itty = scommands.insert(itty, new_sc);
+ itty = surfaces.insert(itty, new_sc);
}
// update any images loaded in the mean time
(*itty).commands.clear();
(*itty).commands = commands;
//increase the references
- referenceSVGCommand((*itty).commands);
+ incrementAllRefCounts((*itty).commands);
cleanupOrphanedRefs();
surfaces_mutex.unlock();
{
surfaces_mutex.lock();
//First determine it is already in our system
- std::list<SurfaceCommands>::iterator itty = scommands.begin();
+ std::list<SurfaceInfo>::iterator itty = surfaces.begin();
- while (itty != scommands.end())
+ while (itty != surfaces.end())
{
if ((*itty).surf == surf)
{
- dereferenceSVGCommand((*itty).commands);
+ decrementAllRefCounts((*itty).commands);
(*itty).commands.clear();
- scommands.erase(itty);
+ surfaces.erase(itty);
break;
}
}
-void OsdVector::dereferenceSVGCommand(std::vector<SVGCommand>& commands )
+void OsdVector::decrementAllRefCounts(std::vector<SVGCommand>& commands )
{
std::vector<SVGCommand>::iterator sitty = commands.begin();
}
}
-void OsdVector::referenceSVGCommand(std::vector<SVGCommand>& commands )
+void OsdVector::incrementAllRefCounts(std::vector<SVGCommand>& commands )
{
std::vector<SVGCommand>::iterator sitty = commands.begin();
return style_handle;
}
-
-
-int OsdVector::getStyleRef(VectorHandle index)
-{
- if (!styles_ref_lastit_valid || (*styles_ref_lastit).first != index)
- {
- styles_ref_lastit_valid = false;
- styles_ref_lastit = styles_ref.find(index);
- }
-
- if (styles_ref_lastit == styles_ref.end())
- {
- return -1;
- }
- else
- {
- styles_ref_lastit_valid = true;
- return (*styles_ref_lastit).second;
- }
-}
-
LoadIndex OsdVector::getTVMediaRef(TVMediaInfo& tvmedia, ImageIndex& image)
{
ImageIndex image_handle = 0;
class SurfaceVector;
class VDR_ResponsePacket;
-struct SurfaceCommands
+struct SurfaceInfo
{
const SurfaceVector* surf;
std::vector<SVGCommand> commands;
{
public:
OsdVector();
- virtual ~OsdVector();
-
int restore();
- int getFD();
-
void screenShot(const char* fileName);
virtual bool screenShot(void* buffer, int width, int height, bool osd /*include osd*/) = 0;
void incStyleRef(VectorHandle index);
- int getStyleRef(VectorHandle index);
virtual void destroyStyleRef(VectorHandle index) = 0;
virtual VectorHandle createStyleRef(const DrawStyle& c) = 0;
- void dereferenceSVGCommand(std::vector<SVGCommand>& commands );
- void referenceSVGCommand(std::vector<SVGCommand>& commands );
+ void decrementAllRefCounts(std::vector<SVGCommand>& commands );
+ void incrementAllRefCounts(std::vector<SVGCommand>& commands );
void cleanupOrphanedRefs();
- virtual void drawSetTrans(SurfaceCommands& sc) = 0;
+ virtual void drawSetTrans(SurfaceInfo& sc) = 0;
virtual void executeDrawCommand(SVGCommand& command) = 0;
- std::list<SurfaceCommands> scommands;
+ std::list<SurfaceInfo> surfaces;
std::mutex surfaces_mutex;