mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-04-19 03:59:10 +02:00
Compare commits
No commits in common. "master" and "4.0" have entirely different histories.
@ -1,4 +1,4 @@
|
||||
version: 4.2.{build}
|
||||
version: 4.0.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
2
.github/workflows/android.yml
vendored
2
.github/workflows/android.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
||||
- name: Configure build
|
||||
run: qmake pbfplugin.pro
|
||||
- name: Build project
|
||||
run: make -j4
|
||||
run: make -j2
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
9
.github/workflows/linux.yml
vendored
9
.github/workflows/linux.yml
vendored
@ -8,10 +8,7 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
name: QtPBFImagePlugin
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
config: ['release', 'debug']
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@ -20,6 +17,6 @@ jobs:
|
||||
sudo apt-get update
|
||||
sudo apt-get install qtbase5-dev qtbase5-dev-tools qt5-qmake zlib1g-dev
|
||||
- name: Configure build
|
||||
run: qmake CONFIG+=${{ matrix.config }} pbfplugin.pro
|
||||
run: qmake pbfplugin.pro
|
||||
- name: Build project
|
||||
run: make -j4
|
||||
run: make -j2
|
||||
|
2
.github/workflows/osx.yml
vendored
2
.github/workflows/osx.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: '6.8.2'
|
||||
version: '6.8.1'
|
||||
- name: Configure build
|
||||
run: qmake pbfplugin.pro QMAKE_APPLE_DEVICE_ARCHS="x86_64h arm64"
|
||||
- name: Build project
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -7,3 +7,7 @@ moc_*.cpp
|
||||
moc_*.h
|
||||
qrc_*.cpp
|
||||
Makefile*
|
||||
|
||||
# lib
|
||||
libpbf.so
|
||||
libpbf.dylib
|
||||
|
@ -67,7 +67,7 @@ repository.
|
||||
|
||||
## Build
|
||||
### Requirements
|
||||
* Qt5 >= 5.15 or Qt6
|
||||
* Qt5 >= 5.11 or Qt6
|
||||
* Zlib
|
||||
|
||||
### Build steps
|
||||
|
@ -2,7 +2,7 @@ TARGET = pbf
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin
|
||||
QT += gui
|
||||
VERSION = 4.2
|
||||
VERSION = 4.0
|
||||
|
||||
HEADERS += src/pbfhandler.h \
|
||||
src/data.h \
|
||||
|
@ -11,7 +11,7 @@
|
||||
struct CTX
|
||||
{
|
||||
CTX(const QByteArray &ba)
|
||||
: bp(ba.constData()), be(bp + ba.size()), tag(0) {}
|
||||
: bp(ba.constData()), be(bp + ba.size()) {}
|
||||
|
||||
const char *bp;
|
||||
const char *be;
|
||||
@ -60,14 +60,7 @@ static bool str(CTX &ctx, QByteArray &val)
|
||||
if (ctx.bp + len > ctx.be)
|
||||
return false;
|
||||
|
||||
/* In Qt5 the (later) conversion to QString is broken when the QByteArray is
|
||||
not nul terminated so we have to use the "deep copy" constructor that
|
||||
nul-terminates the byte array when it is created. */
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
val = QByteArray(ctx.bp, len);
|
||||
#else
|
||||
val = QByteArray::fromRawData(ctx.bp, len);
|
||||
#endif
|
||||
ctx.bp += len;
|
||||
|
||||
return true;
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <QColor>
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
#include <QJsonValue>
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
|
@ -22,7 +22,6 @@ static QImage sdf2img(const QImage &sdf, const QColor &color)
|
||||
}
|
||||
|
||||
Sprites::Sprite::Sprite(const QJsonObject &json)
|
||||
: _pixelRatio(1.0), _sdf(false)
|
||||
{
|
||||
int x, y, width, height;
|
||||
|
||||
@ -45,10 +44,16 @@ Sprites::Sprite::Sprite(const QJsonObject &json)
|
||||
|
||||
_rect = QRect(x, y, width, height);
|
||||
|
||||
|
||||
if (json.contains("pixelRatio") && json["pixelRatio"].isDouble())
|
||||
_pixelRatio = json["pixelRatio"].toDouble();
|
||||
else
|
||||
_pixelRatio = 1.0;
|
||||
|
||||
if (json.contains("sdf") && json["sdf"].isBool())
|
||||
_sdf = json["sdf"].toBool();
|
||||
else
|
||||
_sdf = false;
|
||||
}
|
||||
|
||||
bool Sprites::load(const QString &jsonFile, const QString &imageFile)
|
||||
|
@ -2,6 +2,13 @@
|
||||
#include <QPainter>
|
||||
#include "textpathitem.h"
|
||||
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
#define INTERSECTS intersect
|
||||
#else // QT 5.15
|
||||
#define INTERSECTS intersects
|
||||
#endif // QT 5.15
|
||||
|
||||
static void swap(const QLineF &line, QPointF *p1, QPointF *p2)
|
||||
{
|
||||
|
||||
@ -23,10 +30,10 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
|
||||
{
|
||||
QPointF *p = p1;
|
||||
|
||||
if (line.intersects(QLineF(rect.topLeft(), rect.topRight()), p)
|
||||
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.topRight()), p)
|
||||
== QLineF::BoundedIntersection)
|
||||
p = p2;
|
||||
if (line.intersects(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
||||
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
||||
== QLineF::BoundedIntersection) {
|
||||
if (p == p2) {
|
||||
swap(line, p1, p2);
|
||||
@ -34,7 +41,7 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
|
||||
}
|
||||
p = p2;
|
||||
}
|
||||
if (line.intersects(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
||||
== QLineF::BoundedIntersection) {
|
||||
if (p == p2) {
|
||||
swap(line, p1, p2);
|
||||
@ -42,7 +49,7 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
|
||||
}
|
||||
p = p2;
|
||||
}
|
||||
if (line.intersects(QLineF(rect.bottomRight(), rect.topRight()), p)
|
||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.topRight()), p)
|
||||
== QLineF::BoundedIntersection) {
|
||||
if (p == p2) {
|
||||
swap(line, p1, p2);
|
||||
@ -57,16 +64,16 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
|
||||
|
||||
static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p)
|
||||
{
|
||||
if (line.intersects(QLineF(rect.topLeft(), rect.topRight()), p)
|
||||
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.topRight()), p)
|
||||
== QLineF::BoundedIntersection)
|
||||
return true;
|
||||
if (line.intersects(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
||||
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
||||
== QLineF::BoundedIntersection)
|
||||
return true;
|
||||
if (line.intersects(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
||||
== QLineF::BoundedIntersection)
|
||||
return true;
|
||||
if (line.intersects(QLineF(rect.bottomRight(), rect.topRight()), p)
|
||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.topRight()), p)
|
||||
== QLineF::BoundedIntersection)
|
||||
return true;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user