MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / updateColorPicker

Method updateColorPicker

Gui/ViewerGL.cpp:2611–2727  ·  view source on GitHub ↗

used to update the information bar at the bottom of the viewer (not for the ctrl-click color picker)

Source from the content-addressed store, hash-verified

2609
2610// used to update the information bar at the bottom of the viewer (not for the ctrl-click color picker)
2611void
2612ViewerGL::updateColorPicker(int textureIndex,
2613 int x,
2614 int y)
2615{
2616 if ( (_imp->pickerState != ePickerStateInactive) || !_imp->viewerTab || !_imp->viewerTab->getGui() || _imp->viewerTab->getGui()->isGUIFrozen() ) {
2617 return;
2618 }
2619
2620 const std::list<Histogram*>& histograms = _imp->viewerTab->getGui()->getHistograms();
2621
2622 // always running in the main thread
2623 assert( qApp && qApp->thread() == QThread::currentThread() );
2624 if ( !displayingImage() ) {
2625 for (std::list<Histogram*>::const_iterator it = histograms.begin(); it != histograms.end(); ++it) {
2626 if ( (*it)->getViewerTextureInputDisplayed() == textureIndex ) {
2627 (*it)->hideViewerCursor();
2628 }
2629 }
2630 if ( _imp->infoViewer[textureIndex]->colorVisible() ) {
2631 _imp->infoViewer[textureIndex]->hideColorInfo();
2632 }
2633 if (textureIndex == 0) {
2634 setParametricParamsPickerColor(OfxRGBAColourD(), false, false);
2635 }
2636 return;
2637 }
2638
2639
2640 QPoint pos;
2641 bool xInitialized = false;
2642 bool yInitialized = false;
2643 if (x != std::numeric_limits<int>::max()) {
2644 xInitialized = true;
2645 pos.setX(x);
2646 }
2647 if (y != std::numeric_limits<int>::max()) {
2648 yInitialized = true;
2649 pos.setY(y);
2650 }
2651
2652 QPointF imgPosCanonical;
2653 if (!xInitialized || !yInitialized) {
2654 if ( !_imp->viewerTab->isViewersSynchroEnabled() ) {
2655 pos = mapFromGlobal( QCursor::pos() );
2656 QMutexLocker l(&_imp->zoomCtxMutex);
2657 imgPosCanonical = _imp->zoomCtx.toZoomCoordinates( pos.x(), pos.y() );
2658 } else {
2659 ViewerTab* masterViewer = getViewerTab()->getGui()->getMasterSyncViewer();
2660 if (masterViewer) {
2661 pos = masterViewer->getViewer()->mapFromGlobal( QCursor::pos() );
2662 imgPosCanonical = masterViewer->getViewer()->toZoomCoordinates(pos);
2663 } else {
2664 pos = mapFromGlobal( QCursor::pos() );
2665 QMutexLocker l(&_imp->zoomCtxMutex);
2666 imgPosCanonical = _imp->zoomCtx.toZoomCoordinates( pos.x(), pos.y() );
2667 }
2668 }

Callers 1

updateViewerMethod · 0.80

Calls 15

maxFunction · 0.85
isGUIFrozenMethod · 0.80
hideViewerCursorMethod · 0.80
colorVisibleMethod · 0.80
hideColorInfoMethod · 0.80
getMasterSyncViewerMethod · 0.80
getColorPickerLinearMethod · 0.80
getCurrentSettingsMethod · 0.80
setColorValidMethod · 0.80
setColorApproximatedMethod · 0.80

Tested by

no test coverage detected