Commit b420ca3a authored by Ming Rui Zhang's avatar Ming Rui Zhang

renderer: improve the video quality by using rendering hint

Gitlab: #390

Change-Id: Idf3ccf9ab5b29a984a36ea117e6cf495a9e80988
parent 9a84dcd6
......@@ -87,7 +87,12 @@ DistantRenderer::paint(QPainter* painter)
{
lrcInstance_->renderer()->drawFrame(distantRenderId_, [this, painter](QImage* distantImage) {
if (distantImage) {
auto scaledDistant = distantImage->scaled(size().toSize(), Qt::KeepAspectRatio);
painter->setRenderHint(QPainter::Antialiasing);
painter->setRenderHint(QPainter::SmoothPixmapTransform);
auto scaledDistant = distantImage->scaled(size().toSize(),
Qt::KeepAspectRatio,
Qt::SmoothTransformation);
auto tempScaledWidth = static_cast<int>(scaledWidth_ * 1000);
auto tempScaledHeight = static_cast<int>(scaledHeight_ * 1000);
auto tempXOffset = xOffset_;
......
......@@ -51,6 +51,9 @@ PreviewRenderer::paint(QPainter* painter)
lrcInstance_->renderer()
->drawFrame(lrc::api::video::PREVIEW_RENDERER_ID, [this, painter](QImage* previewImage) {
if (previewImage) {
painter->setRenderHint(QPainter::Antialiasing);
painter->setRenderHint(QPainter::SmoothPixmapTransform);
auto aspectRatio = static_cast<qreal>(previewImage->width())
/ static_cast<qreal>(previewImage->height());
auto previewHeight = height();
......@@ -69,7 +72,9 @@ PreviewRenderer::paint(QPainter* painter)
// If the given size is empty, this function returns a null image.
QImage scaledPreview;
scaledPreview = previewImage->scaled(size().toSize(), Qt::KeepAspectRatio);
scaledPreview = previewImage->scaled(size().toSize(),
Qt::KeepAspectRatio,
Qt::SmoothTransformation);
painter->drawImage(QRect(0, 0, scaledPreview.width(), scaledPreview.height()),
scaledPreview);
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment