Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/canvas/kis_coordinates_converter.cpp
Show First 20 Lines • Show All 302 Lines • ▼ Show 20 Line(s) | |||||
303 | } | 303 | } | ||
304 | 304 | | |||
305 | QTransform KisCoordinatesConverter::imageToViewportTransform() const { | 305 | QTransform KisCoordinatesConverter::imageToViewportTransform() const { | ||
306 | return m_d->imageToDocument * m_d->documentToFlake * m_d->flakeToWidget * m_d->widgetToViewport; | 306 | return m_d->imageToDocument * m_d->documentToFlake * m_d->flakeToWidget * m_d->widgetToViewport; | ||
307 | } | 307 | } | ||
308 | 308 | | |||
309 | void KisCoordinatesConverter::getQPainterCheckersInfo(QTransform *transform, | 309 | void KisCoordinatesConverter::getQPainterCheckersInfo(QTransform *transform, | ||
310 | QPointF *brushOrigin, | 310 | QPointF *brushOrigin, | ||
311 | QPolygonF *polygon) const | 311 | QPolygonF *polygon, | ||
312 | const bool scrollCheckers) const | ||||
312 | { | 313 | { | ||
313 | /** | 314 | /** | ||
314 | * Qt has different rounding for QPainter::drawRect/drawImage. | 315 | * Qt has different rounding for QPainter::drawRect/drawImage. | ||
315 | * The image is rounded mathematically, while rect in aligned | 316 | * The image is rounded mathematically, while rect in aligned | ||
316 | * to the next integer. That causes transparent line appear on | 317 | * to the next integer. That causes transparent line appear on | ||
317 | * the canvas. | 318 | * the canvas. | ||
318 | * | 319 | * | ||
319 | * See: https://bugreports.qt.nokia.com/browse/QTBUG-22827 | 320 | * See: https://bugreports.qt.nokia.com/browse/QTBUG-22827 | ||
320 | */ | 321 | */ | ||
321 | 322 | | |||
322 | QRectF imageRect = imageRectInViewportPixels(); | 323 | QRectF imageRect = imageRectInViewportPixels(); | ||
323 | imageRect.adjust(0,0,-0.5,-0.5); | 324 | imageRect.adjust(0,0,-0.5,-0.5); | ||
324 | 325 | | |||
325 | KisConfig cfg; | 326 | if (scrollCheckers) { | ||
326 | if (cfg.scrollCheckers()) { | | |||
327 | *transform = viewportToWidgetTransform(); | 327 | *transform = viewportToWidgetTransform(); | ||
328 | *polygon = imageRect; | 328 | *polygon = imageRect; | ||
329 | *brushOrigin = imageToViewport(QPointF(0,0)); | 329 | *brushOrigin = imageToViewport(QPointF(0,0)); | ||
330 | } | 330 | } | ||
331 | else { | 331 | else { | ||
332 | *transform = QTransform(); | 332 | *transform = QTransform(); | ||
333 | *polygon = viewportToWidgetTransform().map(imageRect); | 333 | *polygon = viewportToWidgetTransform().map(imageRect); | ||
334 | *brushOrigin = QPoint(0,0); | 334 | *brushOrigin = QPoint(0,0); | ||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |