MCPcopy Create free account
hub / github.com/YACReader/yacreader / enqueueScale

Method enqueueScale

YACReader/continuous_page_widget.cpp:322–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322void 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
349void ContinuousPageWidget::deliverScaledImage(int pageIndex, quint64 generation, QImage scaledImage,
350 qint64 sourceCacheKey, QSize sourceSize, QSize targetSize,

Callers

nothing calls this directly

Calls 4

isEmptyMethod · 0.80
getScalingMethodMethod · 0.80
startMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected