From 1c961d09fdd9902104b7726bd2423fa6d2b7db8d Mon Sep 17 00:00:00 2001 From: shun_iwasawa Date: Oct 16 2017 13:26:34 +0000 Subject: fix offset --- diff --git a/toonz/sources/toonz/imageviewer.cpp b/toonz/sources/toonz/imageviewer.cpp index d65d15a..f4abded 100644 --- a/toonz/sources/toonz/imageviewer.cpp +++ b/toonz/sources/toonz/imageviewer.cpp @@ -425,6 +425,8 @@ void ImageViewer::initializeGL() { //----------------------------------------------------------------------------- void ImageViewer::resizeGL(int w, int h) { + w *= getDevPixRatio(); + h *= getDevPixRatio(); glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); diff --git a/toonz/sources/toonz/sceneviewer.cpp b/toonz/sources/toonz/sceneviewer.cpp index 996bab5..e2658e5 100644 --- a/toonz/sources/toonz/sceneviewer.cpp +++ b/toonz/sources/toonz/sceneviewer.cpp @@ -874,6 +874,8 @@ void SceneViewer::initializeGL() { //----------------------------------------------------------------------------- void SceneViewer::resizeGL(int w, int h) { + w *= getDevPixRatio(); + h *= getDevPixRatio(); glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); diff --git a/toonz/sources/toonzqt/gutil.cpp b/toonz/sources/toonzqt/gutil.cpp index 6192875..8c5e4c9 100644 --- a/toonz/sources/toonzqt/gutil.cpp +++ b/toonz/sources/toonzqt/gutil.cpp @@ -77,8 +77,7 @@ QPixmap rasterToQPixmap(const TRaster32P &ras, bool premultiplied, bool setDevPixRatio) { QPixmap pixmap = QPixmap::fromImage(rasterToQImage(ras, premultiplied)); if (setDevPixRatio) { - static int devPixRatio = QApplication::desktop()->devicePixelRatio(); - pixmap.setDevicePixelRatio(devPixRatio); + pixmap.setDevicePixelRatio(getDevPixRatio()); } return pixmap; } @@ -158,7 +157,7 @@ QPixmap scalePixmapKeepingAspectRatio(QPixmap pixmap, QSize size, QPixmap svgToPixmap(const QString &svgFilePath, const QSize &size, Qt::AspectRatioMode aspectRatioMode, QColor bgColor) { - static int devPixRatio = QApplication::desktop()->devicePixelRatio(); + static int devPixRatio = getDevPixRatio(); QSvgRenderer svgRenderer(svgFilePath); QSize pixmapSize; QRectF renderRect; diff --git a/toonz/sources/toonzqt/planeviewer.cpp b/toonz/sources/toonzqt/planeviewer.cpp index 40b0644..2ec1559 100644 --- a/toonz/sources/toonzqt/planeviewer.cpp +++ b/toonz/sources/toonzqt/planeviewer.cpp @@ -133,6 +133,8 @@ void PlaneViewer::drawBackground() { void PlaneViewer::initializeGL() { initializeOpenGLFunctions(); } void PlaneViewer::resizeGL(int width, int height) { + width *= getDevPixRatio(); + height *= getDevPixRatio(); glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp index 847d19d..86aadf6 100644 --- a/toonz/sources/toonzqt/styleeditor.cpp +++ b/toonz/sources/toonzqt/styleeditor.cpp @@ -600,6 +600,8 @@ void HexagonalColorWheel::initializeGL() { //----------------------------------------------------------------------------- void HexagonalColorWheel::resizeGL(int w, int h) { + w *= getDevPixRatio(); + h *= getDevPixRatio(); float d = (w - 5.0f) / 2.5f; bool isHorizontallyLong = ((d * 1.732f) < h) ? false : true;