mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
fixed bug in flow_gl when a devicePixelRatio <> 1 was used
This commit is contained in:
@ -368,12 +368,13 @@ void YACReaderFlowGL::resizeGL(int width, int height)
|
||||
|
||||
void YACReaderFlowGL::udpatePerspective(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
float pixelRatio = devicePixelRatio();
|
||||
glViewport(0, 0, width*pixelRatio, height*pixelRatio);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
gluPerspective(20.0, GLdouble(width) / (float)height, 1.0, 200.0);
|
||||
gluPerspective(20.0, GLdouble(width) / (float)height, 1.0, 200.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
@ -384,7 +385,7 @@ void YACReaderFlowGL::calcPos(YACReader3DImage & image, int pos)
|
||||
{
|
||||
if(pos == 0){
|
||||
image.current = centerPos;
|
||||
}else{
|
||||
}else{
|
||||
if(pos > 0){
|
||||
image.current.x = (config.centerDistance)+(config.xDistance*pos);
|
||||
image.current.y = config.yDistance*pos*-1;
|
||||
@ -1101,8 +1102,9 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event)
|
||||
if(event->button() == Qt::LeftButton)
|
||||
{
|
||||
float x,y;
|
||||
x = event->x();
|
||||
y = event->y();
|
||||
float pixelRatio = devicePixelRatio();
|
||||
x = event->x()*pixelRatio;
|
||||
y = event->y()*pixelRatio;
|
||||
GLint viewport[4];
|
||||
GLdouble modelview[16];
|
||||
GLdouble projection[16];
|
||||
@ -1139,8 +1141,9 @@ void YACReaderFlowGL::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
makeCurrent();
|
||||
float x,y;
|
||||
x = event->x();
|
||||
y = event->y();
|
||||
float pixelRatio = devicePixelRatio();
|
||||
x = event->x()*pixelRatio;
|
||||
y = event->y()*pixelRatio;
|
||||
GLint viewport[4];
|
||||
GLdouble modelview[16];
|
||||
GLdouble projection[16];
|
||||
|
@ -339,7 +339,8 @@ void YACReaderFlowGL::resizeGL(int width, int height)
|
||||
|
||||
void YACReaderFlowGL::udpatePerspective(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
float pixelRatio = devicePixelRatio();
|
||||
glViewport(0, 0, width*pixelRatio, height*pixelRatio);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
@ -1078,8 +1079,9 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event)
|
||||
if(event->button() == Qt::LeftButton)
|
||||
{
|
||||
float x,y;
|
||||
x = event->x();
|
||||
y = event->y();
|
||||
float pixelRatio = devicePixelRatio();
|
||||
x = event->x()*pixelRatio;
|
||||
y = event->y()*pixelRatio;
|
||||
GLint viewport[4];
|
||||
GLdouble modelview[16];
|
||||
GLdouble projection[16];
|
||||
@ -1113,8 +1115,9 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event)
|
||||
void YACReaderFlowGL::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
float x,y;
|
||||
x = event->x();
|
||||
y = event->y();
|
||||
float pixelRatio = devicePixelRatio();
|
||||
x = event->x()*pixelRatio;
|
||||
y = event->y()*pixelRatio;
|
||||
GLint viewport[4];
|
||||
GLdouble modelview[16];
|
||||
GLdouble projection[16];
|
||||
|
Reference in New Issue
Block a user