| 29 | } |
| 30 | |
| 31 | void YACReaderPageFlow3D::updateImageData() |
| 32 | { |
| 33 | if (worker->busy()) |
| 34 | return; |
| 35 | |
| 36 | int idx = worker->index(); |
| 37 | if (idx >= 0 && !worker->result().isNull()) { |
| 38 | if (!loaded[idx]) { |
| 39 | float x = 1; |
| 40 | QImage img = worker->result(); |
| 41 | |
| 42 | // Create QRhiTexture from the loaded image and queue the pixel upload |
| 43 | if (m_rhi) { |
| 44 | QRhiTexture *texture = m_rhi->newTexture(QRhiTexture::RGBA8, img.size(), 1, QRhiTexture::MipMapped | QRhiTexture::UsedWithGenerateMips); |
| 45 | |
| 46 | if (texture->create()) { |
| 47 | // Queue the image upload so it happens together with other resource updates |
| 48 | PendingTextureUpload upload; |
| 49 | upload.index = idx; |
| 50 | upload.image = img; |
| 51 | upload.x = x; |
| 52 | upload.y = 1 * (float(img.height()) / img.width()); |
| 53 | pendingTextureUploads.append(upload); |
| 54 | |
| 55 | replace(texture, upload.x, upload.y, idx); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | int count = 8; |
| 62 | switch (performance) { |
| 63 | case low: |
| 64 | count = 8; |
| 65 | break; |
| 66 | case medium: |
| 67 | count = 10; |
| 68 | break; |
| 69 | case high: |
| 70 | count = 12; |
| 71 | break; |
| 72 | case ultraHigh: |
| 73 | count = 14; |
| 74 | break; |
| 75 | } |
| 76 | |
| 77 | int *indexes = new int[2 * count + 1]; |
| 78 | int center = currentSelected; |
| 79 | indexes[0] = center; |
| 80 | for (int j = 0; j < count; j++) { |
| 81 | indexes[j * 2 + 1] = center + j + 1; |
| 82 | indexes[j * 2 + 2] = center - j - 1; |
| 83 | } |
| 84 | |
| 85 | for (int c = 0; c < 2 * count + 1; c++) { |
| 86 | int i = indexes[c]; |
| 87 | if ((i >= 0) && (i < numObjects)) |
| 88 | if (rawImages.size() > 0) |