kis_stroke_benchmark.h 3.59 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 *  Copyright (c) 2010 Lukáš Tvrdý lukast.dev@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.
 */

#ifndef KIS_STROKE_BENCHMARK_H
#define KIS_STROKE_BENCHMARK_H

22
#include <QtTest>
23 24
#include <kis_types.h>
#include <KoColor.h>
25
#include <kis_painter.h>
26
#include <brushengine/kis_paint_information.h>
27 28
#include <kis_image.h>
#include <kis_layer.h>
29

30

31
const QString PRESET_FILE_NAME = "hairy-benchmark1.kpp";
32 33 34 35 36 37 38

class KisStrokeBenchmark : public QObject
{
    Q_OBJECT
private:
    const KoColorSpace * m_colorSpace;
    KoColor m_color;
39 40
    KisImageSP m_image;
    KisLayerSP m_layer;
41

42 43 44 45 46
    KisPainter * m_painter;

    KisPaintInformation m_pi1;
    KisPaintInformation m_pi2;
    KisPaintInformation m_pi3;
47

48 49 50 51 52 53
    QPointF m_c1;
    QPointF m_c2;

    QVector<QPointF> m_startPoints;
    QVector<QPointF> m_endPoints;

54 55 56 57
    QVector<QPoint> m_rectangleLeftLowerCorners;
    QVector<QPoint> m_rectangleRightUpperCorners;


58 59
    void initCurvePoints(int width, int height);
    void initLines(int width, int height);
60
    void initRectangles(int width, int height);
61

62 63
    QString m_dataPath;
    QString m_outputPath;
64

65 66 67 68
    private:
        inline void benchmarkRandomLines(QString presetFileName);
        inline void benchmarkStroke(QString presetFileName);
        inline void benchmarkLine(QString presetFileName);
69
        inline void benchmarkCircle(QString presetFileName);
70
        inline void benchmarkRectangle(QString presetFileName);
71

72
private Q_SLOTS:
73 74
    void initTestCase();
    void cleanupTestCase();
75

76
    void init();
77

78
    // AutoBrush
79 80
    void pixelbrush300px();
    void pixelbrush300pxRL();
81

82 83 84
    // Soft brush benchmarks
    void softbrushDefault30();
    void softbrushDefault30RL();
85
    void softbrushCircle30();
86 87
    void softbrushFullFeatures30();
    void softbrushFullFeatures30RL();
88

89 90
    void softbrushSoftness();
    void softbrushOpacity();
91

92 93 94
    // Hairy brush benchmarks
    void hairy30pxDefault();
    void hairy30pxDefaultRL();
95

96 97 98 99 100
    void hairy30pxAntiAlias();
    void hairy30pxAntiAliasRL();

    void hairy30px30density();
    void hairy30px30densityRL();
101

102 103
    void hairy30InkDepletion();
    void hairy30InkDepletionRL();
104

105 106 107
    // Spray brush benchmark1
    void spray30px21particles();
    void spray30px21particlesRL();
108

109 110
    void sprayPencil();
    void sprayPencilRL();
111

112 113
    void sprayPixels();
    void sprayPixelsRL();
114

115 116
    void sprayTexture();
    void sprayTextureRL();
117

118 119
    void dynabrush();
    void dynabrushRL();
120

121 122
    void deformBrush();
    void deformBrushRL();
123 124

    void experimental();
125
    void experimentalCircle();
126 127 128

    void colorsmudge();
    void colorsmudgeRL();
129 130 131 132 133 134 135 136 137

    void roundMarker();
    void roundMarkerRandomLines();
    void roundMarkerRectangle();

    void roundMarkerHalfPixel();
    void roundMarkerRandomLinesHalfPixel();
    void roundMarkerRectangleHalfPixel();

138
/*
139 140
    void predefinedBrush();
    void predefinedBrushRL();
141
*/
142 143
    void benchmarkRand();
    void benchmarkRand48();
144 145

    void becnhmarkPresetCloning();
146 147 148
};

#endif