Commit ab8f2ab3 authored by Halla Rempt's avatar Halla Rempt

Revert "Try to fix the background color for single-layer images only."

This reverts commit 8256a4d8574d14f07273b4d8e37a6414bc609cc6.

Tested by Mifth, and it didn;t work, so I shouldn't have pushed the
change.
parent d147dd43
......@@ -36,10 +36,6 @@
#include "kis_iterator_ng.h"
#include "kis_paint_device.h"
#include <QColor>
#include <KoColor.h>
#include <kis_painter.h>
PSDImageData::PSDImageData(PSDHeader *header)
{
m_header = header;
......@@ -222,27 +218,14 @@ bool PSDImageData::read(QIODevice *io, KisPaintDeviceSP dev ) {
return true;
}
bool PSDImageData::write(QIODevice *io, KisPaintDeviceSP dev, int nLayers)
bool PSDImageData::write(QIODevice *io, KisPaintDeviceSP dev)
{
QRect rc(0, 0, m_header->width, m_header->height);
if (nLayers == 1) {
// First fill all transparent pixels with white, instead of black
KisPaintDeviceSP tmp = new KisPaintDevice(dev->colorSpace());
KoColor c(Qt::white, dev->colorSpace());
tmp->fill(rc, c);
KisPainter gc(tmp);
gc.bitBlt(QPoint(0,0), dev, rc);
gc.end();
dev = tmp;
}
// XXX: make the compression settting configurable. For now, always use RLE.
psdwrite(io, (quint16)Compression::RLE);
// now write all the channels in display order
// fill in the channel chooser, in the display order, but store the pixel index as well.
QRect rc(0, 0, m_header->width, m_header->height);
QVector<quint8* > tmp = dev->readPlanarBytes(0, 0, rc.width(), rc.height());
// then reorder the planes to fit the psd model -- alpha first, then display order
QVector<quint8* > planes;
......
......@@ -38,7 +38,7 @@ public:
virtual ~PSDImageData();
bool read(QIODevice *io, KisPaintDeviceSP dev);
bool write(QIODevice *io, KisPaintDeviceSP dev, int nLayers);
bool write(QIODevice *io, KisPaintDeviceSP dev);
QString error;
......
......@@ -17,7 +17,6 @@
*/
#include "psd_saver.h"
#include <kapplication.h>
#include <kio/netaccess.h>
......@@ -207,7 +206,7 @@ KisImageBuilder_Result PSDSaver::buildFile(const KUrl& uri)
// IMAGE DATA
dbgFile << "Saving composited image" << f.pos();
PSDImageData imagedata(&header);
if (!imagedata.write(&f, m_image->projection(), m_image->rootLayer()->childCount())) {
if (!imagedata.write(&f, m_image->projection())) {
dbgFile << "Failed to write image data. Error:" << imagedata.error;
return KisImageBuilder_RESULT_FAILURE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment