| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QSGSOFTWAREINTERNALRECTANGLENODE_H |
| 5 | #define QSGSOFTWAREINTERNALRECTANGLENODE_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <private/qsgadaptationlayer_p.h> |
| 19 | |
| 20 | #include <QPen> |
| 21 | #include <QBrush> |
| 22 | #include <QPixmap> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | class QSGSoftwareInternalRectangleNode : public QSGInternalRectangleNode |
| 27 | { |
| 28 | public: |
| 29 | QSGSoftwareInternalRectangleNode(); |
| 30 | |
| 31 | void setRect(const QRectF &rect) override; |
| 32 | void setColor(const QColor &color) override; |
| 33 | void setPenColor(const QColor &color) override; |
| 34 | void setPenWidth(qreal width) override; |
| 35 | void setGradientStops(const QGradientStops &stops) override; |
| 36 | void setGradientVertical(bool vertical) override; |
| 37 | void setRadius(qreal radius) override; |
| 38 | void setTopLeftRadius(qreal radius) override; |
| 39 | void setTopRightRadius(qreal radius) override; |
| 40 | void setBottomLeftRadius(qreal radius) override; |
| 41 | void setBottomRightRadius(qreal radius) override; |
| 42 | void setAntialiasing(bool antialiasing) override { Q_UNUSED(antialiasing); } |
| 43 | void setAligned(bool aligned) override; |
| 44 | |
| 45 | void update() override; |
| 46 | |
| 47 | void paint(QPainter *); |
| 48 | |
| 49 | bool isOpaque() const; |
| 50 | QRectF rect() const; |
| 51 | private: |
| 52 | void paintRectangle(QPainter *painter, const QRect &rect); |
| 53 | void paintRectangleIndividualCorners(QPainter *painter, const QRect &rect); |
| 54 | void generateCornerPixmap(); |
| 55 | |
| 56 | QRect m_rect; |
| 57 | QColor m_color; |
| 58 | QColor m_penColor; |
| 59 | qreal m_penWidth; |
| 60 | QGradientStops m_stops; |
| 61 | qreal m_radius; |
| 62 | qreal m_topLeftRadius; |
| 63 | qreal m_topRightRadius; |
| 64 | qreal m_bottomLeftRadius; |
| 65 | qreal m_bottomRightRadius; |
| 66 | QPen m_pen; |
| 67 | QBrush m_brush; |
| 68 | bool m_vertical; |
| 69 | |
| 70 | bool m_cornerPixmapIsDirty; |
| 71 | QPixmap m_cornerPixmap; |
| 72 | |
| 73 | qreal m_devicePixelRatio; |
| 74 | }; |
| 75 | |
| 76 | QT_END_NAMESPACE |
| 77 | |
| 78 | #endif // QSGSOFTWAREINTERNALRECTANGLENODE_H |
| 79 | |