mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-07-05 15:22:52 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
c9f7531f17 | |||
dc1655a2d7 | |||
cb4919d5bd | |||
affb818f4e | |||
851ed76e26 |
@ -1,4 +1,4 @@
|
|||||||
version: 4.0.{build}
|
version: 4.1.{build}
|
||||||
|
|
||||||
configuration:
|
configuration:
|
||||||
- Release
|
- Release
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -7,7 +7,3 @@ moc_*.cpp
|
|||||||
moc_*.h
|
moc_*.h
|
||||||
qrc_*.cpp
|
qrc_*.cpp
|
||||||
Makefile*
|
Makefile*
|
||||||
|
|
||||||
# lib
|
|
||||||
libpbf.so
|
|
||||||
libpbf.dylib
|
|
||||||
|
@ -2,7 +2,7 @@ TARGET = pbf
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
CONFIG += plugin
|
CONFIG += plugin
|
||||||
QT += gui
|
QT += gui
|
||||||
VERSION = 4.0
|
VERSION = 4.1
|
||||||
|
|
||||||
HEADERS += src/pbfhandler.h \
|
HEADERS += src/pbfhandler.h \
|
||||||
src/data.h \
|
src/data.h \
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
struct CTX
|
struct CTX
|
||||||
{
|
{
|
||||||
CTX(const QByteArray &ba)
|
CTX(const QByteArray &ba)
|
||||||
: bp(ba.constData()), be(bp + ba.size()) {}
|
: bp(ba.constData()), be(bp + ba.size()), tag(0) {}
|
||||||
|
|
||||||
const char *bp;
|
const char *bp;
|
||||||
const char *be;
|
const char *be;
|
||||||
@ -60,7 +60,14 @@ static bool str(CTX &ctx, QByteArray &val)
|
|||||||
if (ctx.bp + len > ctx.be)
|
if (ctx.bp + len > ctx.be)
|
||||||
return false;
|
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);
|
val = QByteArray::fromRawData(ctx.bp, len);
|
||||||
|
#endif
|
||||||
ctx.bp += len;
|
ctx.bp += len;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QJsonValue>
|
||||||
|
|
||||||
class QJsonObject;
|
class QJsonObject;
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ static QImage sdf2img(const QImage &sdf, const QColor &color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Sprites::Sprite::Sprite(const QJsonObject &json)
|
Sprites::Sprite::Sprite(const QJsonObject &json)
|
||||||
|
: _pixelRatio(1.0), _sdf(false)
|
||||||
{
|
{
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
|
|
||||||
@ -44,16 +45,10 @@ Sprites::Sprite::Sprite(const QJsonObject &json)
|
|||||||
|
|
||||||
_rect = QRect(x, y, width, height);
|
_rect = QRect(x, y, width, height);
|
||||||
|
|
||||||
|
|
||||||
if (json.contains("pixelRatio") && json["pixelRatio"].isDouble())
|
if (json.contains("pixelRatio") && json["pixelRatio"].isDouble())
|
||||||
_pixelRatio = json["pixelRatio"].toDouble();
|
_pixelRatio = json["pixelRatio"].toDouble();
|
||||||
else
|
|
||||||
_pixelRatio = 1.0;
|
|
||||||
|
|
||||||
if (json.contains("sdf") && json["sdf"].isBool())
|
if (json.contains("sdf") && json["sdf"].isBool())
|
||||||
_sdf = json["sdf"].toBool();
|
_sdf = json["sdf"].toBool();
|
||||||
else
|
|
||||||
_sdf = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sprites::load(const QString &jsonFile, const QString &imageFile)
|
bool Sprites::load(const QString &jsonFile, const QString &imageFile)
|
||||||
|
Reference in New Issue
Block a user