We need to make sure that the destination polygon is not too small, otherwise even small rounding will send the src-accessor into infinity
209 {
210#ifdef DEBUG_PAINTING_POLYGONS
211
212#endif
213 QRect boundRect = clipDstPolygon.boundingRect().toAlignedRect();
214 if (boundRect.isEmpty()) return;
215
219
221 QRect boundRect = dstPolygon.boundingRect().toAlignedRect();
223 return;
224 }
225
226
227
228
229
231
232
235
237#ifdef DEBUG_PAINTING_POLYGONS
238 int pixelId = 0;
239#endif
240
246 if (
interp.isValid(0.1)) {
247 int y = boundRect.top();
249
250 while (dstIt.nextPixel()) {
251 int newY = dstIt.y();
252
253 if (y != newY) {
256 }
257
258 QPointF srcPoint(dstIt.x(), y);
259
260 if (clipDstPolygon.containsPoint(srcPoint, Qt::OddEvenFill)) {
261
262 interp.setX(srcPoint.x());
264
265
266
267
268
269
270
271
273 quint8* rawData = dstIt.rawData();
275#ifdef DEBUG_PAINTING_POLYGONS
276 QColor color = m_debugColor;
277 color.setHsl(
KisAlgebra2D::wrapValue(m_debugColor.hslHue() + m_rectId, 0, 360), m_debugColor.hslSaturation(), qBound(0, m_debugColor.lightness() - 50 - pixelId, 100));
278 pixelId++;
280#endif
281 }
282 }
283
284 } else {
286
287 while (dstIt.nextPixel()) {
288 QPointF srcPoint(dstIt.x(), dstIt.y());
289
290 if (clipDstPolygon.containsPoint(srcPoint, Qt::OddEvenFill)) {
292#ifdef DEBUG_PAINTING_POLYGONS
293 QColor color = m_debugColor;
294 color.setHsl(
KisAlgebra2D::wrapValue(m_debugColor.hslHue() + m_rectId, 0, 360), m_debugColor.hslSaturation(), qBound(0, m_debugColor.lightness() + 50, 100));
296#endif
297 }
298 }
299 }
300
301 }
KisRandomSubAccessorSP createRandomSubAccessor() const
void sampledOldRawData(quint8 *dst)
void moveTo(qreal x, qreal y)
qreal interp(qreal r, qreal a, qreal b)
private functions
bool isPolygonPixelAlignedRect(const Polygon &poly, Difference tolerance)
bool fuzzyPointCompare(const QPointF &p1, const QPointF &p2)