mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
KAT image writing optimization
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
e011d9d5f5
commit
dc30442cb6
1 changed files with 2 additions and 5 deletions
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include "qimage.h"
|
#include "qimage.h"
|
||||||
#include "qimage_p.h"
|
#include "qimage_p.h"
|
||||||
#include "qbuffer.h"
|
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
#include "qcorecommon_p.h"
|
#include "qcorecommon_p.h"
|
||||||
|
|
||||||
|
@ -165,9 +164,7 @@ bool QKatHandler::write(const QImage &image)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QBuffer imagebuffer;
|
QDataStream imagestream(device());
|
||||||
imagebuffer.open(QBuffer::ReadWrite);
|
|
||||||
QDataStream imagestream(&imagebuffer);
|
|
||||||
imagestream.writeRawData("KATIE", 5);
|
imagestream.writeRawData("KATIE", 5);
|
||||||
imagestream << (qint8) image32.format();
|
imagestream << (qint8) image32.format();
|
||||||
imagestream << (qint64) image32.width();
|
imagestream << (qint64) image32.width();
|
||||||
|
@ -176,7 +173,7 @@ bool QKatHandler::write(const QImage &image)
|
||||||
imagestream << (quint32) compresult;
|
imagestream << (quint32) compresult;
|
||||||
imagestream.writeRawData(compressedimage.constData(), compresult);
|
imagestream.writeRawData(compressedimage.constData(), compresult);
|
||||||
|
|
||||||
if (Q_UNLIKELY(device()->write(imagebuffer.data(), imagebuffer.size()) != imagebuffer.size())) {
|
if (Q_UNLIKELY(imagestream.status() != QDataStream::Ok)) {
|
||||||
qWarning("QKatHandler::write() Could not write image");
|
qWarning("QKatHandler::write() Could not write image");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue