Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_wrapped_random_accessor.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2013 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
9#include "kis_wrapped_rect.h"
10
11
13 qint32 offsetX, qint32 offsetY,
14 bool writable,
15 KisIteratorCompleteListener *completeListener,
16 const QRect &wrapRect,
17 const WrapAroundAxis wrapAroundModeAxis)
18 : KisRandomAccessor2(ktm, offsetX, offsetY, writable, completeListener),
19 m_wrapRect(wrapRect),
20 m_currentPos(QPoint()),
21 m_wrapAxis(wrapAroundModeAxis)
22{
23}
24
34
36{
39 }
41 qint32 distanceToBorder = m_wrapRect.x() + m_wrapRect.width() - x;
42
43 return qMin(distanceToBorder, KisRandomAccessor2::numContiguousColumns(x));
44}
45
47{
50 }
52 qint32 distanceToBorder = m_wrapRect.y() + m_wrapRect.height() - y;
53
54 return qMin(distanceToBorder, KisRandomAccessor2::numContiguousRows(y));
55}
56
63
65{
66 return m_currentPos.x();
67}
68
70{
71 return m_currentPos.y();
72}
WrapAroundAxis
@ WRAPAROUND_HORIZONTAL
@ WRAPAROUND_VERTICAL
qint32 numContiguousRows(qint32 y) const override
qint32 rowStride(qint32 x, qint32 y) const override
qint32 numContiguousColumns(qint32 x) const override
void moveTo(qint32 x, qint32 y) override
Move to a given x,y position, fetch tiles and data.
KisWrappedRandomAccessor(KisTiledDataManager *ktm, qint32 offsetX, qint32 offsetY, bool writable, KisIteratorCompleteListener *completeListener, const QRect &wrapRect, const WrapAroundAxis wrapAroundModeAxis)
void moveTo(qint32 x, qint32 y) override
Move to a given x,y position, fetch tiles and data.
qint32 numContiguousColumns(qint32 x) const override
qint32 rowStride(qint32 x, qint32 y) const override
qint32 numContiguousRows(qint32 y) const override
The KisIteratorCompleteListener struct is a special interface for notifying the paint device that an ...
static int yToWrappedY(int y, const QRect &wrapRect, WrapAroundAxis wrapAxis)
static int xToWrappedX(int x, const QRect &wrapRect, WrapAroundAxis wrapAxis)