along with VOMP. If not, see <https://www.gnu.org/licenses/>.
*/
-
#ifndef OSDVECTOR_H
#define OSDVECTOR_H
+
#include <set>
#include <list>
#include <vector>
#include "colour.h"
#include "tvmedia.h"
#include "vdr.h"
-
#include "teletextdecodervbiebu.h"
enum SVGCommandInstr
DrawClipping,
DrawImageLoading
};
+
enum PathIndex
{
PIHorzLine,
TopLeftLimited
};
-typedef VectorHandle ImageIndex;
+typedef VectorHandle ImageIndex;
typedef unsigned long long LoadIndex;
class SVGCommand
{
public:
- SVGCommand()
- {
- instr = DrawNoop;
- x = y = w = h = 0;
- reference = VECTOR_HANDLE_INIT;
- };
-
inline static SVGCommand PaintPath(float ix, float iy, float iw, float ih, PathIndex path, VectorHandle ref)
{
SVGCommand nc;
return nc;
};
-
-
inline static SVGCommand PaintTTchar(float ix, float iy, float iw, float ih, unsigned int ttchar_in)
{
SVGCommand nc;
nc.corner = TopLeft;
return nc;
};
+
inline static SVGCommand PaintClipping(float ix, float iy, float iw, float ih)
{
SVGCommand nc;
return nc;
};
-
inline static void PaintGlyph(SVGCommand& nc, float ix, float iy, wchar_t char_in, VectorHandle ref)
{
nc.instr = DrawGlyph;
{
return (x >= tx) && (y >= ty) && ((x + w) <= (tx + tw)) && ((y + h) <= (ty + th));
}
+
bool TTTest(float tox, float toy, float tx, float ty)
{
return (x == tox) && (toy == y) && (w == tx) && (h == ty);
}
+
bool Outside(float tx, float ty, float tw, float th)
{
return ((x + w) < tx) || ((y + h) < ty) || ((tx + tw) < x) || ((ty + th) < y);
}
- VectorHandle getRef() { return reference; };
+ VectorHandle getRef()
+ {
+ return reference;
+ };
+
ImageIndex getImageIndex()
{
if (instr != DrawImage) return 0;
else return target.image;
};
+
LoadIndex getLoadIndex()
{
if (instr != DrawImageLoading) return 0;
else return target.loadindex;
};
- SVGCommandInstr instr;
+ SVGCommandInstr instr{DrawNoop};
Corner corner;
- float x, y, w, h;
- VectorHandle reference;
+ float x{}, y{}, w{}, h{};
+ VectorHandle reference{VECTOR_HANDLE_INIT};
union
{
- PathIndex path_index; //path_index
+ PathIndex path_index;
wchar_t textchar;
ImageIndex image;
unsigned int ttchar;
LoadIndex loadindex;
} target;
-
-
};
class SurfaceVector;
float x, y, w, h;
};
-
class OsdVector : public Osd
{
public:
void informPicture(LoadIndex index, ImageIndex i_index);
-
-
int charSet() {return 2;}; //UTF-8
class PictureReader: public Thread_TYPE
{
public:
-
~PictureReader();
-
void init();
void addDecoder(PictureDecoder*);
void removeDecoder(PictureDecoder*);
-
void shutdown();
-
-
bool processReceivedPictures();
// should be called from control thread
void receivePicture(VDR_ResponsePacket* vresp);
void addStaticImage(unsigned int id);
-
void invalidateLoadIndex(LoadIndex index);
-
void informFallback(LoadIndex index, int fallback);
-
-
-
protected:
void threadMethod();
std::set<LoadIndex> invalid_loadindex;
bool picture_update;
-
};
- PictureReader* getPictReader() { return &reader;};
-
-
+ PictureReader* getPictReader() { return &reader; };
protected:
PictureReader reader;
- void incImageRef(ImageIndex index);
- int getImageRef(ImageIndex index);
- virtual void destroyImageRef(ImageIndex index) = 0;
- void incLoadIndexRef(LoadIndex index);
- int getLoadIndexRef(LoadIndex index);
-
-
- //virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0;
- virtual ImageIndex createMonoBitmap(void* base, int width, int height) = 0;
- virtual ImageIndex createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data) = 0;
- virtual void createPicture(struct PictureInfo& pict_inf) = 0;
-
- virtual LoadIndex loadTVMedia(TVMediaInfo& tvmedia);
-
-
-
std::map<ImageIndex, int> images_ref;
std::map<void*, ImageIndex> monobitmaps;
//map<string,ImageIndex> jpegs;
std::map<TVMediaInfo, ImageIndex> tvmedias;
std::list<ImageIndex> palettepics;
-
-
-
std::map<LoadIndex, int> loadindex_ref;
std::map<TVMediaInfo, LoadIndex> tvmedias_load;
std::map<LoadIndex, TVMediaInfo> tvmedias_load_inv;
std::map<LoadIndex, ImageIndex> tvmedias_loaded;
-
-
- void incrementStyleRefCount(VectorHandle index);
- virtual void destroyStyleRef(VectorHandle index) = 0;
-
-
std::map<DrawStyle, VectorHandle> styles;
std::map<VectorHandle, int> styles_ref;
std::map<DrawStyle, VectorHandle>::iterator styles_lastit;
std::map<VectorHandle, int>::iterator styles_ref_lastit;
bool styles_ref_lastit_valid{};
- virtual VectorHandle createStyleRef(const DrawStyle& c) = 0;
+ std::list<SurfaceInfo> surfaces;
+ using SurfacesIterator = std::list<SurfaceInfo>::iterator;
- void decrementAllRefCounts(std::vector<SVGCommand>& commands);
- void incrementAllRefCounts(std::vector<SVGCommand>& commands);
- void cleanupOrphanedRefs();
+ std::mutex surfaces_mutex;
+ float byte_char_width[256]{};
+ void incImageRef(ImageIndex index);
+ int getImageRef(ImageIndex index);
+ virtual void destroyImageRef(ImageIndex index) = 0;
+ void incLoadIndexRef(LoadIndex index);
+ int getLoadIndexRef(LoadIndex index);
- virtual void drawSetTrans(SurfaceInfo& sc) = 0;
- virtual void executeDrawCommand(SVGCommand& command) = 0;
+ //virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0;
+ virtual ImageIndex createMonoBitmap(void* base, int width, int height) = 0;
+ virtual ImageIndex createImagePalette(int width, int height, const unsigned char* image_data, const unsigned int* palette_data) = 0;
+ virtual void createPicture(struct PictureInfo& pict_inf) = 0;
+ virtual LoadIndex loadTVMedia(TVMediaInfo& tvmedia);
- std::list<SurfaceInfo> surfaces;
- using SurfacesIterator = std::list<SurfaceInfo>::iterator;
+ void incrementStyleRefCount(VectorHandle index);
+ virtual void destroyStyleRef(VectorHandle index) = 0;
- std::mutex surfaces_mutex;
+ virtual VectorHandle createStyleRef(const DrawStyle& c) = 0;
- float byte_char_width[256];
+ void decrementAllRefCounts(std::vector<SVGCommand>& commands);
+ void incrementAllRefCounts(std::vector<SVGCommand>& commands);
+ void cleanupOrphanedRefs();
+
+ virtual void drawSetTrans(SurfaceInfo& sc) = 0;
+ virtual void executeDrawCommand(SVGCommand& command) = 0;
void drawSurfaces();
};