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 #include "kis_paint_device_debug_utils.h"
0008 
0009 #include <QRect>
0010 #include <QImage>
0011 
0012 #include "kis_paint_device.h"
0013 
0014 
0015 void kis_debug_save_device_incremental(KisPaintDeviceSP device,
0016                                        int i,
0017                                        const QRect &rc,
0018                                        const QString &suffix, const QString &prefix)
0019 {
0020     QString filename = QString("%1_%2.png").arg(i).arg(suffix);
0021 
0022     if (!prefix.isEmpty()) {
0023         filename = QString("%1_%2.png").arg(prefix).arg(filename);
0024     }
0025 
0026     QRect saveRect(rc);
0027 
0028     if (saveRect.isEmpty()) {
0029         saveRect = device->exactBounds();
0030     }
0031 
0032     qDebug() << "Dumping:" << filename;
0033     device->convertToQImage(0, saveRect).save(filename);
0034 }