Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_tile_data_wrapper.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2009 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef __KIS_TILE_DATA_WRAPPER_H
8#define __KIS_TILE_DATA_WRAPPER_H
9
10
17{
18public:
23
29 qint32 x, qint32 y,
31 {
32 const qint32 col = dm->xToCol(x);
33 const qint32 row = dm->yToRow(y);
34
35 /* FIXME: Always positive? */
36 const qint32 xInTile = x - col * KisTileData::WIDTH;
37 const qint32 yInTile = y - row * KisTileData::HEIGHT;
38
39 const qint32 pixelIndex = xInTile + yInTile * KisTileData::WIDTH;
40
41 KisTileSP tile = dm->getTile(col, row, type == WRITE);
42
43 m_tile = tile;
44 m_offset = pixelIndex * dm->pixelSize();
45
46 if (type == READ) {
48 }
49 else {
51 }
52
53 m_type = type;
54 }
55
57 {
58 if (m_type == READ) {
60 } else {
62 }
63 }
64
70 inline qint32 offset() const
71 {
72 return m_offset;
73 }
74
78 inline KisTileSP& tile()
79 {
80 return m_tile;
81 }
82
90 inline quint8* data() const
91 {
92 return m_tile->data() + m_offset;
93 }
94
95private:
96 Q_DISABLE_COPY(KisTileDataWrapper)
97
99 qint32 m_offset;
101};
102#endif /* __KIS_TILE_DATA_WRAPPER_H */
KisTileDataWrapper::accessType m_type
KisTileDataWrapper(KisTiledDataManager *dm, qint32 x, qint32 y, enum KisTileDataWrapper::accessType type)
static const qint32 HEIGHT
static const qint32 WIDTH
void lockForWrite()
Definition kis_tile.cc:221
void lockForRead() const
Definition kis_tile.cc:208
void unlockForWrite()
Definition kis_tile.cc:264
void unlockForRead() const
Definition kis_tile.cc:275
quint8 * data() const
Definition kis_tile.h:85
qint32 yToRow(qint32 y) const
qint32 xToCol(qint32 x) const
KisTileSP getTile(qint32 col, qint32 row, bool writable)