Commit ba30c6f4 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Added easy debugging routines for saving paint device incrementally

parent 27cccdcd
......@@ -56,6 +56,7 @@ endif(HAVE_VC)
set(kritaimage_LIB_SRCS
${libkritatile_SRCS}
kis_debug.cpp
kis_assert.cpp
kis_distance_information.cpp
kis_painter.cc
......
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* 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 "kis_debug.h"
#include <QRect>
#include <QString>
#include <QImage>
#include "kis_paint_device.h"
void kis_debug_save_device_incremental(KisPaintDeviceSP device,
int i,
const QRect &rc,
const QString &suffix, const QString &prefix)
{
QString filename = QString("%1_%2.png").arg(i).arg(suffix);
if (!prefix.isEmpty()) {
filename = QString("%1_%2.png").arg(prefix).arg(filename);
}
QRect saveRect(rc);
if (saveRect.isEmpty()) {
saveRect = device->exactBounds();
}
device->convertToQImage(0, saveRect).save(filename);
}
......@@ -92,4 +92,28 @@
# define Q_ASSERT(cond) if(!(cond)) { kError() << kBacktrace(); qt_assert(#cond,__FILE__,__LINE__); } qt_noop()
# endif
#include "krita_export.h"
#include "kis_types.h"
class QRect;
class QString;
void KRITAIMAGE_EXPORT kis_debug_save_device_incremental(KisPaintDeviceSP device,
int i,
const QRect &rc,
const QString &suffix, const QString &prefix);
#define KIS_DUMP_DEVICE_1(device, rc, suffix) \
do { \
static int i = -1; i++; \
kis_debug_save_device_incremental((device), i, (rc), (suffix), QString()); \
} while(0)
#define KIS_DUMP_DEVICE_2(device, rc, suffix, prefix) \
do { \
static int i = -1; i++; \
kis_debug_save_device_incremental((device), i, (rc), (suffix), (prefix)); \
} while(0)
#include "kis_assert.h"
......@@ -21,6 +21,7 @@
#include <QTransform>
#include <QDebug>
#include "kis_debug.h"
namespace KisDomUtils {
......@@ -95,7 +96,6 @@ void saveValue(QDomElement *parent, const QString &tag, const QTransform &t)
e.setAttribute("m32", t.m32());
e.setAttribute("m33", t.m33());
}
#include "kis_debug.h"
bool findOnlyElement(const QDomElement &parent, const QString &tag, QDomElement *el, QStringList *errorMessages)
{
......
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