| 95 | } |
| 96 | |
| 97 | void DocumentPrivate::scheduleImageDownSampling(int invertedZoom) |
| 98 | { |
| 99 | LOG("invertedZoom=" << invertedZoom); |
| 100 | auto job = qobject_cast<DownSamplingJob *>(mCurrentJob.data()); |
| 101 | if (job && job->mInvertedZoom == invertedZoom) { |
| 102 | LOG("Current job is already doing it"); |
| 103 | return; |
| 104 | } |
| 105 | |
| 106 | // Remove any previously scheduled downsampling job |
| 107 | DocumentJobQueue::Iterator it; |
| 108 | for (it = mJobQueue.begin(); it != mJobQueue.end(); ++it) { |
| 109 | auto job = qobject_cast<DownSamplingJob *>(*it); |
| 110 | if (!job) { |
| 111 | continue; |
| 112 | } |
| 113 | if (job->mInvertedZoom == invertedZoom) { |
| 114 | // Already scheduled, nothing to do |
| 115 | LOG("Already scheduled"); |
| 116 | return; |
| 117 | } else { |
| 118 | LOG("Removing downsampling job"); |
| 119 | mJobQueue.erase(it); |
| 120 | delete job; |
| 121 | } |
| 122 | } |
| 123 | q->enqueueJob(new DownSamplingJob(invertedZoom)); |
| 124 | } |
| 125 | |
| 126 | void DocumentPrivate::downSampleImage(int invertedZoom) |
| 127 | { |
no test coverage detected