Commit 97f4ad43 authored by Boudewijn Rempt's avatar Boudewijn Rempt

make pigment use qdebug

parent 4cc2f65e
......@@ -9,7 +9,10 @@ if (WIN32)
endif ()
if (HAVE_VC)
# put KDELibs4Support include directories before aany include directory that might be same with KDELibs4 include directory to avoid compiler picking KDELibs4 headers
message(".>>>>>>>>>>>>" ${KDE4_INCLUDES})
#set(SPLIT_INCLUDES list(APPEND _flags "$<$<BOOL:${KDE4_INCLUDES}>:-I$<JOIN:${KDE4_INCLUDES}, -I>>"))
#message(">>>>>>>>>>>>>>>>>>>>>>>>>>>" << ${SPLIT_INCLUDES})
# put KDELibs4Support include directories before any include directory that might be same with KDELibs4 include directory to avoid compiler picking KDELibs4 headers
include_directories(${KDE4_INCLUDES} ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${PIGMENT_INCLUDES} ${Boost_INCLUDE_DIR})
else()
include_directories( ${PIGMENT_INCLUDES} ${Boost_INCLUDE_DIR})
......@@ -38,6 +41,7 @@ add_subdirectory(tests)
add_subdirectory(benchmarks)
set(pigmentcms_SRCS
DebugPigment.cpp
KoBasicHistogramProducers.cpp
KoColor.cpp
KoColorDisplayRendererInterface.cpp
......
/*
* Copyright (c) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "pigment_debug.h"
Q_LOGGING_CATEGORY(PIGMENT_log, "log_pigment")
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.bet
* Copyright (c) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _DEBUG_PIGMENT_H_
#define _DEBUG_PIGMENT_H_
#include <kdebug.h>
#include <QDebug>
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(PIGMENT_log)
#define DBG_PIGMENT 30008
#define dbgPigment kDebug( 30008 )
#define dbgPigment qCDebug(PIGMENT_log)
#define dbgPigmentCCS dbgPigment
#define dbgPigmentCSRegistry dbgPigment
#define dbgPigmentCS dbgPigment
#define warnPigment kWarning( 30008 )
#define errorPigment kError( 30008 )
#define warnPigment qCWarning(PIGMENT_log)
#define errorPigment qCCritical(PIGMENT_log)
#endif
......@@ -205,7 +205,7 @@ void KoColor::fromQColor(const QColor& c) const
#ifndef NDEBUG
void KoColor::dump() const
{
//dbgPigment <<"KoColor (" << this <<")," << d->colorSpace->id().name() <<"";
dbgPigment <<"KoColor (" << this <<")," << d->colorSpace->id().name() <<"";
QList<KoChannelInfo *> channels = d->colorSpace->channels();
QList<KoChannelInfo *>::const_iterator begin = channels.constBegin();
......@@ -216,13 +216,13 @@ void KoColor::dump() const
// XXX: setNum always takes a byte.
if (ch->size() == sizeof(quint8)) {
// Byte
//dbgPigment <<"Channel (byte):" << ch->name() <<":" << QString().setNum(d->data[ch->pos()]) <<"";
dbgPigment <<"Channel (byte):" << ch->name() <<":" << QString().setNum(d->data[ch->pos()]) <<"";
} else if (ch->size() == sizeof(quint16)) {
// Short (may also by an nvidia half)
//dbgPigment <<"Channel (short):" << ch->name() <<":" << QString().setNum(*((const quint16 *)(d->data+ch->pos()))) <<"";
dbgPigment <<"Channel (short):" << ch->name() <<":" << QString().setNum(*((const quint16 *)(d->data+ch->pos()))) <<"";
} else if (ch->size() == sizeof(quint32)) {
// Integer (may also be float... Find out how to distinguish these!)
//dbgPigment <<"Channel (int):" << ch->name() <<":" << QString().setNum(*((const quint32 *)(d->data+ch->pos()))) <<"";
dbgPigment <<"Channel (int):" << ch->name() <<":" << QString().setNum(*((const quint32 *)(d->data+ch->pos()))) <<"";
}
}
}
......
......@@ -159,7 +159,7 @@ public:
static QString toQString(const KoColor &color);
#ifndef NODEBUG
/// use kDebug calls to print internal info
/// use qDebug calls to print internal info
void dump() const;
#endif
......
......@@ -528,7 +528,7 @@ void HSIToRGB(const qreal h,const qreal s, const qreal i, qreal *red, qreal *gre
b=0.0;
}
//qDebug()<<"red: "<<r<<", green: "<<g<<", blue: "<<b;
//dbgPigment<<"red: "<<r<<", green: "<<g<<", blue: "<<b;
if (r>1.0){r=1.0;}
if (g>1.0){g=1.0;}
if (b>1.0){b=1.0;}
......@@ -739,7 +739,7 @@ void HSYToRGB(const qreal h,const qreal s, const qreal y, qreal *red, qreal *gre
b=0.0;
}
//qDebug()<<"red: "<<r<<", green: "<<g<<", blue: "<<b;
//dbgPigment<<"red: "<<r<<", green: "<<g<<", blue: "<<b;
if (r>1.0){r=1.0;}
if (g>1.0){g=1.0;}
if (b>1.0){b=1.0;}
......
......@@ -19,9 +19,9 @@
#pragma GCC diagnostic ignored "-Wundef"
#include "KoOptimizedCompositeOpFactoryPerArch.h"
#include <QString>
#include "DebugPigment.h"
#include "KoOptimizedCompositeOpFactoryPerArch.h"
#include "KoOptimizedCompositeOpAlphaDarken32.h"
#include "KoOptimizedCompositeOpOver32.h"
......
......@@ -44,5 +44,5 @@ template<>
KoReportCurrentArch::ReturnType
KoReportCurrentArch::create<Vc::ScalarImpl>(ParamType)
{
qDebug() << "Legacy integer arithmetics implementation";
dbgPigment << "Legacy integer arithmetics implementation";
}
......@@ -32,7 +32,7 @@
#include <QByteArray>
#include <QPainter>
#include <kdebug.h>
#include <DebugPigment.h>
#include <klocale.h>
#include "KoColor.h"
......@@ -173,13 +173,13 @@ bool KoColorSet::init()
m_colors.clear(); // just in case this is a reload (eg by KoEditColorSetDialog),
if (filename().isNull()) {
qWarning() << "Cannot load palette" << name() << "there is no filename set";
warnPigment << "Cannot load palette" << name() << "there is no filename set";
return false;
}
if (m_data.isNull()) {
QFile file(filename());
if (file.size() == 0) {
qWarning() << "Cannot load palette" << name() << "there is no data available";
warnPigment << "Cannot load palette" << name() << "there is no data available";
return false;
}
file.open(QIODevice::ReadOnly);
......
......@@ -37,7 +37,7 @@
#include <QBuffer>
#include <QTextStream>
#include <kdebug.h>
#include <DebugPigment.h>
#include <klocale.h>
namespace
......
......@@ -35,7 +35,7 @@
#include "KoColorSpace.h"
#include "KoMixColorsOp.h"
#include <kdebug.h>
#include <DebugPigment.h>
#include <klocale.h>
KoGradientSegment::RGBColorInterpolationStrategy *KoGradientSegment::RGBColorInterpolationStrategy::m_instance = 0;
......@@ -104,7 +104,7 @@ bool KoSegmentGradient::loadFromDevice(QIODevice *dev)
numSegmentsText = nameDefinition;
}
kDebug(30009) << "Loading gradient: " << name();
dbgPigment << "Loading gradient: " << name();
int numSegments;
bool ok;
......@@ -115,7 +115,7 @@ bool KoSegmentGradient::loadFromDevice(QIODevice *dev)
return false;
}
kDebug(30009) << "Number of segments = " << numSegments;
dbgPigment << "Number of segments = " << numSegments;
const KoColorSpace* rgbColorSpace = KoColorSpaceRegistry::instance()->rgb8();
......
......@@ -29,7 +29,7 @@
#include <QCryptographicHash>
#include <klocale.h>
#include <kdebug.h>
#include <DebugPigment.h>
#include "KoColorSpaceRegistry.h"
#include "KoMixColorsOp.h"
......
......@@ -24,7 +24,7 @@
#include <k4aboutdata.h>
#include <kcmdlineargs.h>
#include <kapplication.h>
#include <kdebug.h>
#include <DebugPigment.h>
#include "KoColorSpaceRegistry.h"
#include "KoColorConversionSystem.h"
......@@ -56,7 +56,7 @@ int main(int argc, char** argv)
KCmdLineArgs::addCmdLineOptions(options);
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->isSet("graphs")) {
// Don't change those lines to use qDebug derivatives, they need to be outputed
// Don't change those lines to use dbgPigment derivatives, they need to be outputed
// to stdout not stderr.
std::cout << "full : show all the connection on the graph" << std::endl;
std::cout << "bestpath : show the best path for a given transformation" << std::endl;
......
......@@ -22,7 +22,7 @@
#include "KoColorModelStandardIds.h"
#include <qtest_kde.h>
#include <kdebug.h>
#include <DebugPigment.h>
#include <string.h>
#include "KoColor.h"
......@@ -155,7 +155,7 @@ void KoRgbU8ColorSpaceTester::testCompositeOps()
if (depthId.id().contains("Float")) continue;
kDebug() << depthId.id();
dbgPigment << depthId.id();
const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace(
RGBAColorModelID.id(), depthId.id(), "");
......@@ -170,7 +170,7 @@ void KoRgbU8ColorSpaceTester::testCompositeOps()
src.fromQColor(red);
dst.fromQColor(blue);
qDebug() << src.toQColor() << dst.toQColor();
dbgPigment << src.toQColor() << dst.toQColor();
QVERIFY(memcmp(dst.data(), src.data(), cs->pixelSize()) != 0);
......@@ -251,14 +251,14 @@ void KoRgbU8ColorSpaceTester::testCompositeOpsWithChannelFlags()
* before increasing alpha of the pixel
*/
if (badDst[3] != 0 && badDst[2] != 0) {
qDebug() << op->id()
dbgPigment << op->id()
<< "easy case:" << goodDst[2]
<< "difficult case:" << badDst[2];
qDebug() << "The composite op has failed to erase the color "
dbgPigment << "The composite op has failed to erase the color "
"channel which was hidden by zero alpha.";
qDebug() << "Expected Blue channel:" << 0;
qDebug() << "Actual Blue channel: " << badDst[2];
dbgPigment << "Expected Blue channel:" << 0;
dbgPigment << "Actual Blue channel: " << badDst[2];
QFAIL("Failed to erase color channel");
}
......
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