MCPcopy Create free account
hub / github.com/LUX-Core/lux / updateScaledPixmap

Method updateScaledPixmap

src/qt/qcustomplot.cpp:29410–29436  ·  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

29408 If scaling is disabled, sets mScaledPixmap to a null QPixmap.
29409*/
29410void QCPItemPixmap::updateScaledPixmap(QRect finalRect, bool flipHorz, bool flipVert)
29411{
29412 if (mPixmap.isNull())
29413 return;
29414
29415 if (mScaled)
29416 {
29417#ifdef QCP_DEVICEPIXELRATIO_SUPPORTED
29418 double devicePixelRatio = mPixmap.devicePixelRatio();
29419#else
29420 double devicePixelRatio = 1.0;
29421#endif
29422 if (finalRect.isNull())
29423 finalRect = getFinalRect(&flipHorz, &flipVert);
29424 if (mScaledPixmapInvalidated || finalRect.size() != mScaledPixmap.size()/devicePixelRatio)
29425 {
29426 mScaledPixmap = mPixmap.scaled(finalRect.size()*devicePixelRatio, mAspectRatioMode, mTransformationMode);
29427 if (flipHorz || flipVert)
29428 mScaledPixmap = QPixmap::fromImage(mScaledPixmap.toImage().mirrored(flipHorz, flipVert));
29429#ifdef QCP_DEVICEPIXELRATIO_SUPPORTED
29430 mScaledPixmap.setDevicePixelRatio(devicePixelRatio);
29431#endif
29432 }
29433 } else if (!mScaledPixmap.isNull())
29434 mScaledPixmap = QPixmap();
29435 mScaledPixmapInvalidated = false;
29436}
29437
29438/*! \internal
29439

Callers

nothing calls this directly

Calls 3

setDevicePixelRatioMethod · 0.80
isNullMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected