MCPcopy Create free account
hub / github.com/CieNTi/serial_port_plotter / updateScaledPixmap

Method updateScaledPixmap

qcustomplot/qcustomplot.cpp:29503–29529  ·  view source on GitHub ↗

! \internal Creates the buffered scaled image (\a mScaledPixmap) to fit the specified \a finalRect. The parameters \a flipHorz and \a flipVert control whether the resulting image shall be flipped horizontally or vertically. (This is used when \a topLeft is further to the bottom/right than \a bottomRight.) This function only creates the scaled pixmap when the buffered pixmap has a d

Source from the content-addressed store, hash-verified

29501 If scaling is disabled, sets mScaledPixmap to a null QPixmap.
29502*/
29503void QCPItemPixmap::updateScaledPixmap(QRect finalRect, bool flipHorz, bool flipVert)
29504{
29505 if (mPixmap.isNull())
29506 return;
29507
29508 if (mScaled)
29509 {
29510#ifdef QCP_DEVICEPIXELRATIO_SUPPORTED
29511 double devicePixelRatio = mPixmap.devicePixelRatio();
29512#else
29513 double devicePixelRatio = 1.0;
29514#endif
29515 if (finalRect.isNull())
29516 finalRect = getFinalRect(&flipHorz, &flipVert);
29517 if (mScaledPixmapInvalidated || finalRect.size() != mScaledPixmap.size()/devicePixelRatio)
29518 {
29519 mScaledPixmap = mPixmap.scaled(finalRect.size()*devicePixelRatio, mAspectRatioMode, mTransformationMode);
29520 if (flipHorz || flipVert)
29521 mScaledPixmap = QPixmap::fromImage(mScaledPixmap.toImage().mirrored(flipHorz, flipVert));
29522#ifdef QCP_DEVICEPIXELRATIO_SUPPORTED
29523 mScaledPixmap.setDevicePixelRatio(devicePixelRatio);
29524#endif
29525 }
29526 } else if (!mScaledPixmap.isNull())
29527 mScaledPixmap = QPixmap();
29528 mScaledPixmapInvalidated = false;
29529}
29530
29531/*! \internal
29532

Callers

nothing calls this directly

Calls 2

setDevicePixelRatioMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected