Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

fix offset

shun_iwasawa1c961d09fdd9
diff --git a/toonz/sources/toonz/imageviewer.cpp b/toonz/sources/toonz/imageviewer.cpp
index d65d15ad3..f4abded84 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 996bab510..e2658e5ec 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 6192875f7..8c5e4c922 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 40b06443a..2ec155933 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 847d19deb..86aadf6d8 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;