changeset 1397:9ea551137329

Fix some incorrect pixel scaling
author Chris Cannam
date Wed, 14 Nov 2018 15:04:04 +0000
parents 2e316a724336
children f228bee4981c
files layer/SpectrumLayer.cpp view/Pane.cpp
diffstat 2 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/layer/SpectrumLayer.cpp	Wed Nov 14 14:29:08 2018 +0000
+++ b/layer/SpectrumLayer.cpp	Wed Nov 14 15:04:04 2018 +0000
@@ -802,10 +802,10 @@
             if (illuminateThis) {
                 int labelY = v->getPaintHeight() -
                     getHorizontalScaleHeight(v, paint) -
-                    paint.fontMetrics().height() * 3;
+                    paint.fontMetrics().height() * 4;
                 QString text = tr("%1 Hz").arg(freq);
                 int lw = paint.fontMetrics().width(text);
-                int gap = ViewManager::scalePixelSize(3);
+                int gap = ViewManager::scalePixelSize(v->getXForViewX(3));
                 double half = double(gap)/2.0;
                 int labelX = x - lw - gap;
                 if (labelX < getVerticalScaleWidth(v, false, paint)) {
--- a/view/Pane.cpp	Wed Nov 14 14:29:08 2018 +0000
+++ b/view/Pane.cpp	Wed Nov 14 15:04:04 2018 +0000
@@ -27,7 +27,6 @@
 #include "layer/WaveformLayer.h"
 #include "layer/TimeRulerLayer.h"
 #include "layer/PaintAssistant.h"
-#include "ViewProxy.h"
 
 // GF: added so we can propagate the mouse move event to the note layer for context handling.
 #include "layer/LayerFactory.h"
@@ -881,27 +880,29 @@
 void
 Pane::drawLayerNames(QRect r, QPainter &paint)
 {
-    ViewProxy proxy(this, effectiveDevicePixelRatio());
-    
     int fontHeight = paint.fontMetrics().height();
     int fontAscent = paint.fontMetrics().ascent();
 
     int lly = height() - 6;
+
+    int zoomWheelSkip = 0, horizontalScaleSkip = 0;
+
     if (m_manager->getZoomWheelsEnabled()) {
-        lly -= m_manager->scalePixelSize(20);
+        zoomWheelSkip = m_manager->scalePixelSize(20);
     }
 
     for (LayerList::iterator i = m_layerStack.end(); i != m_layerStack.begin();) {
         --i;
-        int hsh = (*i)->getHorizontalScaleHeight(&proxy, paint);
-        if (hsh > 0) {
-            lly -= hsh;
+        horizontalScaleSkip = (*i)->getHorizontalScaleHeight(this, paint);
+        if (horizontalScaleSkip > 0) {
             break;
         }
         if ((*i)->isLayerOpaque()) {
             break;
         }
     }
+
+    lly -= std::max(zoomWheelSkip, horizontalScaleSkip);
     
     if (r.y() + r.height() < lly - int(m_layerStack.size()) * fontHeight) {
         return;
@@ -1844,8 +1845,7 @@
     Layer *interactionLayer = getInteractionLayer();
     if (interactionLayer && !(interactionLayer->hasTimeXAxis())) {
         SVDEBUG << "Interaction layer does not have time X axis - delegating to it to decide what to do" << endl;
-        ViewProxy proxy(this, effectiveDevicePixelRatio());
-        interactionLayer->zoomToRegion(&proxy, r);
+        interactionLayer->zoomToRegion(this, r);
         return;
     }