| 54 | } |
| 55 | |
| 56 | void videoHandlerDifference::drawDifferenceFrame(QPainter *painter, |
| 57 | int frameIdx, |
| 58 | double zoomFactor, |
| 59 | bool drawRawValues) |
| 60 | { |
| 61 | if (!inputsValid()) |
| 62 | return; |
| 63 | |
| 64 | // Check if the frameIdx changed and if we have to load a new frame |
| 65 | if (frameIdx != currentImageIndex) |
| 66 | { |
| 67 | // The current buffer is out of date. Update it. |
| 68 | |
| 69 | // Check the double buffer |
| 70 | if (frameIdx == doubleBufferImageFrameIndex) |
| 71 | { |
| 72 | currentImage = doubleBufferImage; |
| 73 | currentImageIndex = frameIdx; |
| 74 | DEBUG_VIDEO("videoHandler::drawFrame %d loaded from double buffer", frameIdx); |
| 75 | } |
| 76 | else |
| 77 | { |
| 78 | QMutexLocker lock(&imageCacheAccess); |
| 79 | if (cacheValid && imageCache.contains(frameIdx)) |
| 80 | { |
| 81 | currentImage = imageCache[frameIdx]; |
| 82 | currentImageIndex = frameIdx; |
| 83 | DEBUG_VIDEO("videoHandler::drawFrame %d loaded from cache", frameIdx); |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | // Create the video QRect with the size of the sequence and center it. |
| 89 | QRect videoRect; |
| 90 | videoRect.setSize(QSize(frameSize.width * zoomFactor, frameSize.height * zoomFactor)); |
| 91 | videoRect.moveCenter(QPoint(0, 0)); |
| 92 | |
| 93 | // Draw the current image (currentImage) |
| 94 | currentImageSetMutex.lock(); |
| 95 | painter->drawImage(videoRect, currentImage); |
| 96 | currentImageSetMutex.unlock(); |
| 97 | |
| 98 | if (drawRawValues && zoomFactor >= SPLITVIEW_DRAW_VALUES_ZOOMFACTOR) |
| 99 | { |
| 100 | // Draw the pixel values onto the pixels |
| 101 | inputVideo[0]->drawPixelValues( |
| 102 | painter, frameIdx, videoRect, zoomFactor, inputVideo[1], this->markDifference); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | void videoHandlerDifference::loadFrameDifference(int frameIndex, bool) |
| 107 | { |
no test coverage detected