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