Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_paint_device_debug_utils.h File Reference
#include <kis_types.h>
#include <kritaimage_export.h>

Go to the source code of this file.

Macros

#define KIS_DUMP_DEVICE_1(device, rc, suffix)
 
#define KIS_DUMP_DEVICE_2(device, rc, suffix, prefix)
 

Functions

void KRITAIMAGE_EXPORT kis_debug_save_device_incremental (KisPaintDeviceSP device, int i, const QRect &rc, const QString &suffix, const QString &prefix)
 

Macro Definition Documentation

◆ KIS_DUMP_DEVICE_1

#define KIS_DUMP_DEVICE_1 ( device,
rc,
suffix )
Value:
do { \
static int i = -1; i++; \
kis_debug_save_device_incremental((device), i, (rc), (suffix), QString()); \
} while(0)

Saves the paint device incrementally. Put this macro into a function that is called several times and you'll have as many separate dump files as the number of times the function was called. That is very convenient for debugging canvas updates: adding this macro will let you track the whole history of updates.

The files are saved with pattern: <counter>_<suffix>.png

Definition at line 31 of file kis_paint_device_debug_utils.h.

31#define KIS_DUMP_DEVICE_1(device, rc, suffix) \
32 do { \
33 static int i = -1; i++; \
34 kis_debug_save_device_incremental((device), i, (rc), (suffix), QString()); \
35 } while(0)

◆ KIS_DUMP_DEVICE_2

#define KIS_DUMP_DEVICE_2 ( device,
rc,
suffix,
prefix )
Value:
do { \
static int i = -1; i++; \
kis_debug_save_device_incremental((device), i, (rc), (suffix), (prefix)); \
} while(0)

Saves the paint device incrementally. Put this macro into a function that is called several times and you'll have as many separate dump files as the number of times the function was called. That is very convenient for debugging canvas updates: adding this macro will let you track the whole history of updates.

The prefix parameter makes it easy to sort out dumps from different functions.

The files are saved with pattern: <prefix>_<counter>_<suffix>.png

Definition at line 49 of file kis_paint_device_debug_utils.h.

49#define KIS_DUMP_DEVICE_2(device, rc, suffix, prefix) \
50 do { \
51 static int i = -1; i++; \
52 kis_debug_save_device_incremental((device), i, (rc), (suffix), (prefix)); \
53 } while(0)

Function Documentation

◆ kis_debug_save_device_incremental()

void KRITAIMAGE_EXPORT kis_debug_save_device_incremental ( KisPaintDeviceSP device,
int i,
const QRect & rc,
const QString & suffix,
const QString & prefix )

Definition at line 15 of file kis_paint_device_debug_utils.cpp.

19{
20 QString filename = QString("%1_%2.png").arg(i).arg(suffix);
21
22 if (!prefix.isEmpty()) {
23 filename = QString("%1_%2.png").arg(prefix).arg(filename);
24 }
25
26 QRect saveRect(rc);
27
28 if (saveRect.isEmpty()) {
29 saveRect = device->exactBounds();
30 }
31
32 qDebug() << "Dumping:" << filename;
33 device->convertToQImage(0, saveRect).save(filename);
34}
QRect exactBounds() const
QImage convertToQImage(const KoColorProfile *dstProfile, qint32 x, qint32 y, qint32 w, qint32 h, KoColorConversionTransformation::Intent renderingIntent=KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::ConversionFlags conversionFlags=KoColorConversionTransformation::internalConversionFlags()) const

References KisPaintDevice::convertToQImage(), and KisPaintDevice::exactBounds().