parent
bf67845df6
commit
473723b24a
4
3rdparty/qtimgui/QtImGui.cpp
vendored
4
3rdparty/qtimgui/QtImGui.cpp
vendored
@ -21,7 +21,11 @@ public:
|
||||
return w->size();
|
||||
}
|
||||
qreal devicePixelRatio() const override {
|
||||
#if defined(__APPLE__)
|
||||
return w->devicePixelRatio();
|
||||
#else
|
||||
return w->devicePixelRatioF();
|
||||
#endif
|
||||
}
|
||||
bool isActive() const override {
|
||||
return w->isActiveWindow();
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QImageWriter>
|
||||
#include <QMouseEvent>
|
||||
#include <QWidget>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include "QtImGui.h"
|
||||
#include "imgui.h"
|
||||
@ -287,7 +288,11 @@ QMatrix4x4 FPGAViewWidget::getProjection(void)
|
||||
void FPGAViewWidget::paintGL()
|
||||
{
|
||||
auto gl = QOpenGLContext::currentContext()->functions();
|
||||
#if defined(__APPLE__)
|
||||
const qreal retinaScale = devicePixelRatio();
|
||||
#else
|
||||
const qreal retinaScale = devicePixelRatioF();
|
||||
#endif
|
||||
gl->glViewport(0, 0, width() * retinaScale, height() * retinaScale);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
@ -807,12 +812,10 @@ void FPGAViewWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
// coordinates.
|
||||
QVector4D FPGAViewWidget::mouseToWorldCoordinates(int x, int y)
|
||||
{
|
||||
const qreal retinaScale = devicePixelRatio();
|
||||
|
||||
auto projection = getProjection();
|
||||
|
||||
QMatrix4x4 vp;
|
||||
vp.viewport(0, 0, width() * retinaScale, height() * retinaScale);
|
||||
vp.viewport(0, 0, width(), height());
|
||||
|
||||
QVector4D vec(x, y, 1, 1);
|
||||
vec = vp.inverted() * vec;
|
||||
|
Loading…
Reference in New Issue
Block a user