File indexing completed on 2024-05-12 15:58:32

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_PAINT_DEVICE_DEBUG_UTILS_H
0008 #define __KIS_PAINT_DEVICE_DEBUG_UTILS_H
0009 
0010 
0011 class QRect;
0012 class QString;
0013 
0014 #include <kis_types.h>
0015 #include <kritaimage_export.h>
0016 
0017 void KRITAIMAGE_EXPORT kis_debug_save_device_incremental(KisPaintDeviceSP device,
0018                                                          int i,
0019                                                          const QRect &rc,
0020                                                          const QString &suffix, const QString &prefix);
0021 
0022 /**
0023  * Saves the paint device incrementally. Put this macro into a
0024  * function that is called several times and you'll have as many
0025  * separate dump files as the number of times the function was
0026  * called. That is very convenient for debugging canvas updates:
0027  * adding this macro will let you track the whole history of updates.
0028  *
0029  * The files are saved with pattern: \<counter\>_\<suffix\>.png
0030  */
0031 #define KIS_DUMP_DEVICE_1(device, rc, suffix)                           \
0032     do {                                                                \
0033         static int i = -1; i++;                                         \
0034         kis_debug_save_device_incremental((device), i, (rc), (suffix), QString()); \
0035     } while(0)
0036 
0037 /**
0038  * Saves the paint device incrementally. Put this macro into a
0039  * function that is called several times and you'll have as many
0040  * separate dump files as the number of times the function was
0041  * called. That is very convenient for debugging canvas updates:
0042  * adding this macro will let you track the whole history of updates.
0043  *
0044  * The \p prefix parameter makes it easy to sort out dumps from
0045  * different functions.
0046  *
0047  * The files are saved with pattern: \<prefix\>_\<counter\>_\<suffix\>.png
0048  */
0049 #define KIS_DUMP_DEVICE_2(device, rc, suffix, prefix)                   \
0050     do {                                                                \
0051         static int i = -1; i++;                                         \
0052         kis_debug_save_device_incremental((device), i, (rc), (suffix), (prefix)); \
0053     } while(0)
0054 
0055 #endif /* __KIS_PAINT_DEVICE_DEBUG_UTILS_H */