9#include <QtCore/qmath.h>
19 : m_gridSize(gridSize)
20 , m_logGridSize(qFloor(
std::log2(gridSize)))
33 QVector<quint8> newMapping(newMappedAreaSize.width() * newMappedAreaSize.height());
38 int dstRowStride = newMappedAreaSize.width();
39 int dstRowStart = xDiff + yDiff * dstRowStride;
42 int dstRowIndex = dstRowStart + dstRowStride * y;
76 for (
int y = mappedRect.y(); y <= mappedRect.bottom(); y++) {
77 for (
int x = mappedRect.x(); x <= mappedRect.right(); x++) {
90 qint32 alignment = 1 << lod;
92 qint32 x1, y1, x2, y2;
93 srcRect.getCoords(&x1, &y1, &x2, &y2);
112 rect.setCoords(x1, y1, x2, y2);
132 for (
int y = mappedRect.y(); y <= mappedRect.bottom(); y++) {
133 for (
int x = mappedRect.x(); x <= mappedRect.right(); x++) {
150 for (
int y = mappedRect.y(); y <= mappedRect.bottom(); y++) {
151 for (
int x = mappedRect.x(); x <= mappedRect.right(); x++) {
153 if (!*ptr)
return false;
165 gridBounds |= QRect(x, y, 1, 1);
QVector< QRect > removeAlignedRect(const QRect &rc)
bool contains(const QRect &rc) const
QRect alignRect(const QRect &rc) const
KisRectsGrid(int gridSize=64)
QVector< QRect > addRect(const QRect &rc)
QVector< QRect > addAlignedRect(const QRect &rc)
QVector< quint8 > m_mapping
QRect boundingRect() const
void resize(const QRect &newMappedAreaSize)
QVector< QRect > removeRect(const QRect &rc)
static QRect shrinkRectToAlignedGrid(const QRect &srcRect, int lod)
static void log(const QString &message)
Logs with date/time.
static bool qFuzzyCompare(half p1, half p2)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Rect blowRect(const Rect &rect, qreal coeff)