Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_default_bounds.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2010 Boudewijn Rempt <boud@valdyas.org>
3 * SPDX-FileCopyrightText: 2010 Dmitry Kazakov <dimula73@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8
9#include "kis_global.h"
10#include "kis_default_bounds.h"
11#include "kis_paint_device.h"
13#include "kis_image.h"
14
15
18
19
20/******************************************************************/
21/* KisDefaultBounds */
22/******************************************************************/
23
24struct Q_DECL_HIDDEN KisDefaultBounds::Private
25{
27};
28
33
35 : m_d(new Private())
36{
37 m_d->image = image;
38}
39
44
46{
50 return m_d->image ? m_d->image->effectiveLodBounds() : infiniteRect;
51}
52
54{
55 return m_d->image ? m_d->image->wrapAroundModeActive() : false;
56}
57
59{
60 return m_d->image ? m_d->image->wrapAroundModeAxis() : WRAPAROUND_BOTH;
61}
62
64{
65 return m_d->image ? m_d->image->currentLevelOfDetail() : 0;
66}
67
69{
70 KisImageAnimationInterface *interface = m_d->image ? m_d->image->animationInterface() : 0;
71 return interface ? interface->currentTime() : 0;
72}
73
75{
76 KisImageAnimationInterface *interface = m_d->image ? m_d->image->animationInterface() : 0;
77 return interface ? interface->externalFrameActive() : false;
78}
79
81{
82 return m_d->image.data();
83}
84
85/******************************************************************/
86/* KisSelectionDefaultBoundsBase */
87/******************************************************************/
88
92
96
98{
99 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
100
101 return parentDevice ?
102 parentDevice->extent() | parentDevice->defaultBounds()->bounds() : QRect();
103}
104
106{
107 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
108
109 return parentDevice ? parentDevice->defaultBounds()->bounds() : QRect();
110}
111
113{
114 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
115
116 return parentDevice ? parentDevice->defaultBounds()->wrapAroundMode() : false;
117}
118
120{
121 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
122
123 return parentDevice ? parentDevice->defaultBounds()->wrapAroundModeAxis() : WRAPAROUND_BOTH;
124}
125
127{
128 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
129
130 return parentDevice ? parentDevice->defaultBounds()->currentLevelOfDetail() : 0;
131}
132
134{
135 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
136
137 return parentDevice ? parentDevice->defaultBounds()->currentTime() : 0;
138}
139
141{
142 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
143
144 return parentDevice ? parentDevice->defaultBounds()->externalFrameActive() : false;
145}
146
148{
149 KisPaintDeviceSP parentDevice = this->parentPaintDevice();
150
151 return parentDevice.data();
152}
153
154/******************************************************************/
155/* KisSelectionDefaultBounds */
156/******************************************************************/
157
159 : m_paintDevice(parentPaintDevice)
160{
161}
162
166
171
172/******************************************************************/
173/* KisMaskDefaultBounds */
174/******************************************************************/
175
176
178 : m_parentNode(parentNode)
179{
180}
181
185
187{
188 KisNodeSP parentNode = m_parentNode;
189
190 return parentNode ? parentNode->original() : nullptr;
191}
192
193/******************************************************************/
194/* KisSelectionEmptyBounds */
195/******************************************************************/
196
201
206
210
212{
213 return QRect(0, 0, 0, 0);
214}
215
216/******************************************************************/
217/* KisWrapAroundBoundsWrapper */
218/******************************************************************/
219
220
226
233
237
239{
240 return m_d->bounds;
241}
242
244{
245 return true;
246}
247
249{
250 return m_d->base->wrapAroundModeAxis();
251}
252
254{
255 return m_d->base->currentLevelOfDetail();
256}
257
259{
260 return m_d->base->currentTime();
261}
262
264{
265 return m_d->base->externalFrameActive();
266}
267
269{
270 return m_d->base->sourceCookie();
271}
WrapAroundAxis
@ WRAPAROUND_BOTH
virtual bool externalFrameActive() const =0
virtual WrapAroundAxis wrapAroundModeAxis() const =0
virtual int currentLevelOfDetail() const =0
virtual bool wrapAroundMode() const =0
virtual int currentTime() const =0
virtual QRect bounds() const =0
KisMaskDefaultBounds(KisNodeSP parentNode)
virtual KisPaintDeviceSP parentPaintDevice() const override
QRect extent() const
KisDefaultBoundsBaseSP defaultBounds() const
bool externalFrameActive() const override
QRect imageBorderRect() const override
WrapAroundAxis wrapAroundModeAxis() const override
int currentLevelOfDetail() const override
void * sourceCookie() const override
KisSelectionDefaultBounds(KisPaintDeviceSP parentPaintDevice)
virtual KisPaintDeviceSP parentPaintDevice() const override
QRect bounds() const override
#define bounds(x, a, b)
const qint32 qint32_MIN
Definition kis_global.h:30
const qint32 qint32_MAX
Definition kis_global.h:29
typedef void(QOPENGLF_APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC)(GLuint buffer)
virtual KisPaintDeviceSP original() const =0
int currentLevelOfDetail() const override
void * sourceCookie() const override
static const QRect infiniteRect
WrapAroundAxis wrapAroundModeAxis() const override
int currentTime() const override
bool wrapAroundMode() const override
QRect bounds() const override
bool externalFrameActive() const override
The KisWrapAroundBoundsWrapper class wrapper around a KisDefaultBoundsBaseSP to enable wraparound....
void * sourceCookie() const override
bool wrapAroundMode() const override
const QScopedPointer< Private > m_d
WrapAroundAxis wrapAroundModeAxis() const override
bool externalFrameActive() const override
int currentLevelOfDetail() const override
KisWrapAroundBoundsWrapper(KisDefaultBoundsBaseSP base, QRect bounds)