Changeset View
Changeset View
Standalone View
Standalone View
libs/image/brushengine/kis_paint_information.cc
| Context not available. | |||||
| 21 | #include <QDomElement> | 21 | #include <QDomElement> | ||
|---|---|---|---|---|---|
| 22 | #include <QScopedPointer> | 22 | #include <QScopedPointer> | ||
| 23 | 23 | | |||
| 24 | #include <Eigen/Core> | | |||
| 25 | 24 | | |||
| 26 | #include "kis_paintop.h" | 25 | #include "kis_paintop.h" | ||
| 27 | #include "kis_algebra_2d.h" | 26 | #include "kis_algebra_2d.h" | ||
| Context not available. | |||||
| 31 | #include <kis_dom_utils.h> | 30 | #include <kis_dom_utils.h> | ||
| 32 | 31 | | |||
| 33 | struct KisPaintInformation::Private { | 32 | struct KisPaintInformation::Private { | ||
| 34 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW | | |||
| 35 | 33 | | |||
| 36 | Private(const QPointF & pos_, | 34 | Private(const QPointF & pos_, | ||
| 37 | qreal pressure_, | 35 | qreal pressure_, | ||
| Context not available. | |||||
| 127 | DistanceInformationRegistrar(KisPaintInformation *_p, KisDistanceInformation *distanceInfo) | 125 | DistanceInformationRegistrar(KisPaintInformation *_p, KisDistanceInformation *distanceInfo) | ||
| 128 | : p(_p) | 126 | : p(_p) | ||
| 129 | { | 127 | { | ||
| 130 | p->d->registerDistanceInfo(distanceInfo); | 128 | p->d()->registerDistanceInfo(distanceInfo); | ||
| 131 | } | 129 | } | ||
| 132 | 130 | | |||
| 133 | KisPaintInformation::DistanceInformationRegistrar:: | 131 | KisPaintInformation::DistanceInformationRegistrar:: | ||
| 134 | ~DistanceInformationRegistrar() | 132 | ~DistanceInformationRegistrar() | ||
| 135 | { | 133 | { | ||
| 136 | p->d->unregisterDistanceInfo(); | 134 | p->d()->unregisterDistanceInfo(); | ||
| 135 | } | ||||
| 136 | | ||||
| 137 | // Templates for showing the actual values in error messages | ||||
| 138 | template <typename T, size_t storageSize, size_t sizeOfT = sizeof(T)> | ||||
| 139 | void check_storage_size() { | ||||
| 140 | static_assert(sizeof(T) == sizeOfT, "boo"); | ||||
| 141 | static_assert(sizeof(T) <= storageSize, | ||||
| 142 | "KisPaintInformation::_dStorageSize too small"); | ||||
| 143 | static_assert(storageSize <= sizeof(T) * 1.2, | ||||
| 144 | "KisPaintInformation::_dStorageSize too much unused space"); | ||||
| 145 | } | ||||
| 146 | template <typename T, size_t align, size_t alignOfT = alignof(T)> | ||||
| 147 | void check_align_multiple() { | ||||
| 148 | static_assert(alignof(T) == alignOfT, "boo"); | ||||
| 149 | static_assert(alignof(T) % align == 0, "Not aligned properly"); | ||||
| 150 | } | ||||
| 151 | template <typename T1, typename T2, size_t alignOfT1 = alignof(T1), size_t alignOfT2 = alignof(T2)> | ||||
| 152 | void check_align_equal() { | ||||
| 153 | static_assert(alignof(T1) == alignOfT1, "boo"); | ||||
| 154 | static_assert(alignof(T2) == alignOfT2, "boo"); | ||||
| 155 | static_assert(alignof(T1) == alignof(T2), "Not same alignment"); | ||||
| 137 | } | 156 | } | ||
| 138 | 157 | | |||
| 139 | KisPaintInformation::KisPaintInformation(const QPointF & pos, | 158 | KisPaintInformation::KisPaintInformation(const QPointF & pos, | ||
| Context not available. | |||||
| 144 | qreal perspective, | 163 | qreal perspective, | ||
| 145 | qreal time, | 164 | qreal time, | ||
| 146 | qreal speed) | 165 | qreal speed) | ||
| 147 | : d(new Private(pos, | 166 | { | ||
| 167 | check_storage_size<Private, _dStorageSize>(); | ||||
| 168 | check_align_multiple<KisPaintInformation, 16>(); | ||||
| 169 | new(&_dStorage) Private(pos, | ||||
| 148 | pressure, | 170 | pressure, | ||
| 149 | xTilt, yTilt, | 171 | xTilt, yTilt, | ||
| 150 | rotation, | 172 | rotation, | ||
| Context not available. | |||||
| 152 | perspective, | 174 | perspective, | ||
| 153 | time, | 175 | time, | ||
| 154 | speed, | 176 | speed, | ||
| 155 | false)) | 177 | false); | ||
| 156 | { | | |||
| 157 | } | 178 | } | ||
| 158 | 179 | | |||
| 159 | KisPaintInformation::KisPaintInformation(const QPointF & pos, | 180 | KisPaintInformation::KisPaintInformation(const QPointF & pos, | ||
| Context not available. | |||||
| 161 | qreal xTilt, | 182 | qreal xTilt, | ||
| 162 | qreal yTilt, | 183 | qreal yTilt, | ||
| 163 | qreal rotation) | 184 | qreal rotation) | ||
| 164 | : d(new Private(pos, | 185 | { | ||
| 186 | new(&_dStorage) Private(pos, | ||||
| 165 | pressure, | 187 | pressure, | ||
| 166 | xTilt, yTilt, | 188 | xTilt, yTilt, | ||
| 167 | rotation, | 189 | rotation, | ||
| Context not available. | |||||
| 169 | 1.0, | 191 | 1.0, | ||
| 170 | 0.0, | 192 | 0.0, | ||
| 171 | 0.0, | 193 | 0.0, | ||
| 172 | false)) | 194 | false); | ||
| 173 | { | | |||
| 174 | | ||||
| 175 | } | 195 | } | ||
| 176 | 196 | | |||
| 177 | KisPaintInformation::KisPaintInformation(const QPointF &pos, | 197 | KisPaintInformation::KisPaintInformation(const QPointF &pos, | ||
| 178 | qreal pressure) | 198 | qreal pressure) | ||
| 179 | : d(new Private(pos, | 199 | { | ||
| 200 | new(&_dStorage) Private(pos, | ||||
| 180 | pressure, | 201 | pressure, | ||
| 181 | 0.0, 0.0, | 202 | 0.0, 0.0, | ||
| 182 | 0.0, | 203 | 0.0, | ||
| Context not available. | |||||
| 184 | 1.0, | 205 | 1.0, | ||
| 185 | 0.0, | 206 | 0.0, | ||
| 186 | 0.0, | 207 | 0.0, | ||
| 187 | false)) | 208 | false); | ||
| 188 | { | | |||
| 189 | } | 209 | } | ||
| 190 | 210 | | |||
| 191 | KisPaintInformation::KisPaintInformation(const KisPaintInformation& rhs) | 211 | KisPaintInformation::KisPaintInformation(const KisPaintInformation& rhs) | ||
| 192 | : d(new Private(*rhs.d)) | | |||
| 193 | { | 212 | { | ||
| 213 | new(&_dStorage) Private(*rhs.d()); | ||||
| 194 | } | 214 | } | ||
| 195 | 215 | | |||
| 196 | void KisPaintInformation::operator=(const KisPaintInformation & rhs) | 216 | void KisPaintInformation::operator=(const KisPaintInformation & rhs) | ||
| 197 | { | 217 | { | ||
| 198 | *d = *rhs.d; | 218 | *d() = *rhs.d(); | ||
| 199 | } | 219 | } | ||
| 200 | 220 | | |||
| 201 | KisPaintInformation::~KisPaintInformation() | 221 | KisPaintInformation::~KisPaintInformation() | ||
| 202 | { | 222 | { | ||
| 203 | delete d; | 223 | d()->~Private(); | ||
| 204 | } | 224 | } | ||
| 205 | 225 | | |||
| 206 | bool KisPaintInformation::isHoveringMode() const | 226 | bool KisPaintInformation::isHoveringMode() const | ||
| 207 | { | 227 | { | ||
| 208 | return d->isHoveringMode; | 228 | return d()->isHoveringMode; | ||
| 209 | } | 229 | } | ||
| 210 | 230 | | |||
| 211 | 231 | | |||
| Context not available. | |||||
| 226 | rotation, | 246 | rotation, | ||
| 227 | tangentialPressure, | 247 | tangentialPressure, | ||
| 228 | perspective, 0, speed); | 248 | perspective, 0, speed); | ||
| 229 | info.d->isHoveringMode = true; | 249 | info.d()->isHoveringMode = true; | ||
| 230 | info.d->canvasRotation = canvasrotation; | 250 | info.d()->canvasRotation = canvasrotation; | ||
| 231 | info.d->canvasMirroredH = canvasMirroredH; | 251 | info.d()->canvasMirroredH = canvasMirroredH; | ||
| 232 | return info; | 252 | return info; | ||
| 233 | } | 253 | } | ||
| 234 | 254 | | |||
| 235 | 255 | | |||
| 236 | int KisPaintInformation::canvasRotation() const | 256 | int KisPaintInformation::canvasRotation() const | ||
| 237 | { | 257 | { | ||
| 238 | return d->canvasRotation; | 258 | return d()->canvasRotation; | ||
| 239 | } | 259 | } | ||
| 240 | 260 | | |||
| 241 | void KisPaintInformation::setCanvasRotation(int rotation) | 261 | void KisPaintInformation::setCanvasRotation(int rotation) | ||
| 242 | { | 262 | { | ||
| 243 | if (rotation < 0) { | 263 | if (rotation < 0) { | ||
| 244 | d->canvasRotation= 360- abs(rotation % 360); | 264 | d()->canvasRotation= 360- abs(rotation % 360); | ||
| 245 | } else { | 265 | } else { | ||
| 246 | d->canvasRotation= rotation % 360; | 266 | d()->canvasRotation= rotation % 360; | ||
| 247 | } | 267 | } | ||
| 248 | 268 | | |||
| 249 | } | 269 | } | ||
| 250 | 270 | | |||
| 251 | bool KisPaintInformation::canvasMirroredH() const | 271 | bool KisPaintInformation::canvasMirroredH() const | ||
| 252 | { | 272 | { | ||
| 253 | return d->canvasMirroredH; | 273 | return d()->canvasMirroredH; | ||
| 254 | } | 274 | } | ||
| 255 | 275 | | |||
| 256 | void KisPaintInformation::setCanvasHorizontalMirrorState(bool mir) | 276 | void KisPaintInformation::setCanvasHorizontalMirrorState(bool mir) | ||
| 257 | { | 277 | { | ||
| 258 | d->canvasMirroredH = mir; | 278 | d()->canvasMirroredH = mir; | ||
| 259 | 279 | | |||
| 260 | } | 280 | } | ||
| 261 | 281 | | |||
| 262 | void KisPaintInformation::toXML(QDomDocument&, QDomElement& e) const | 282 | void KisPaintInformation::toXML(QDomDocument&, QDomElement& e) const | ||
| 263 | { | 283 | { | ||
| 264 | // hovering mode infos are not supposed to be saved | 284 | // hovering mode infos are not supposed to be saved | ||
| 265 | KIS_ASSERT_RECOVER_NOOP(!d->isHoveringMode); | 285 | KIS_ASSERT_RECOVER_NOOP(!d()->isHoveringMode); | ||
| 266 | 286 | | |||
| 267 | e.setAttribute("pointX", QString::number(pos().x(), 'g', 15)); | 287 | e.setAttribute("pointX", QString::number(pos().x(), 'g', 15)); | ||
| 268 | e.setAttribute("pointY", QString::number(pos().y(), 'g', 15)); | 288 | e.setAttribute("pointY", QString::number(pos().y(), 'g', 15)); | ||
| Context not available. | |||||
| 272 | e.setAttribute("rotation", QString::number(rotation(), 'g', 15)); | 292 | e.setAttribute("rotation", QString::number(rotation(), 'g', 15)); | ||
| 273 | e.setAttribute("tangentialPressure", QString::number(tangentialPressure(), 'g', 15)); | 293 | e.setAttribute("tangentialPressure", QString::number(tangentialPressure(), 'g', 15)); | ||
| 274 | e.setAttribute("perspective", QString::number(perspective(), 'g', 15)); | 294 | e.setAttribute("perspective", QString::number(perspective(), 'g', 15)); | ||
| 275 | e.setAttribute("time", QString::number(d->time, 'g', 15)); | 295 | e.setAttribute("time", QString::number(d()->time, 'g', 15)); | ||
| 276 | e.setAttribute("speed", QString::number(d->speed, 'g', 15)); | 296 | e.setAttribute("speed", QString::number(d()->speed, 'g', 15)); | ||
| 277 | } | 297 | } | ||
| 278 | 298 | | |||
| 279 | KisPaintInformation KisPaintInformation::fromXML(const QDomElement& e) | 299 | KisPaintInformation KisPaintInformation::fromXML(const QDomElement& e) | ||
| Context not available. | |||||
| 295 | 315 | | |||
| 296 | const QPointF& KisPaintInformation::pos() const | 316 | const QPointF& KisPaintInformation::pos() const | ||
| 297 | { | 317 | { | ||
| 298 | return d->pos; | 318 | return d()->pos; | ||
| 299 | } | 319 | } | ||
| 300 | 320 | | |||
| 301 | void KisPaintInformation::setPos(const QPointF& p) | 321 | void KisPaintInformation::setPos(const QPointF& p) | ||
| 302 | { | 322 | { | ||
| 303 | d->pos = p; | 323 | d()->pos = p; | ||
| 304 | } | 324 | } | ||
| 305 | 325 | | |||
| 306 | qreal KisPaintInformation::pressure() const | 326 | qreal KisPaintInformation::pressure() const | ||
| 307 | { | 327 | { | ||
| 308 | return d->pressure; | 328 | return d()->pressure; | ||
| 309 | } | 329 | } | ||
| 310 | 330 | | |||
| 311 | void KisPaintInformation::setPressure(qreal p) | 331 | void KisPaintInformation::setPressure(qreal p) | ||
| 312 | { | 332 | { | ||
| 313 | d->pressure = p; | 333 | d()->pressure = p; | ||
| 314 | } | 334 | } | ||
| 315 | 335 | | |||
| 316 | qreal KisPaintInformation::xTilt() const | 336 | qreal KisPaintInformation::xTilt() const | ||
| 317 | { | 337 | { | ||
| 318 | return d->xTilt; | 338 | return d()->xTilt; | ||
| 319 | } | 339 | } | ||
| 320 | 340 | | |||
| 321 | qreal KisPaintInformation::yTilt() const | 341 | qreal KisPaintInformation::yTilt() const | ||
| 322 | { | 342 | { | ||
| 323 | return d->yTilt; | 343 | return d()->yTilt; | ||
| 324 | } | 344 | } | ||
| 325 | 345 | | |||
| 326 | void KisPaintInformation::overrideDrawingAngle(qreal angle) | 346 | void KisPaintInformation::overrideDrawingAngle(qreal angle) | ||
| 327 | { | 347 | { | ||
| 328 | d->drawingAngleOverride.reset(new qreal(angle)); | 348 | d()->drawingAngleOverride.reset(new qreal(angle)); | ||
| 329 | } | 349 | } | ||
| 330 | 350 | | |||
| 331 | qreal KisPaintInformation::drawingAngleSafe(const KisDistanceInformation &distance) const | 351 | qreal KisPaintInformation::drawingAngleSafe(const KisDistanceInformation &distance) const | ||
| 332 | { | 352 | { | ||
| 333 | if (d->drawingAngleOverride) return *d->drawingAngleOverride; | 353 | if (d()->drawingAngleOverride) return *d()->drawingAngleOverride; | ||
| 334 | 354 | | |||
| 335 | if (!distance.hasLastDabInformation()) { | 355 | if (!distance.hasLastDabInformation()) { | ||
| 336 | warnKrita << "KisPaintInformation::drawingAngleSafe()" << "Cannot access Distance Info last dab data"; | 356 | warnKrita << "KisPaintInformation::drawingAngleSafe()" << "Cannot access Distance Info last dab data"; | ||
| Context not available. | |||||
| 348 | 368 | | |||
| 349 | qreal KisPaintInformation::drawingAngle() const | 369 | qreal KisPaintInformation::drawingAngle() const | ||
| 350 | { | 370 | { | ||
| 351 | if (d->drawingAngleOverride) return *d->drawingAngleOverride; | 371 | if (d()->drawingAngleOverride) return *d()->drawingAngleOverride; | ||
| 352 | 372 | | |||
| 353 | if (!d->currentDistanceInfo || !d->currentDistanceInfo->hasLastDabInformation()) { | 373 | if (!d()->currentDistanceInfo || !d()->currentDistanceInfo->hasLastDabInformation()) { | ||
| 354 | warnKrita << "KisPaintInformation::drawingAngle()" << "Cannot access Distance Info last dab data"; | 374 | warnKrita << "KisPaintInformation::drawingAngle()" << "Cannot access Distance Info last dab data"; | ||
| 355 | return 0.0; | 375 | return 0.0; | ||
| 356 | } | 376 | } | ||
| 357 | 377 | | |||
| 358 | return d->currentDistanceInfo->nextDrawingAngle(pos()); | 378 | return d()->currentDistanceInfo->nextDrawingAngle(pos()); | ||
| 359 | } | 379 | } | ||
| 360 | 380 | | |||
| 361 | void KisPaintInformation::lockCurrentDrawingAngle(qreal alpha_unused) const | 381 | void KisPaintInformation::lockCurrentDrawingAngle(qreal alpha_unused) const | ||
| 362 | { | 382 | { | ||
| 363 | Q_UNUSED(alpha_unused); | 383 | Q_UNUSED(alpha_unused); | ||
| 364 | 384 | | |||
| 365 | if (!d->currentDistanceInfo || !d->currentDistanceInfo->hasLastDabInformation()) { | 385 | if (!d()->currentDistanceInfo || !d()->currentDistanceInfo->hasLastDabInformation()) { | ||
| 366 | warnKrita << "KisPaintInformation::lockCurrentDrawingAngle()" << "Cannot access Distance Info last dab data"; | 386 | warnKrita << "KisPaintInformation::lockCurrentDrawingAngle()" << "Cannot access Distance Info last dab data"; | ||
| 367 | return; | 387 | return; | ||
| 368 | } | 388 | } | ||
| 369 | 389 | | |||
| 370 | qreal angle = d->currentDistanceInfo->nextDrawingAngle(pos(), false); | 390 | qreal angle = d()->currentDistanceInfo->nextDrawingAngle(pos(), false); | ||
| 371 | 391 | | |||
| 372 | qreal newAngle = angle; | 392 | qreal newAngle = angle; | ||
| 373 | 393 | | |||
| 374 | if (d->currentDistanceInfo->hasLockedDrawingAngle()) { | 394 | if (d()->currentDistanceInfo->hasLockedDrawingAngle()) { | ||
| 375 | const qreal stabilizingCoeff = 20.0; | 395 | const qreal stabilizingCoeff = 20.0; | ||
| 376 | const qreal dist = stabilizingCoeff * d->currentDistanceInfo->currentSpacing().scalarApprox(); | 396 | const qreal dist = stabilizingCoeff * d()->currentDistanceInfo->currentSpacing().scalarApprox(); | ||
| 377 | const qreal alpha = qMax(0.0, dist - d->currentDistanceInfo->scalarDistanceApprox()) / dist; | 397 | const qreal alpha = qMax(0.0, dist - d()->currentDistanceInfo->scalarDistanceApprox()) / dist; | ||
| 378 | 398 | | |||
| 379 | const qreal oldAngle = d->currentDistanceInfo->lockedDrawingAngle(); | 399 | const qreal oldAngle = d()->currentDistanceInfo->lockedDrawingAngle(); | ||
| 380 | 400 | | |||
| 381 | if (shortestAngularDistance(oldAngle, newAngle) < M_PI / 6) { | 401 | if (shortestAngularDistance(oldAngle, newAngle) < M_PI / 6) { | ||
| 382 | newAngle = (1.0 - alpha) * oldAngle + alpha * newAngle; | 402 | newAngle = (1.0 - alpha) * oldAngle + alpha * newAngle; | ||
| Context not available. | |||||
| 385 | } | 405 | } | ||
| 386 | } | 406 | } | ||
| 387 | 407 | | |||
| 388 | d->currentDistanceInfo->setLockedDrawingAngle(newAngle); | 408 | d()->currentDistanceInfo->setLockedDrawingAngle(newAngle); | ||
| 389 | } | 409 | } | ||
| 390 | 410 | | |||
| 391 | QPointF KisPaintInformation::drawingDirectionVector() const | 411 | QPointF KisPaintInformation::drawingDirectionVector() const | ||
| 392 | { | 412 | { | ||
| 393 | if (d->drawingAngleOverride) { | 413 | if (d()->drawingAngleOverride) { | ||
| 394 | qreal angle = *d->drawingAngleOverride; | 414 | qreal angle = *d()->drawingAngleOverride; | ||
| 395 | return QPointF(cos(angle), sin(angle)); | 415 | return QPointF(cos(angle), sin(angle)); | ||
| 396 | } | 416 | } | ||
| 397 | 417 | | |||
| 398 | if (!d->currentDistanceInfo || !d->currentDistanceInfo->hasLastDabInformation()) { | 418 | if (!d()->currentDistanceInfo || !d()->currentDistanceInfo->hasLastDabInformation()) { | ||
| 399 | warnKrita << "KisPaintInformation::drawingDirectionVector()" << "Cannot access Distance Info last dab data"; | 419 | warnKrita << "KisPaintInformation::drawingDirectionVector()" << "Cannot access Distance Info last dab data"; | ||
| 400 | return QPointF(1.0, 0.0); | 420 | return QPointF(1.0, 0.0); | ||
| 401 | } | 421 | } | ||
| 402 | 422 | | |||
| 403 | return d->currentDistanceInfo->nextDrawingDirectionVector(pos()); | 423 | return d()->currentDistanceInfo->nextDrawingDirectionVector(pos()); | ||
| 404 | } | 424 | } | ||
| 405 | 425 | | |||
| 406 | qreal KisPaintInformation::drawingDistance() const | 426 | qreal KisPaintInformation::drawingDistance() const | ||
| 407 | { | 427 | { | ||
| 408 | if (!d->currentDistanceInfo || !d->currentDistanceInfo->hasLastDabInformation()) { | 428 | if (!d()->currentDistanceInfo || !d()->currentDistanceInfo->hasLastDabInformation()) { | ||
| 409 | warnKrita << "KisPaintInformation::drawingDistance()" << "Cannot access Distance Info last dab data"; | 429 | warnKrita << "KisPaintInformation::drawingDistance()" << "Cannot access Distance Info last dab data"; | ||
| 410 | return 1.0; | 430 | return 1.0; | ||
| 411 | } | 431 | } | ||
| 412 | 432 | | |||
| 413 | QVector2D diff(pos() - d->currentDistanceInfo->lastPosition()); | 433 | QVector2D diff(pos() - d()->currentDistanceInfo->lastPosition()); | ||
| 414 | qreal length = diff.length(); | 434 | qreal length = diff.length(); | ||
| 415 | 435 | | |||
| 416 | if (d->levelOfDetail) { | 436 | if (d()->levelOfDetail) { | ||
| 417 | length *= KisLodTransform::lodToInvScale(d->levelOfDetail); | 437 | length *= KisLodTransform::lodToInvScale(d()->levelOfDetail); | ||
| 418 | } | 438 | } | ||
| 419 | 439 | | |||
| 420 | return length; | 440 | return length; | ||
| Context not available. | |||||
| 422 | 442 | | |||
| 423 | qreal KisPaintInformation::drawingSpeed() const | 443 | qreal KisPaintInformation::drawingSpeed() const | ||
| 424 | { | 444 | { | ||
| 425 | return d->speed; | 445 | return d()->speed; | ||
| 426 | } | 446 | } | ||
| 427 | 447 | | |||
| 428 | qreal KisPaintInformation::rotation() const | 448 | qreal KisPaintInformation::rotation() const | ||
| 429 | { | 449 | { | ||
| 430 | return d->rotation; | 450 | return d()->rotation; | ||
| 431 | } | 451 | } | ||
| 432 | 452 | | |||
| 433 | qreal KisPaintInformation::tangentialPressure() const | 453 | qreal KisPaintInformation::tangentialPressure() const | ||
| 434 | { | 454 | { | ||
| 435 | return d->tangentialPressure; | 455 | return d()->tangentialPressure; | ||
| 436 | } | 456 | } | ||
| 437 | 457 | | |||
| 438 | qreal KisPaintInformation::perspective() const | 458 | qreal KisPaintInformation::perspective() const | ||
| 439 | { | 459 | { | ||
| 440 | return d->perspective; | 460 | return d()->perspective; | ||
| 441 | } | 461 | } | ||
| 442 | 462 | | |||
| 443 | qreal KisPaintInformation::currentTime() const | 463 | qreal KisPaintInformation::currentTime() const | ||
| 444 | { | 464 | { | ||
| 445 | return d->time; | 465 | return d()->time; | ||
| 446 | } | 466 | } | ||
| 447 | 467 | | |||
| 448 | KisRandomSourceSP KisPaintInformation::randomSource() const | 468 | KisRandomSourceSP KisPaintInformation::randomSource() const | ||
| 449 | { | 469 | { | ||
| 450 | if (!d->randomSource) { | 470 | if (!d()->randomSource) { | ||
| 451 | d->randomSource = new KisRandomSource(); | 471 | const_cast<Private *>(d())->randomSource = new KisRandomSource(); | ||
| 452 | } | 472 | } | ||
| 453 | 473 | | |||
| 454 | return d->randomSource; | 474 | return d()->randomSource; | ||
| 455 | } | 475 | } | ||
| 456 | 476 | | |||
| 457 | void KisPaintInformation::setRandomSource(KisRandomSourceSP value) | 477 | void KisPaintInformation::setRandomSource(KisRandomSourceSP value) | ||
| 458 | { | 478 | { | ||
| 459 | d->randomSource = value; | 479 | d()->randomSource = value; | ||
| 460 | } | 480 | } | ||
| 461 | 481 | | |||
| 462 | void KisPaintInformation::setLevelOfDetail(int levelOfDetail) const | 482 | void KisPaintInformation::setLevelOfDetail(int levelOfDetail) const | ||
| 463 | { | 483 | { | ||
| 464 | d->levelOfDetail = levelOfDetail; | 484 | const_cast<Private *>(d())->levelOfDetail = levelOfDetail; | ||
| 465 | } | 485 | } | ||
| 466 | 486 | | |||
| 467 | QDebug operator<<(QDebug dbg, const KisPaintInformation &info) | 487 | QDebug operator<<(QDebug dbg, const KisPaintInformation &info) | ||
| Context not available. | |||||
| 549 | 569 | | |||
| 550 | KisPaintInformation result(p, pressure, xTilt, yTilt, rotation, tangentialPressure, perspective, time, speed); | 570 | KisPaintInformation result(p, pressure, xTilt, yTilt, rotation, tangentialPressure, perspective, time, speed); | ||
| 551 | KIS_ASSERT_RECOVER_NOOP(pi1.isHoveringMode() == pi2.isHoveringMode()); | 571 | KIS_ASSERT_RECOVER_NOOP(pi1.isHoveringMode() == pi2.isHoveringMode()); | ||
| 552 | result.d->isHoveringMode = pi1.isHoveringMode(); | 572 | result.d()->isHoveringMode = pi1.isHoveringMode(); | ||
| 553 | result.d->levelOfDetail = pi1.d->levelOfDetail; | 573 | result.d()->levelOfDetail = pi1.d()->levelOfDetail; | ||
| 554 | result.d->randomSource = pi1.d->randomSource; | 574 | result.d()->randomSource = pi1.d()->randomSource; | ||
| 555 | result.d->canvasRotation = pi2.canvasRotation(); | 575 | result.d()->canvasRotation = pi2.canvasRotation(); | ||
| 556 | result.d->canvasMirroredH = pi2.canvasMirroredH(); | 576 | result.d()->canvasMirroredH = pi2.canvasMirroredH(); | ||
| 557 | 577 | | |||
| 558 | return result; | 578 | return result; | ||
| 559 | } | 579 | } | ||
| Context not available. | |||||