Mercurial > hg > svgui
comparison layer/SliceLayer.cpp @ 1284:51e6125627fa
Hack to ensure vertical scale lines are in the right place in pixel-doubling rendering
| author | Chris Cannam | 
|---|---|
| date | Tue, 08 May 2018 14:27:54 +0100 | 
| parents | fc9d9f1103fa | 
| children | d79e21855aef | 
   comparison
  equal
  deleted
  inserted
  replaced
| 1283:6e35062fc10a | 1284:51e6125627fa | 
|---|---|
| 371 paint.setBrush(Qt::NoBrush); | 371 paint.setBrush(Qt::NoBrush); | 
| 372 | 372 | 
| 373 if (v->getViewManager() && v->getViewManager()->shouldShowScaleGuides()) { | 373 if (v->getViewManager() && v->getViewManager()->shouldShowScaleGuides()) { | 
| 374 if (!m_scalePoints.empty()) { | 374 if (!m_scalePoints.empty()) { | 
| 375 paint.setPen(QColor(240, 240, 240)); //!!! and dark background? | 375 paint.setPen(QColor(240, 240, 240)); //!!! and dark background? | 
| 376 int ratio = int(round(double(v->getPaintHeight()) / | |
| 377 m_scalePaintHeight)); | |
| 376 for (int i = 0; i < (int)m_scalePoints.size(); ++i) { | 378 for (int i = 0; i < (int)m_scalePoints.size(); ++i) { | 
| 377 paint.drawLine(0, m_scalePoints[i], rect.width(), m_scalePoints[i]); | 379 paint.drawLine(0, m_scalePoints[i] * ratio, | 
| 380 rect.width(), m_scalePoints[i] * ratio); | |
| 378 } | 381 } | 
| 379 } | 382 } | 
| 380 } | 383 } | 
| 381 | 384 | 
| 382 if (m_plotStyle == PlotBlocks) { | 385 if (m_plotStyle == PlotBlocks) { | 
| 552 (paint, actual, thresh, 1.0 / m_gain, | 555 (paint, actual, thresh, 1.0 / m_gain, | 
| 553 PaintAssistant::Scale(m_energyScale), | 556 PaintAssistant::Scale(m_energyScale), | 
| 554 mult, | 557 mult, | 
| 555 const_cast<std::vector<int> *>(&m_scalePoints)); | 558 const_cast<std::vector<int> *>(&m_scalePoints)); | 
| 556 | 559 | 
| 560 // Ugly hack (but then everything about this scale drawing is a | |
| 561 // bit ugly). In pixel-doubling hi-dpi scenarios, the scale is | |
| 562 // painted at pixel-doubled resolution but we do explicit | |
| 563 // pixel-doubling ourselves when painting the layer content. We | |
| 564 // make a note of this here so that we can compare with the | |
| 565 // equivalent dimension in the paint method when deciding where to | |
| 566 // place scale continuation lines. | |
| 567 m_scalePaintHeight = v->getPaintHeight(); | |
| 568 | |
| 557 if (mult != 1 && mult != 0) { | 569 if (mult != 1 && mult != 0) { | 
| 558 int log = int(lrint(log10(mult))); | 570 int log = int(lrint(log10(mult))); | 
| 559 QString a = tr("x10"); | 571 QString a = tr("x10"); | 
| 560 QString b = QString("%1").arg(-log); | 572 QString b = QString("%1").arg(-log); | 
| 561 paint.drawText(3, 8 + paint.fontMetrics().ascent(), a); | 573 paint.drawText(3, 8 + paint.fontMetrics().ascent(), a); | 
