MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / updateScaledPixmap

Method updateScaledPixmap

3rdparty/qcustomplot/qcustomplot.cpp:30295–30321  ·  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

30293 If scaling is disabled, sets mScaledPixmap to a null QPixmap.
30294*/
30295void QCPItemPixmap::updateScaledPixmap(QRect finalRect, bool flipHorz, bool flipVert)
30296{
30297 if (mPixmap.isNull())
30298 return;
30299
30300 if (mScaled)
30301 {
30302#ifdef QCP_DEVICEPIXELRATIO_SUPPORTED
30303 double devicePixelRatio = mPixmap.devicePixelRatio();
30304#else
30305 double devicePixelRatio = 1.0;
30306#endif
30307 if (finalRect.isNull())
30308 finalRect = getFinalRect(&flipHorz, &flipVert);
30309 if (mScaledPixmapInvalidated || finalRect.size() != mScaledPixmap.size()/devicePixelRatio)
30310 {
30311 mScaledPixmap = mPixmap.scaled(finalRect.size()*devicePixelRatio, mAspectRatioMode, mTransformationMode);
30312 if (flipHorz || flipVert)
30313 mScaledPixmap = QPixmap::fromImage(mScaledPixmap.toImage().mirrored(flipHorz, flipVert));
30314#ifdef QCP_DEVICEPIXELRATIO_SUPPORTED
30315 mScaledPixmap.setDevicePixelRatio(devicePixelRatio);
30316#endif
30317 }
30318 } else if (!mScaledPixmap.isNull())
30319 mScaledPixmap = QPixmap();
30320 mScaledPixmapInvalidated = false;
30321}
30322
30323/*! \internal
30324

Callers

nothing calls this directly

Calls 3

setDevicePixelRatioMethod · 0.80
isNullMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected