qt/LedOK/LoQClass/loqgraphicsvideoitem.cpp

25 lines
963 B
C++
Raw Normal View History

2022-01-04 18:11:48 +08:00
#include "loqgraphicsvideoitem.h"
#include "loappconfig.h"
LoQGraphicsVideoItem::LoQGraphicsVideoItem(QGraphicsItem *parent) :
QGraphicsVideoItem(parent),
m_painterCompositionMode(QPainter::CompositionMode_SourceOver)
{
QString glVendor = LoAppConfig::getInstance()->OpenGLVendor();
if(glVendor.contains("NVIDIA Corporation")) { // QPainter::RasterOp_SourceAndNotDestination
m_painterCompositionMode = QPainter::RasterOp_SourceAndNotDestination;
}
}
void LoQGraphicsVideoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
if(m_painterCompositionMode != QPainter::CompositionMode_SourceOver) {
painter->save();
painter->setCompositionMode(static_cast<QPainter::CompositionMode>(m_painterCompositionMode));
QGraphicsVideoItem::paint(painter, option, widget);
painter->restore();
} else {
QGraphicsVideoItem::paint(painter, option, widget);
}
}