printing: remote incorrect scaling of event icons

It appears that this well intended change in commit 52aa7d83b6 ("Increase event
icon size in print mode") actually causes the scaling of the event icons to be
generally wrong. This removes the hard 4* scaling and also adds some debugging
output in verbose mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2021-07-11 12:06:28 -07:00
parent cfc87e9da3
commit 235ee4803f
2 changed files with 4 additions and 3 deletions

View file

@ -11,6 +11,7 @@
#include "core/membuffer.h"
#include "core/sample.h"
#include "core/subsurface-string.h"
#include <QDebug>
#define DEPTH_NOT_FOUND (-2342)
@ -50,6 +51,7 @@ struct event *DiveEventItem::getEventMutable()
void DiveEventItem::setupPixmap(struct gasmix lastgasmix, double fontPrintScale)
{
extern int verbose;
const IconMetrics& metrics = defaultIconMetrics();
#ifndef SUBSURFACE_MOBILE
int sz_bigger = metrics.sz_med + metrics.sz_small; // ex 40px
@ -65,6 +67,8 @@ void DiveEventItem::setupPixmap(struct gasmix lastgasmix, double fontPrintScale)
#endif
sz_bigger = lrint(sz_bigger * fontPrintScale);
int sz_pix = sz_bigger/2; // ex 20px
if (verbose)
qDebug() << __FUNCTION__ << "fontPrintScale" << fontPrintScale << "metrics" << metrics.sz_med << metrics.sz_small << "sz_bigger" << sz_bigger;
#define EVENT_PIXMAP(PIX) QPixmap(QString(PIX)).scaled(sz_pix, sz_pix, Qt::KeepAspectRatio, Qt::SmoothTransformation)
#define EVENT_PIXMAP_BIGGER(PIX) QPixmap(QString(PIX)).scaled(sz_bigger, sz_bigger, Qt::KeepAspectRatio, Qt::SmoothTransformation)

View file

@ -723,9 +723,6 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, bool doClearPict
#endif
DiveEventItem *item = new DiveEventItem(d, event, lastgasmix, dataModel, timeAxis, profileYAxis, animSpeed, getFontPrintScale());
item->setZValue(2);
#ifndef SUBSURFACE_MOBILE
item->setScale(printMode ? 4 :1);
#endif
scene()->addItem(item);
eventItems.push_back(item);
if (event_is_gaschange(event))