MCPcopy Create free account
hub / github.com/IENT/YUView / drawDifferenceFrame

Method drawDifferenceFrame

YUViewLib/src/video/videoHandlerDifference.cpp:56–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56void 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
106void videoHandlerDifference::loadFrameDifference(int frameIndex, bool)
107{

Callers 1

drawItemMethod · 0.80

Calls 3

containsMethod · 0.80
setSizeMethod · 0.80
drawPixelValuesMethod · 0.45

Tested by

no test coverage detected