| 320 | } |
| 321 | |
| 322 | void ContinuousPageWidget::enqueueScale(int pageIndex, const QImage *source, const QSize &targetSize, const QSize &targetPixelSize, qreal dpr) |
| 323 | { |
| 324 | if (!source || source->isNull() || targetPixelSize.isEmpty()) { |
| 325 | return; |
| 326 | } |
| 327 | |
| 328 | ScaleRequestKey key; |
| 329 | key.sourceCacheKey = source->cacheKey(); |
| 330 | key.targetPixelSize = targetPixelSize; |
| 331 | key.devicePixelRatio = dpr; |
| 332 | key.generation = cacheGeneration; |
| 333 | |
| 334 | auto it = pendingScaleRequests.constFind(pageIndex); |
| 335 | if (it != pendingScaleRequests.constEnd() && it.value() == key) { |
| 336 | return; // identical scale already in flight |
| 337 | } |
| 338 | |
| 339 | pendingScaleRequests.insert(pageIndex, key); |
| 340 | |
| 341 | // *source copies the QImage (implicitly shared, copy-on-write), so the task |
| 342 | // reads it on the worker thread without racing the render buffer. |
| 343 | auto *task = new PageScaleTask(this, pageIndex, cacheGeneration, *source, source->size(), |
| 344 | source->cacheKey(), targetSize, targetPixelSize, dpr, |
| 345 | Configuration::getConfiguration().getScalingMethod()); |
| 346 | scalePool.start(task); |
| 347 | } |
| 348 | |
| 349 | void ContinuousPageWidget::deliverScaledImage(int pageIndex, quint64 generation, QImage scaledImage, |
| 350 | qint64 sourceCacheKey, QSize sourceSize, QSize targetSize, |
nothing calls this directly
no test coverage detected