Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt 6: Fixed tile rendering when OpenGL is enabled #3585

Merged
merged 1 commit into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* Defold plugin: Allow overriding z value also when exporting to .collection (#3214)
* Qt 6: Fixed invisible tileset tabs when only a single tileset is open
* Qt 6: Fixed behavior of "Class of" selection popup
* Qt 6: Fixed tile rendering when OpenGL is enabled (#3578)
* Fixed positioning of point object name labels (by Logan Higinbotham, #3400)
* Fixed slight drift when zooming the map view in/out
* Fixed compile against Qt 6.4
Expand Down
1 change: 0 additions & 1 deletion src/libtiled/isometricrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "mapobject.h"
#include "tile.h"
#include "tilelayer.h"
#include "tileset.h"
#include "objectgroup.h"

#include <QtMath>
Expand Down
10 changes: 8 additions & 2 deletions src/libtiled/maprenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,13 @@ void CellRenderer::render(const Cell &cell, const QPointF &screenPos, const QSiz
fragment.scaleX *= flippedHorizontally ? -1 : 1;
fragment.scaleY *= flippedVertically ? -1 : 1;

// Avoid using drawPixmapFragments with OpenGL in Qt 6.4.1 and above
// (https://bugreports.qt.io/browse/QTBUG-111416)
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 1)
if (mIsOpenGL || (fragment.scaleX > 0 && fragment.scaleY > 0)) {
#else
if (!mIsOpenGL && fragment.scaleX > 0 && fragment.scaleY > 0) {
#endif
mTile = tile;
mFragments.append(fragment);
return;
Expand Down Expand Up @@ -525,7 +531,7 @@ void CellRenderer::render(const Cell &cell, const QPointF &screenPos, const QSiz
mFragments.append(fragment);
paintTileCollisionShapes();
mTile = nullptr;
mFragments.resize(0);
mFragments.clear();
}
}

Expand All @@ -548,7 +554,7 @@ void CellRenderer::flush()
}

mTile = nullptr;
mFragments.resize(0);
mFragments.clear();
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/libtiled/orthogonalrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "mapobject.h"
#include "tile.h"
#include "tilelayer.h"
#include "tileset.h"
#include "objectgroup.h"

#include <QtCore/qmath.h>
Expand Down
2 changes: 1 addition & 1 deletion src/libtiledquick/tilelayeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ QSGNode *TileLayerItem::updatePaintNode(QSGNode *node,
if (tileset != helper.tileset() || tileData.size() == TilesNode::MaxTileCount) {
if (!tileData.isEmpty()) {
node->appendChildNode(new TilesNode(helper.texture(), tileData));
tileData.resize(0);
tileData.clear();
}

helper.setTileset(tileset);
Expand Down