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

Method paintZoomBox

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

Source from the content-addressed store, hash-verified

617}
618
619void splitViewWidget::paintZoomBox(int view,
620 QPainter & painter,
621 int xSplit,
622 const QPoint &drawArea_botR,
623 playlistItem *item,
624 int frame,
625 const QPoint &pixelPos,
626 bool pixelPosInItem,
627 double zoomFactor,
628 bool playing)
629{
630 if (!this->drawZoomBox)
631 return;
632
633 const int zoomBoxWindowZoomFactor = 32;
634 const int srcSize = 5;
635 const int margin = 11;
636 const int padding = 6;
637 int zoomBoxSize = srcSize * zoomBoxWindowZoomFactor;
638
639 // Where will the zoom view go?
640 QRect zoomViewRect(0, 0, zoomBoxSize, zoomBoxSize);
641
642 bool drawInfoPanel = !playing; // Do we draw the info panel?
643 if (view == 1 && xSplit > (drawArea_botR.x() - margin - zoomBoxSize))
644 {
645 if (xSplit > drawArea_botR.x() - margin)
646 // The split line is so far on the right, that the whole zoom box in view 1 is not visible
647 return;
648
649 // The split line is so far right, that part of the zoom box is hidden.
650 // Resize the zoomViewRect to the part that is visible.
651 zoomViewRect.setWidth(drawArea_botR.x() - xSplit - margin);
652
653 drawInfoPanel = false; // Info panel not visible
654 }
655
656 // Do not draw the zoom view if the zoomFactor is equal or greater than that of the zoom box
657 if (zoomFactor < zoomBoxWindowZoomFactor)
658 {
659 if (view == 0 && isSplitting())
660 zoomViewRect.moveBottomRight(QPoint(xSplit - margin, drawArea_botR.y() - margin));
661 else
662 zoomViewRect.moveBottomRight(drawArea_botR - QPoint(margin, margin));
663
664 // Fill the viewRect with the background color
665 painter.setPen(Qt::black);
666 painter.fillRect(zoomViewRect, painter.background());
667
668 // Restrict drawing to the zoom view rectangle. Save the old clipping region (if any) so we can
669 // reset it later
670 QRegion clipRegion;
671 if (painter.hasClipping())
672 clipRegion = painter.clipRegion();
673 painter.setClipRegion(zoomViewRect);
674
675 // Translate the painter to the point where the center of the zoom view will be
676 painter.translate(zoomViewRect.center());

Callers

nothing calls this directly

Calls 6

appendMethod · 0.80
getSizeMethod · 0.45
drawItemMethod · 0.45
isEmptyMethod · 0.45
getPixelValuesMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected