diff options
| author | in1tiate <32779090+in1tiate@users.noreply.github.com> | 2024-05-20 09:03:16 -0500 |
|---|---|---|
| committer | in1tiate <32779090+in1tiate@users.noreply.github.com> | 2024-05-20 09:03:16 -0500 |
| commit | a23614059b67f57d7a2d66ad67aec6770dd3788d (patch) | |
| tree | 690be328a7d5bc5a9256545b62e9cd3491c05488 /src/aolayer.cpp | |
| parent | 6ff71de06b829f46eede5d697dae1b637e328795 (diff) | |
add missing code from rebase
Diffstat (limited to 'src/aolayer.cpp')
| -rw-r--r-- | src/aolayer.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/aolayer.cpp b/src/aolayer.cpp index 4ac7d486..a70e7b82 100644 --- a/src/aolayer.cpp +++ b/src/aolayer.cpp @@ -91,6 +91,7 @@ QPixmap AOLayer::get_pixmap(QImage image) // auto aspect_ratio = Qt::KeepAspectRatio; if (!f_pixmap.isNull()) { + scaling_factor = float(f_h) / float(f_pixmap.height()); if (f_pixmap.height() > f_h) // We are downscaling, use anti-aliasing. { transform_mode = Qt::SmoothTransformation; @@ -118,7 +119,6 @@ void AOLayer::center_pixmap(QPixmap f_pixmap) { if (g_center == -1) { - centered_offset = (f_w - f_pixmap.width()) / 2; QLabel::move(x + (f_w - f_pixmap.width()) / 2, y + (f_h - f_pixmap.height())); // Always center horizontally, always // put at the bottom vertically @@ -142,16 +142,13 @@ void AOLayer::center_pixmap(QPixmap f_pixmap) } } -int AOLayer::get_centered_offset() -{ - return centered_offset; -} - int AOLayer::get_pos_from_center(int f_center) { int center_scaled = int(float(f_center) * scaling_factor); int f_pos = x + (center_scaled - (f_w / 2)) * -1; +#ifdef DEBUG_MOVIE qDebug() << "centering image at center" << f_center << "final position" << f_pos; +#endif return f_pos; } |
