2 Copyright 2004-2005 Chris Tallon, 2006,2011-2012 Marten Richter
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP. If not, see <https://www.gnu.org/licenses/>.
25 #include <condition_variable>
28 #include <EGL/eglext.h>
29 #include <VG/openvg.h>
34 #include "osdvector.h"
39 #include "staticartwork.h"
40 #ifdef PICTURE_DECODER_OMX
47 #include FT_FREETYPE_H
52 OVGcreateImagePalette,
68 unsigned int param1,param2,param3;
69 unsigned int id; //only set an id if you are waiting
72 struct OpenVGResponse{
78 class OsdOpenVG : public OsdVector, public Thread_TYPE
79 #ifdef PICTURE_DECODER_OMX
80 , public EGLPictureCreator
91 bool screenShot(void *buffer, int width, int height, bool osd /*include osd*/);
95 float getFontHeight();
96 float getCharWidth(wchar_t c);
98 int getFontNames(const char *** names,const char *** names_keys);
100 virtual void setFont(const char * fontname);
102 virtual float getPixelAspect() {return aspect_correction;};
104 bool getEGLPicture(struct OsdVector::PictureInfo & info, EGLDisplay * display);
106 void updateBackgroundColor(DrawStyle bg);
112 /*osd vector implementation*/
113 void destroyImageRef(ImageIndex index);
114 // ImageIndex createJpeg(const char* fileName, int *width,int *height);
115 ImageIndex createMonoBitmap(void *base,int width,int height);
116 ImageIndex createImagePalette(int width,int height,const unsigned char *image_data,const unsigned int*palette_data);
117 void createPicture(struct PictureInfo& pict_inf);
118 void destroyStyleRef(VectorHandle index);
119 VectorHandle createStyleRef(const DrawStyle &c);
120 bool getStaticImageData(unsigned int static_id, UCHAR **userdata, ULONG *length);
122 void drawSetTrans(SurfaceCommands & sc);
123 void executeDrawCommand(SVGCommand & command);
127 VGPath std_paths[PIPoint+1];
128 long long lastrendertime;
129 void InternalRendering();
130 void getScreenSize(int &width, int &height);
131 void getRealScreenSize(int &width, int &height);
136 std::mutex taskmutex;
138 std::mutex vgTaskSignalMutex;
139 std::condition_variable vgTaskSignal;
141 std::deque<OpenVGCommand> vgcommands;
142 std::deque<OpenVGResponse> vgresponses;
144 bool haveOpenVGResponse(unsigned int id,unsigned int * resp);
145 unsigned int putOpenVGCommand(OpenVGCommand& comm,bool wait);
146 unsigned int handleTask(OpenVGCommand& command);
147 //void purgeAllReferences();
148 unsigned int wait_id;
150 FT_Library ft_library;
155 int loadFont(bool fontchange);
156 std::map<unsigned int,float> font_exp_x;
157 std::vector<char*> fontnames;
158 std::vector<char*> fontnames_keys;
164 unsigned int loadTTchar(cTeletextChar c);
165 std::map<unsigned int,int> tt_font_chars;
172 uint32_t display_height;
173 uint32_t display_width;
174 DISPMANX_DISPLAY_HANDLE_T bcm_display;
175 DISPMANX_ELEMENT_HANDLE_T bcm_element;
176 DISPMANX_ELEMENT_HANDLE_T bcm_background;
177 DISPMANX_RESOURCE_HANDLE_T bcm_backres;
182 EGLDisplay egl_display;
183 EGLSurface egl_surface;
184 EGLContext egl_context;
185 EGLConfig egl_ourconfig;
187 float aspect_correction;
188 bool freetype_inited;
190 uint8_t *static_artwork_begin[sa_MAX];
191 uint8_t *static_artwork_end[sa_MAX];
193 #ifdef PICTURE_DECODER_OMX