Skip to content

Commit

Permalink
Fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
J5lx committed Nov 25, 2023
1 parent f7dbcfd commit a7ab2a6
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
2 changes: 2 additions & 0 deletions core_lib/src/external/macosx/macosx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ namespace PlatformHandler

void initialise()
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
}
}

Expand Down
4 changes: 4 additions & 0 deletions core_lib/src/graphics/bitmap/tiledbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ struct TileIndex {
int y;
};

#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
inline uint qHash(const TileIndex &key, uint seed)
#else
inline size_t qHash(const TileIndex &key, size_t seed)
#endif
{
return qHash(key.x, seed) ^ key.y;
}
Expand Down
7 changes: 4 additions & 3 deletions core_lib/src/managers/viewmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,12 @@ void ViewManager::scaleUp()

void ViewManager::scaleDown()
{
for (size_t i = gZoomLevels.size() - 1; i >= 0; --i)
const size_t nZoomLevels = gZoomLevels.size();
for (size_t i = 1; i <= nZoomLevels; i++)
{
if (mScaling > gZoomLevels[i])
if (mScaling > gZoomLevels[nZoomLevels - i])
{
scale(gZoomLevels[i]);
scale(gZoomLevels[nZoomLevels - i]);
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions core_lib/src/tool/cameratool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ void CameraTool::paintInterpolations(QPainter& painter, const QTransform& worldT
painter.save();
QColor color = cameraDotColor;
if (currentFrame > frame && currentFrame < nextFrame)
color.setAlphaF(0.5);
color.setAlphaF(.5f);
else
color.setAlphaF(0.2);
color.setAlphaF(.2f);
painter.setPen(Qt::black);
painter.setBrush(color);

Expand Down
5 changes: 2 additions & 3 deletions core_lib/src/tool/strokemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ QPointF StrokeManager::interpolateStart(QPointF firstPoint)
// Clear queue
strokeQueue.clear();
pressureQueue.clear();

const int sampleSize = 5;
Q_ASSERT(sampleSize > 0);

Expand Down Expand Up @@ -334,8 +334,7 @@ QList<QPointF> StrokeManager::meanInpolOp(QList<QPointF> points, qreal x, qreal
pressure /= strokeQueue.size();

// Use our interpolated points
QPointF mNewInterpolated = mLastInterpolated;
mNewInterpolated = QPointF(x, y);
QPointF mNewInterpolated(x, y);

points << mLastPixel << mLastInterpolated << mNewInterpolated << mCurrentPixel;

Expand Down
18 changes: 9 additions & 9 deletions core_lib/src/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GNU General Public License for more details.
#include <QApplication>
#include <QStandardPaths>

static inline bool clipInfiniteLineToEdge(qreal& t0, qreal& t1, qreal p, qreal q)
static inline bool clipLineToEdge(qreal& t0, qreal& t1, qreal p, qreal q)
{
if (p < 0) { // Line entering the clipping window
t0 = qMax(t0, q / p);
Expand All @@ -37,14 +37,14 @@ QLineF clipLine(const QLineF& line, const QRect& clip, qreal t0, qreal t1)
int left = clip.left(), right = left + clip.width(), top = clip.top(), bottom = top + clip.height();
qreal x1 = line.x1(), x2 = line.x2(), dx = line.dx(), y1 = line.y1(), y2 = line.y2(), dy = line.dy();

if (t0 == 0 && t1 == 1 && (x1 < left && x2 < left ||
x1 > right && x2 > right ||
y1 < top && y2 < top ||
y1 > bottom && y2 > bottom) ||
!clipInfiniteLineToEdge(t0, t1, -dx, x1 - left) ||
!clipInfiniteLineToEdge(t0, t1, dx, right - x1) ||
!clipInfiniteLineToEdge(t0, t1, -dy, y1 - top) ||
!clipInfiniteLineToEdge(t0, t1, dy, bottom - y1)) {
if ((t0 == 0 && t1 == 1 && ((x1 < left && x2 < left) ||
(x1 > right && x2 > right) ||
(y1 < top && y2 < top) ||
(y1 > bottom && y2 > bottom))) ||
!clipLineToEdge(t0, t1, -dx, x1 - left) ||
!clipLineToEdge(t0, t1, dx, right - x1) ||
!clipLineToEdge(t0, t1, -dy, y1 - top) ||
!clipLineToEdge(t0, t1, dy, bottom - y1)) {
return {};
}

Expand Down

0 comments on commit a7ab2a6

Please sign in to comment.