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

Method update

YUViewLib/src/ui/views/SplitViewWidget.cpp:1505–1583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1503}
1504
1505void splitViewWidget::update(bool newFrame, bool itemRedraw)
1506{
1507 if (!this->isMasterView && !isVisible())
1508 // This is the separate view and it is not enabled. Nothing to update.
1509 return;
1510
1511 bool playing = (playback) ? playback->playing() : false;
1512 DEBUG_LOAD_DRAW("splitViewWidget::update" << (!this->isMasterView ? " separate" : "")
1513 << (newFrame ? " newFrame" : "")
1514 << (playing ? " playing" : ""));
1515
1516 if (newFrame || itemRedraw)
1517 {
1518 // A new frame was selected (by the user directly or by playback).
1519 // That does not necessarily mean a paint event. First check if one of the items needs to load
1520 // first.
1521 auto item = playlist->getSelectedItems();
1522 int frameIdx = playback->getCurrentFrame();
1523 bool loadRawData = showRawData() && !playing;
1524 bool itemLoading[2] = {false, false};
1525 if (item[0])
1526 {
1527 auto state = item[0]->needsLoading(frameIdx, loadRawData);
1528 if (state == ItemLoadingState::LoadingNeeded)
1529 {
1530 // The frame needs to be loaded first.
1531 if (this->isMasterView)
1532 cache->loadFrame(item[0], frameIdx, 0);
1533 itemLoading[0] = true;
1534 }
1535 else if (playing && state == ItemLoadingState::LoadingNeededDoubleBuffer)
1536 {
1537 // We can immediately draw the new frame but then we need to update the double buffer
1538 if (this->isMasterView)
1539 {
1540 item[0]->activateDoubleBuffer();
1541 cache->loadFrame(item[0], frameIdx, 0);
1542 }
1543 }
1544 }
1545 if (isSplitting() && item[1])
1546 {
1547 auto state = item[1]->needsLoading(frameIdx, loadRawData);
1548 if (state == ItemLoadingState::LoadingNeeded)
1549 {
1550 // The frame needs to be loaded first.
1551 if (this->isMasterView)
1552 cache->loadFrame(item[1], frameIdx, 1);
1553 itemLoading[1] = true;
1554 }
1555 else if (playing && state == ItemLoadingState::LoadingNeededDoubleBuffer)
1556 {
1557 // We can immediately draw the new frame but then we need to update the double buffer
1558 if (this->isMasterView)
1559 {
1560 item[1]->activateDoubleBuffer();
1561 cache->loadFrame(item[1], frameIdx, 1);
1562 }

Callers 14

onZoomInMethod · 0.95
gridSetColorMethod · 0.95
zoomToFitInternalMethod · 0.95
setColorMapperMethod · 0.45
setPlainColorMethod · 0.45
goToNextItemMethod · 0.45
setModelMethod · 0.45
modelDataChangedMethod · 0.45

Calls 6

playingMethod · 0.80
getSelectedItemsMethod · 0.80
getCurrentFrameMethod · 0.80
needsLoadingMethod · 0.45
loadFrameMethod · 0.45
activateDoubleBufferMethod · 0.45

Tested by

no test coverage detected