mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-07-04 23:09:29 +02:00
Optimization/code cleanup
This commit is contained in:
13
src/text.cpp
13
src/text.cpp
@ -32,24 +32,23 @@ void Text::addLabel(const QString &text, const QImage &icon,
|
||||
_maxWidth, _anchor, icon);
|
||||
else
|
||||
ti = new TextPathItem(text, path, _font, _maxAngle, _sceneRect);
|
||||
if (!_sceneRect.contains(ti->boundingRect()))
|
||||
ti->setVisible(false);
|
||||
break;
|
||||
case LineCenter:
|
||||
ti = new TextPointItem(text, path.pointAtPercent(0.5), _font,
|
||||
_maxWidth, _anchor, icon);
|
||||
if (!_sceneRect.contains(ti->boundingRect()))
|
||||
ti->setVisible(false);
|
||||
break;
|
||||
default:
|
||||
ti = new TextPointItem(text, path.elementAt(0), _font, _maxWidth,
|
||||
_anchor, icon);
|
||||
if (_alignment == Viewport
|
||||
&& !_sceneRect.contains(ti->boundingRect()))
|
||||
ti->setVisible(false);
|
||||
break;
|
||||
}
|
||||
|
||||
// Note: empty path == point geometry (single move)
|
||||
if (!path.isEmpty() && !_sceneRect.contains(ti->boundingRect())) {
|
||||
delete ti;
|
||||
return;
|
||||
}
|
||||
|
||||
ti->setPen(_pen);
|
||||
addItem(ti);
|
||||
|
||||
|
Reference in New Issue
Block a user