File indexing completed on 2024-04-28 04:21:32

0001 /*
0002  *  SPDX-FileCopyrightText: 2010 Lukáš Tvrdý lukast.dev @gmail.com
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIS_STROKE_BENCHMARK_H
0008 #define KIS_STROKE_BENCHMARK_H
0009 
0010 #include <simpletest.h>
0011 #include <kis_types.h>
0012 #include <KoColor.h>
0013 #include <kis_painter.h>
0014 #include <brushengine/kis_paint_information.h>
0015 #include <kis_image.h>
0016 #include <kis_layer.h>
0017 
0018 
0019 const QString PRESET_FILE_NAME = "hairy-benchmark1.kpp";
0020 
0021 class KisStrokeBenchmark : public QObject
0022 {
0023     Q_OBJECT
0024 private:
0025     const KoColorSpace * m_colorSpace;
0026     KoColor m_color;
0027     KisImageSP m_image;
0028     KisLayerSP m_layer;
0029 
0030     KisPainter * m_painter;
0031 
0032     KisPaintInformation m_pi1;
0033     KisPaintInformation m_pi2;
0034     KisPaintInformation m_pi3;
0035 
0036     QPointF m_c1;
0037     QPointF m_c2;
0038 
0039     QVector<QPointF> m_startPoints;
0040     QVector<QPointF> m_endPoints;
0041 
0042     QVector<QPoint> m_rectangleLeftLowerCorners;
0043     QVector<QPoint> m_rectangleRightUpperCorners;
0044 
0045 
0046     void initCurvePoints(int width, int height);
0047     void initLines(int width, int height);
0048     void initRectangles(int width, int height);
0049 
0050     QString m_dataPath;
0051     QString m_outputPath;
0052 
0053     private:
0054         inline void benchmarkRandomLines(QString presetFileName);
0055         inline void benchmarkStroke(QString presetFileName);
0056         inline void benchmarkLine(QString presetFileName);
0057         inline void benchmarkCircle(QString presetFileName);
0058         inline void benchmarkRectangle(QString presetFileName);
0059 
0060 private Q_SLOTS:
0061     void initTestCase();
0062     void cleanupTestCase();
0063 
0064     void init();
0065 
0066     // AutoBrush
0067     void pixelbrush300px();
0068     void pixelbrush300pxRL();
0069 
0070     // Soft brush benchmarks
0071     void softbrushDefault30();
0072     void softbrushDefault30RL();
0073     void softbrushCircle30();
0074     void softbrushFullFeatures30();
0075     void softbrushFullFeatures30RL();
0076 
0077     void softbrushSoftness();
0078     void softbrushOpacity();
0079 
0080     // Hairy brush benchmarks
0081     void hairy30pxDefault();
0082     void hairy30pxDefaultRL();
0083 
0084     void hairy30pxAntiAlias();
0085     void hairy30pxAntiAliasRL();
0086 
0087     void hairy30px30density();
0088     void hairy30px30densityRL();
0089 
0090     void hairy30InkDepletion();
0091     void hairy30InkDepletionRL();
0092 
0093     // Spray brush benchmark1
0094     void spray30px21particles();
0095     void spray30px21particlesRL();
0096 
0097     void sprayPencil();
0098     void sprayPencilRL();
0099 
0100     void sprayPixels();
0101     void sprayPixelsRL();
0102 
0103     void sprayTexture();
0104     void sprayTextureRL();
0105 
0106     void dynabrush();
0107     void dynabrushRL();
0108 
0109     void deformBrush();
0110     void deformBrushRL();
0111 
0112     void experimental();
0113     void experimentalCircle();
0114 
0115     void colorsmudge();
0116     void colorsmudgeRL();
0117 
0118     void roundMarker();
0119     void roundMarkerRandomLines();
0120     void roundMarkerRectangle();
0121 
0122     void roundMarkerHalfPixel();
0123     void roundMarkerRandomLinesHalfPixel();
0124     void roundMarkerRectangleHalfPixel();
0125 
0126 /*
0127     void predefinedBrush();
0128     void predefinedBrushRL();
0129 */
0130     void benchmarkRand();
0131     void benchmarkRand48();
0132 
0133     void benchmarkPresetCloning();
0134 };
0135 
0136 #endif