Krita Source Code Documentation
Loading...
Searching...
No Matches
KisTextureTileUpdateInfo Class Reference

#include <kis_texture_tile_update_info.h>

Public Member Functions

void convertTo (const KoColorSpace *dstCS, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags)
 
quint8 * data () const
 
bool isBottommost () const
 
bool isEntireTileUpdated () const
 
bool isLeftmost () const
 
bool isRightmost () const
 
bool isTopmost () const
 
 KisTextureTileUpdateInfo (KisTextureTileInfoPoolSP pool)
 
 KisTextureTileUpdateInfo (qint32 col, qint32 row, const QRect &tileRect, const QRect &updateRect, const QRect &currentImageRect, int levelOfDetail, KisTextureTileInfoPoolSP pool)
 
const KoColorSpacepatchColorSpace () const
 
int patchLevelOfDetail () const
 
quint32 patchPixelsLength () const
 
int pixelSize () const
 
void proofTo (const KoColorSpace *dstCS, KoColorConversionTransformation::ConversionFlags displayFlags, KoColorConversionTransformation *proofingTransform)
 
void putPixelData (DataBuffer &&buffer, const KoColorSpace *colorSpace)
 
QPoint realPatchOffset () const
 
QRect realPatchRect () const
 
QSize realPatchSize () const
 
QSize realTileSize () const
 
void retrieveData (KisPaintDeviceSP projectionDevice, const QBitArray &channelFlags, bool onlyOneChannelSelected, int selectedChannelIndex)
 
DataBuffer && takePixelData ()
 
qint32 tileCol () const
 
qint32 tileRow () const
 
bool valid () const
 
 ~KisTextureTileUpdateInfo ()
 

Static Public Member Functions

static KoColorConversionTransformationgenerateProofingTransform (const KoColorSpace *srcCS, const KoColorSpace *dstCS, const KoColorSpace *proofingSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::Intent proofingIntent, bool bpcFirstTransform, KoColor gamutWarning, KoColorConversionTransformation::ConversionFlags displayConversionFlags)
 

Private Attributes

QRect m_currentImageRect
 
QRect m_originalPatchRect
 
QRect m_originalTileRect
 
const KoColorSpacem_patchColorSpace {nullptr}
 
int m_patchLevelOfDetail {0}
 
DataBuffer m_patchPixels
 
QRect m_patchRect
 
KisTextureTileInfoPoolSP m_pool
 
QRect m_realPatchOffset
 
QRect m_realPatchRect
 
QRect m_realTileSize
 
qint32 m_tileCol {0}
 
QRect m_tileRect
 
qint32 m_tileRow {0}
 

Detailed Description

Definition at line 113 of file kis_texture_tile_update_info.h.

Constructor & Destructor Documentation

◆ KisTextureTileUpdateInfo() [1/2]

KisTextureTileUpdateInfo::KisTextureTileUpdateInfo ( KisTextureTileInfoPoolSP pool)
inline

Definition at line 116 of file kis_texture_tile_update_info.h.

117 : m_patchPixels(pool),
118 m_pool(pool)
119 {
120 }

◆ KisTextureTileUpdateInfo() [2/2]

KisTextureTileUpdateInfo::KisTextureTileUpdateInfo ( qint32 col,
qint32 row,
const QRect & tileRect,
const QRect & updateRect,
const QRect & currentImageRect,
int levelOfDetail,
KisTextureTileInfoPoolSP pool )
inline

Definition at line 122 of file kis_texture_tile_update_info.h.

126 : m_patchPixels(pool),
127 m_pool(pool)
128 {
129 m_tileCol = col;
130 m_tileRow = row;
131 m_tileRect = tileRect;
133 m_patchRect = m_tileRect & updateRect;
135 m_currentImageRect = currentImageRect;
136
137 m_patchLevelOfDetail = levelOfDetail;
138
140 // TODO: check if isBottommost() works correctly when m_originalPatchRect gets aligned
141 // and m_currentImageRect has non-aligned size
145 }
146 }
static QRect alignedRect(const QRect &srcRect, int lod)
static QRect scaledRect(const QRect &srcRect, int lod)

References KisLodTransformBase::alignedRect(), m_currentImageRect, m_originalPatchRect, m_originalTileRect, m_patchLevelOfDetail, m_patchRect, m_tileCol, m_tileRect, m_tileRow, and KisLodTransformBase::scaledRect().

◆ ~KisTextureTileUpdateInfo()

KisTextureTileUpdateInfo::~KisTextureTileUpdateInfo ( )
inline

Definition at line 148 of file kis_texture_tile_update_info.h.

148 {
149 }

Member Function Documentation

◆ convertTo()

void KisTextureTileUpdateInfo::convertTo ( const KoColorSpace * dstCS,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags )
inline

