Go to the documentation of this file.
6 #include <QCoreApplication>
22 LOG(VB_GENERAL, LOG_ERR,
"OpenGL painter has no render device");
78 LOG(VB_GENERAL, LOG_INFO,
"Clearing OpenGL painter cache.");
95 m_frameTime = QTime::currentTime().msecsSinceStartOfDay();
98 LOG(VB_GENERAL, LOG_ERR,
"FATAL ERROR: No render device in 'Begin'");
107 [&]() { return m_render->CreateVBO(static_cast<int>(MythRenderOpenGL::kVertexSize)); });
110 QSize currentsize =
m_parent->size();
118 static const int s_onehd = 1920 * 1080;
119 static const int s_basesize = 64;
122 int cpu = std::max(
static_cast<int>(hdscreens * s_basesize), s_basesize);
123 int gpu = cpu * 3 / 2;
155 LOG(VB_GENERAL, LOG_ERR,
"FATAL ERROR: No render device in 'End'");
195 while (texture ==
nullptr)
198 if (texture !=
nullptr)
204 LOG(VB_GENERAL, LOG_ERR,
"Failed to create OpenGL texture.");
210 LOG(VB_GENERAL, LOG_NOTICE, QString(
"Shrinking UIPainterMaxCacheHW to %1KB")
248 const QRect
Source,
int Alpha)
252 qreal pixelratio = 1.0;
256 QRect
dest = QRect(
static_cast<int>(Dest.left() * pixelratio),
257 static_cast<int>(Dest.top() * pixelratio),
258 static_cast<int>(Dest.width() * pixelratio),
259 static_cast<int>(Dest.height() * pixelratio));
267 QOpenGLBuffer *vbo = texture->
m_vbo;
272 texture->
m_vbo = vbo;
300 LOG(VB_GENERAL, LOG_INFO, QString(
"%1 procedural shaders cached").arg(
m_procedurals.size()));
314 const QPen &LinePen,
int Alpha)
316 if ((FillBrush.style() == Qt::SolidPattern ||
326 const QBrush &FillBrush,
327 const QPen &LinePen,
int Alpha)
329 if ((FillBrush.style() == Qt::SolidPattern ||
std::list< MythImage * > m_imageExpireList
MythMainWindow * m_parent
void DeleteTextures(void)
void SetBackground(uint8_t Red, uint8_t Green, uint8_t Blue, uint8_t Alpha)
void ClearFramebuffer(void)
void Begin(QPaintDevice *Parent) override
void SetMaximumCacheSizes(int hardware, int software)
QRecursiveMutex m_imageAndTextureLock
MythOpenGLPainter(MythRenderOpenGL *Render, MythMainWindow *Parent)
void DrawRect(QRect Area, const QBrush &FillBrush, const QPen &LinePen, int Alpha) override
Draw a rectangle.
static constexpr size_t MAX_BUFFER_POOL
void logDebugMarker(const QString &Message)
void FreeResources(void) override
static bool VERBOSE_LEVEL_CHECK(uint64_t mask, LogLevel_t level)
QOpenGLShaderProgram * GetProceduralShader(const ProcSource &VertexSource, const ProcSource &FragmentSource, const QString &SourceHash)
void PushTransformation(const UIEffects &Fx, QPointF &Center)
size_t m_mappedBufferPoolIdx
void DrawBitmap(MythGLTexture *Texture, QOpenGLFramebufferObject *Target, QRect Source, QRect Destination, QOpenGLShaderProgram *Program, int Alpha=255, qreal Scale=1.0)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythGLTexture * GetTextureFromCache(MythImage *Image)
virtual void DrawRect(QRect area, const QBrush &fillBrush, const QPen &linePen, int alpha)
int m_maxHardwareCacheSize
void DrawProcedural(QRect Dest, int Alpha, const ProcSource &VertexSource, const ProcSource &FragmentSource, const QString &SourceHash) override
ViewControls m_viewControl
static int GetTextureDataSize(MythGLTexture *Texture)
void PushTransformation(const UIEffects &Fx, QPointF Center=QPointF()) override
MythGLTexture * CreateTextureFromQImage(QImage *Image)
void DrawRect(QOpenGLFramebufferObject *Target, QRect Area, const QBrush &FillBrush, const QPen &LinePen, int Alpha)
MythRenderOpenGL * m_render
void PopTransformation(void)
bool m_mappedBufferPoolReady
void DeleteTexture(MythGLTexture *Texture)
void DeleteFormatImagePriv(MythImage *Image) override
void DrawProcedural(QRect Area, int Alpha, QOpenGLFramebufferObject *Target, QOpenGLShaderProgram *Program, float TimeVal)
std::array< QOpenGLBuffer *, MAX_BUFFER_POOL > m_mappedBufferPool
void DrawRoundRect(QOpenGLFramebufferObject *Target, QRect Area, int CornerRadius, const QBrush &FillBrush, const QPen &LinePen, int Alpha)
virtual void SetChanged(bool change=true)
void PopTransformation(void) override
virtual void FreeResources(void)
QHash< QString, QOpenGLShaderProgram * > m_procedurals
std::shared_ptr< QByteArray > ProcSource
void BindFramebuffer(QOpenGLFramebufferObject *Framebuffer)
QVector< MythGLTexture * > m_mappedTextures
void SetViewPort(QRect Rect, bool ViewportOnly=false) override
~MythOpenGLPainter() override
virtual void Teardown(void)
void CheckFormatImage(MythImage *im)
void DrawRoundRect(QRect Area, int CornerRadius, const QBrush &FillBrush, const QPen &LinePen, int Alpha) override
void DrawImage(QRect Dest, MythImage *Image, QRect Source, int Alpha) override
virtual void Begin(QPaintDevice *)
virtual void DrawRoundRect(QRect area, int cornerRadius, const QBrush &fillBrush, const QPen &linePen, int alpha)
QMap< MythImage *, MythGLTexture * > m_imageToTextureMap
QOpenGLShaderProgram * CreateShaderProgram(const QString &Vertex, const QString &Fragment)
std::list< MythGLTexture * > m_textureDeleteList