diff options
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; } |