Definition at line 180 of file kis_texture_tile_update_info.h.

183 {
184 // we use two-stage check of the color space equivalence:
185 // first check pointers, and if not, check the spaces themselves
186 if ((dstCS == m_patchColorSpace || *dstCS == *m_patchColorSpace) &&
187 conversionFlags == KoColorConversionTransformation::Empty) {
188
189 return;
190 }
191
192 if (m_patchRect.isValid()) {
193 const qint32 numPixels = m_patchRect.width() * m_patchRect.height();
194 DataBuffer conversionCache(dstCS->pixelSize(), m_pool);
195
196 m_patchColorSpace->convertPixelsTo(m_patchPixels.data(), conversionCache.data(), dstCS, numPixels, renderingIntent, conversionFlags);
197
198 m_patchColorSpace = dstCS;
199 conversionCache.swap(m_patchPixels);
200 }
201 }
virtual quint32 pixelSize() const =0
virtual bool convertPixelsTo(const quint8 *src, quint8 *dst, const KoColorSpace *dstColorSpace, quint32 numPixels, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const

References KoColorSpace::convertPixelsTo(), DataBuffer::data(), KoColorConversionTransformation::Empty, m_patchColorSpace, m_patchPixels, m_patchRect, m_pool, KoColorSpace::pixelSize(), and DataBuffer::swap().

◆ data()

quint8 * KisTextureTileUpdateInfo::data ( ) const
inline

Definition at line 232 of file kis_texture_tile_update_info.h.

232 {
233 return m_patchPixels.data();
234 }

References DataBuffer::data(), and m_patchPixels.

◆ generateProofingTransform()

static KoColorConversionTransformation * KisTextureTileUpdateInfo::generateProofingTransform ( const KoColorSpace * srcCS,
const KoColorSpace * dstCS,
const KoColorSpace * proofingSpace,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::Intent proofingIntent,
bool bpcFirstTransform,
KoColor gamutWarning,
KoColorConversionTransformation::ConversionFlags displayConversionFlags )
inlinestatic

Definition at line 220 of file kis_texture_tile_update_info.h.

227 {
228 KoColor properGamutWarning = gamutWarning.convertedTo(dstCS);
229 return srcCS->createProofingTransform(dstCS, proofingSpace, renderingIntent, proofingIntent, bpcFirstTransform, properGamutWarning.data(), displayConversionFlags);
230 }
virtual KoColorConversionTransformation * createProofingTransform(const KoColorSpace *dstColorSpace, const KoColorSpace *proofingSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::Intent proofingIntent, bool bpcFirstTransform, quint8 *gamutWarning, KoColorConversionTransformation::ConversionFlags displayConversionFlags) const
createProofingTransform Create a proofing transform. This is a two part transform that can also do ga...
KoColor convertedTo(const KoColorSpace *cs, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const
Definition KoColor.cpp:163
quint8 * data()
Definition KoColor.h:144

References KoColor::convertedTo(), KoColorSpace::createProofingTransform(), and KoColor::data().

◆ isBottommost()

bool KisTextureTileUpdateInfo::isBottommost ( ) const
inline

Definition at line 269 of file kis_texture_tile_update_info.h.

269 {
270 return m_originalPatchRect.bottom() == m_currentImageRect.bottom();
271 }

References m_currentImageRect, and m_originalPatchRect.

◆ isEntireTileUpdated()

bool KisTextureTileUpdateInfo::isEntireTileUpdated ( ) const
inline

Definition at line 273 of file kis_texture_tile_update_info.h.

273 {
274 return m_patchRect == m_tileRect;
275 }

References m_patchRect, and m_tileRect.

◆ isLeftmost()

bool KisTextureTileUpdateInfo::isLeftmost ( ) const
inline

Definition at line 261 of file kis_texture_tile_update_info.h.

261 {
262 return m_originalPatchRect.left() == m_currentImageRect.left();
263 }

References m_currentImageRect, and m_originalPatchRect.

◆ isRightmost()

bool KisTextureTileUpdateInfo::isRightmost ( ) const
inline

Definition at line 265 of file kis_texture_tile_update_info.h.

265 {
266 return m_originalPatchRect.right() == m_currentImageRect.right();
267 }

References m_currentImageRect, and m_originalPatchRect.

◆ isTopmost()

bool KisTextureTileUpdateInfo::isTopmost ( ) const
inline

Definition at line 257 of file kis_texture_tile_update_info.h.

257 {
258 return m_originalPatchRect.top() == m_currentImageRect.top();
259 }

References m_currentImageRect, and m_originalPatchRect.

◆ patchColorSpace()

const KoColorSpace * KisTextureTileUpdateInfo::patchColorSpace ( ) const
inline

Definition at line 289 of file kis_texture_tile_update_info.h.

289 {
290 return m_patchColorSpace;
291 }

References m_patchColorSpace.

◆ patchLevelOfDetail()

int KisTextureTileUpdateInfo::patchLevelOfDetail ( ) const
inline

Definition at line 236 of file kis_texture_tile_update_info.h.

236 {
238 }

References m_patchLevelOfDetail.

◆ patchPixelsLength()

quint32 KisTextureTileUpdateInfo::patchPixelsLength ( ) const
inline

Definition at line 293 of file kis_texture_tile_update_info.h.

293 {
294 return m_patchPixels.size();
295 }

References m_patchPixels, and DataBuffer::size().

◆ pixelSize()

int KisTextureTileUpdateInfo::pixelSize ( ) const
inline

Definition at line 285 of file kis_texture_tile_update_info.h.

285 {
287 }

References m_patchColorSpace, and KoColorSpace::pixelSize().

◆ proofTo()

void KisTextureTileUpdateInfo::proofTo ( const KoColorSpace * dstCS,
KoColorConversionTransformation::ConversionFlags displayFlags,
KoColorConversionTransformation * proofingTransform )
inline

Definition at line 203 of file kis_texture_tile_update_info.h.

206 {
207 if (dstCS == m_patchColorSpace && displayFlags == KoColorConversionTransformation::Empty) return;
208
209 if (m_patchRect.isValid()) {
210 const qint32 numPixels = m_patchRect.width() * m_patchRect.height();
211 DataBuffer conversionCache(dstCS->pixelSize(), m_pool);
212
213 m_patchColorSpace->proofPixelsTo(m_patchPixels.data(), conversionCache.data(), numPixels, proofingTransform);
214
215 m_patchColorSpace = dstCS;
216 conversionCache.swap(m_patchPixels);
217 }
218 }
virtual bool proofPixelsTo(const quint8 *src, quint8 *dst, quint32 numPixels, KoColorConversionTransformation *proofingTransform) const
proofPixelsTo

References DataBuffer::data(), KoColorConversionTransformation::Empty, m_patchColorSpace, m_patchPixels, m_patchRect, m_pool, KoColorSpace::pixelSize(), KoColorSpace::proofPixelsTo(), and DataBuffer::swap().

◆ putPixelData()

void KisTextureTileUpdateInfo::putPixelData ( DataBuffer && buffer,
const KoColorSpace * colorSpace )
inline

Definition at line 305 of file kis_texture_tile_update_info.h.

305 {
306 m_patchPixels = std::move(buffer);
307 m_patchColorSpace = colorSpace;
308 }

References m_patchColorSpace, and m_patchPixels.

◆ realPatchOffset()

QPoint KisTextureTileUpdateInfo::realPatchOffset ( ) const
inline

Definition at line 240 of file kis_texture_tile_update_info.h.

240 {
241 return QPoint(m_patchRect.x() - m_tileRect.x(),
242 m_patchRect.y() - m_tileRect.y());
243 }

References m_patchRect, and m_tileRect.

◆ realPatchRect()

QRect KisTextureTileUpdateInfo::realPatchRect ( ) const
inline

Definition at line 249 of file kis_texture_tile_update_info.h.

249 {
250 return m_patchRect;
251 }

References m_patchRect.

◆ realPatchSize()

QSize KisTextureTileUpdateInfo::realPatchSize ( ) const
inline

Definition at line 245 of file kis_texture_tile_update_info.h.

245 {
246 return m_patchRect.size();
247 }

References m_patchRect.

◆ realTileSize()

QSize KisTextureTileUpdateInfo::realTileSize ( ) const
inline

Definition at line 253 of file kis_texture_tile_update_info.h.

253 {
254 return m_tileRect.size();
255 }

References m_tileRect.

◆ retrieveData()

void KisTextureTileUpdateInfo::retrieveData ( KisPaintDeviceSP projectionDevice,
const QBitArray & channelFlags,
bool onlyOneChannelSelected,
int selectedChannelIndex )
inline

Definition at line 151 of file kis_texture_tile_update_info.h.

152 {
153 m_patchColorSpace = projectionDevice->colorSpace();
155
156 projectionDevice->readBytes(m_patchPixels.data(),
157 m_patchRect.x(), m_patchRect.y(),
158 m_patchRect.width(), m_patchRect.height());
159
160 // XXX: if the paint colorspace is rgb, we should do the channel swizzling in
161 // the display shader
162 if (!channelFlags.isEmpty() && selectedChannelIndex >= 0 && selectedChannelIndex < m_patchColorSpace->channelCount()) {
163 DataBuffer conversionCache(m_patchColorSpace->pixelSize(), m_pool);
164
165 quint32 numPixels = m_patchRect.width() * m_patchRect.height();
166
167 KisConfig cfg(true);
168
169 if (onlyOneChannelSelected && !cfg.showSingleChannelAsColor()) {
170 m_patchColorSpace->convertChannelToVisualRepresentation(m_patchPixels.data(), conversionCache.data(), numPixels, selectedChannelIndex);
171 } else {
172 m_patchColorSpace->convertChannelToVisualRepresentation(m_patchPixels.data(), conversionCache.data(), numPixels, channelFlags);
173 }
174
175 conversionCache.swap(m_patchPixels);
176 }
177
178 }
void allocate(int pixelSize)
const KoColorSpace * colorSpace() const
void readBytes(quint8 *data, qint32 x, qint32 y, qint32 w, qint32 h) const
virtual void convertChannelToVisualRepresentation(const quint8 *src, quint8 *dst, quint32 nPixels, const qint32 selectedChannelIndex) const =0

References DataBuffer::allocate(), KisPaintDevice::colorSpace(), KoColorSpace::convertChannelToVisualRepresentation(), DataBuffer::data(), m_patchColorSpace, m_patchPixels, m_patchRect, m_pool, KoColorSpace::pixelSize(), KisPaintDevice::readBytes(), KisConfig::showSingleChannelAsColor(), and DataBuffer::swap().

◆ takePixelData()

DataBuffer && KisTextureTileUpdateInfo::takePixelData ( )
inline

Definition at line 301 of file kis_texture_tile_update_info.h.

301 {
302 return std::move(m_patchPixels);
303 }

References m_patchPixels.

◆ tileCol()

qint32 KisTextureTileUpdateInfo::tileCol ( ) const
inline

Definition at line 277 of file kis_texture_tile_update_info.h.

277 {
278 return m_tileCol;
279 }

References m_tileCol.

◆ tileRow()

qint32 KisTextureTileUpdateInfo::tileRow ( ) const
inline

Definition at line 281 of file kis_texture_tile_update_info.h.

281 {
282 return m_tileRow;
283 }

References m_tileRow.

◆ valid()

bool KisTextureTileUpdateInfo::valid ( ) const
inline

Definition at line 297 of file kis_texture_tile_update_info.h.

297 {
298 return m_patchRect.isValid();
299 }

References m_patchRect.

Member Data Documentation

◆ m_currentImageRect

QRect KisTextureTileUpdateInfo::m_currentImageRect
private

Definition at line 316 of file kis_texture_tile_update_info.h.

◆ m_originalPatchRect

QRect KisTextureTileUpdateInfo::m_originalPatchRect
private

Definition at line 326 of file kis_texture_tile_update_info.h.

◆ m_originalTileRect

QRect KisTextureTileUpdateInfo::m_originalTileRect
private

Definition at line 327 of file kis_texture_tile_update_info.h.

◆ m_patchColorSpace

const KoColorSpace* KisTextureTileUpdateInfo::m_patchColorSpace {nullptr}
private

Definition at line 319 of file kis_texture_tile_update_info.h.

319{nullptr};

◆ m_patchLevelOfDetail

int KisTextureTileUpdateInfo::m_patchLevelOfDetail {0}
private

Definition at line 324 of file kis_texture_tile_update_info.h.

324{0};

◆ m_patchPixels

DataBuffer KisTextureTileUpdateInfo::m_patchPixels
private

Definition at line 329 of file kis_texture_tile_update_info.h.

◆ m_patchRect

QRect KisTextureTileUpdateInfo::m_patchRect
private

Definition at line 318 of file kis_texture_tile_update_info.h.

◆ m_pool

KisTextureTileInfoPoolSP KisTextureTileUpdateInfo::m_pool
private

Definition at line 330 of file kis_texture_tile_update_info.h.

◆ m_realPatchOffset

QRect KisTextureTileUpdateInfo::m_realPatchOffset
private

Definition at line 322 of file kis_texture_tile_update_info.h.

◆ m_realPatchRect

QRect KisTextureTileUpdateInfo::m_realPatchRect
private

Definition at line 321 of file kis_texture_tile_update_info.h.

◆ m_realTileSize

QRect KisTextureTileUpdateInfo::m_realTileSize
private

Definition at line 323 of file kis_texture_tile_update_info.h.

◆ m_tileCol

qint32 KisTextureTileUpdateInfo::m_tileCol {0}
private

Definition at line 314 of file kis_texture_tile_update_info.h.

314{0};

◆ m_tileRect

QRect KisTextureTileUpdateInfo::m_tileRect
private

Definition at line 317 of file kis_texture_tile_update_info.h.

◆ m_tileRow

qint32 KisTextureTileUpdateInfo::m_tileRow {0}
private

Definition at line 315 of file kis_texture_tile_update_info.h.

315{0};

The documentation for this class was generated from the following file: