Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Display 125% scaling : Video is rendered to an incorrect rect #1396

Open
gt4317 opened this issue Nov 30, 2021 · 1 comment
Open

Comments

@gt4317
Copy link

gt4317 commented Nov 30, 2021

The video is not rendered to the correct rect.
QtAV, Official Sample, sampleplayer
Windows 10, QT 5.15.2 mingw32

For supporting non integer sclae factor on windows
E.g. Set Windows / Setting / Display / Scale and Layout to 125% or 175%

You need to set Qt::HighDpiScaleFactorRoundingPolicy::PassThrough to highDpiScaleFactorRoundingPolicy like this :

int main(int argc, char *argv[]) {
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
    QtAV::Widgets::registerRenderers();
    QApplication a(argc, argv);
    PlayerWindow player;
    player.show();
    player.resize(800, 600);
    return a.exec();
}

In above situation, if you drag player window between two screen which have the different display scale setting. It will be rendered to an incorrect rect like this:

SharedScreenshot

@gt4317
Copy link
Author

gt4317 commented Nov 30, 2021

I found the reason is in QtAV\widgets\OpenGLWidgetRenderer.cpp line 67

const qreal dpr = context()->screen()->devicePixelRatio();

context()->screen() to get the screen which this widget is created on.
If you have two monitor and set them to different Display Scale Factor, It can't work.
I changed this line to :

const qreal dpr = devicePixelRatioF();

The Problem solved.
Mybe other renders have the same problem. but I just use this one.
Mybe someone or author can make a commit to fix it.
:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant