| 1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). | 
| 2 | // Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies). | 
| 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only | 
| 4 |  | 
| 5 | #include "qscissortest.h" | 
| 6 | #include "qscissortest_p.h" | 
| 7 |  | 
| 8 | QT_BEGIN_NAMESPACE | 
| 9 |  | 
| 10 | namespace Qt3DRender { | 
| 11 |  | 
| 12 | /*! | 
| 13 |     \class Qt3DRender::QScissorTest | 
| 14 |     \brief The QScissorTest class discards fragments that fall outside of a | 
| 15 |     certain rectangular portion of the screen. | 
| 16 |     \since 5.7 | 
| 17 |     \ingroup renderstates | 
| 18 |     \inmodule Qt3DRender | 
| 19 |  | 
| 20 |     A QScissorTest class enables scissor test, which discards fragments outside | 
| 21 |     the rectangular area of the screen specified by the left, bottom, width and | 
| 22 |     height properties. | 
| 23 |  */ | 
| 24 |  | 
| 25 | /*! | 
| 26 |     \qmltype ScissorTest | 
| 27 |     \brief The ScissorTest type discards fragments that fall outside of a | 
| 28 |     certain rectangular portion of the screen. | 
| 29 |     \since 5.7 | 
| 30 |     \ingroup renderstates | 
| 31 |     \inqmlmodule Qt3D.Render | 
| 32 |     \nativetype Qt3DRender::QScissorTest | 
| 33 |     \inherits RenderState | 
| 34 |  | 
| 35 |     A ScissorTest type enables scissor test, which discards fragments outside | 
| 36 |     the rectangular area of the screen specified by the left, bottom, width and | 
| 37 |     height properties. | 
| 38 |  */ | 
| 39 |  | 
| 40 | /*! | 
| 41 |     \qmlproperty int ScissorTest::left | 
| 42 |     Holds the left coordinate of the scissor box. | 
| 43 | */ | 
| 44 |  | 
| 45 | /*! | 
| 46 |     \qmlproperty int ScissorTest::bottom | 
| 47 |     Holds the bottom coordinate of the scissor box. | 
| 48 | */ | 
| 49 |  | 
| 50 | /*! | 
| 51 |     \qmlproperty int ScissorTest::width | 
| 52 |     Holds the width of the scissor box. | 
| 53 | */ | 
| 54 |  | 
| 55 | /*! | 
| 56 |     \qmlproperty int ScissorTest::height | 
| 57 |     Holds the height of the scissor box. | 
| 58 | */ | 
| 59 |  | 
| 60 | /*! | 
| 61 |     \property Qt3DRender::QScissorTest::left | 
| 62 |     Holds the left coordinate of the scissor box. | 
| 63 | */ | 
| 64 |  | 
| 65 | /*! | 
| 66 |     \property Qt3DRender::QScissorTest::bottom | 
| 67 |     Holds the bottom coordinate of the scissor box. | 
| 68 | */ | 
| 69 |  | 
| 70 | /*! | 
| 71 |     \property Qt3DRender::QScissorTest::width | 
| 72 |     Holds the width of the scissor box. | 
| 73 | */ | 
| 74 |  | 
| 75 | /*! | 
| 76 |     \property Qt3DRender::QScissorTest::height | 
| 77 |     Holds the height of the scissor box. | 
| 78 | */ | 
| 79 |  | 
| 80 | /*! | 
| 81 |     The constructor creates a new QScissorTest::QScissorTest instance with the | 
| 82 |     specified \a parent | 
| 83 |  */ | 
| 84 | QScissorTest::QScissorTest(QNode *parent) | 
| 85 |     : QRenderState(*new QScissorTestPrivate, parent) | 
| 86 | { | 
| 87 | } | 
| 88 |  | 
| 89 | /*! \internal */ | 
| 90 | QScissorTest::~QScissorTest() | 
| 91 | { | 
| 92 | } | 
| 93 |  | 
| 94 | int QScissorTest::left() const | 
| 95 | { | 
| 96 |     Q_D(const QScissorTest); | 
| 97 |     return d->m_left; | 
| 98 | } | 
| 99 |  | 
| 100 | void QScissorTest::setLeft(int left) | 
| 101 | { | 
| 102 |     Q_D(QScissorTest); | 
| 103 |     if (d->m_left != left) { | 
| 104 |         d->m_left = left; | 
| 105 |         emit leftChanged(left); | 
| 106 |     } | 
| 107 | } | 
| 108 |  | 
| 109 | int QScissorTest::bottom() const | 
| 110 | { | 
| 111 |     Q_D(const QScissorTest); | 
| 112 |     return d->m_bottom; | 
| 113 | } | 
| 114 |  | 
| 115 | void QScissorTest::setBottom(int bottom) | 
| 116 | { | 
| 117 |     Q_D(QScissorTest); | 
| 118 |     if (d->m_bottom != bottom) { | 
| 119 |         d->m_bottom = bottom; | 
| 120 |         emit bottomChanged(bottom); | 
| 121 |     } | 
| 122 | } | 
| 123 |  | 
| 124 | int QScissorTest::width() const | 
| 125 | { | 
| 126 |     Q_D(const QScissorTest); | 
| 127 |     return d->m_width; | 
| 128 | } | 
| 129 |  | 
| 130 | void QScissorTest::setWidth(int width) | 
| 131 | { | 
| 132 |     Q_D(QScissorTest); | 
| 133 |     if (d->m_width != width) { | 
| 134 |         d->m_width = width; | 
| 135 |         emit widthChanged(width); | 
| 136 |     } | 
| 137 | } | 
| 138 |  | 
| 139 | int QScissorTest::height() const | 
| 140 | { | 
| 141 |     Q_D(const QScissorTest); | 
| 142 |     return d->m_height; | 
| 143 | } | 
| 144 |  | 
| 145 | void QScissorTest::setHeight(int height) | 
| 146 | { | 
| 147 |     Q_D(QScissorTest); | 
| 148 |     if (d->m_height != height) { | 
| 149 |         d->m_height = height; | 
| 150 |         emit heightChanged(height); | 
| 151 |     } | 
| 152 | } | 
| 153 |  | 
| 154 | } // namespace Qt3DRender | 
| 155 |  | 
| 156 | QT_END_NAMESPACE | 
| 157 |  | 
| 158 | #include "moc_qscissortest.cpp" | 
| 159 |  |