MCPcopy Create free account
hub / github.com/collin80/SavvyCAN / drawBackground

Method drawBackground

qcustomplot.cpp:15048–15068  ·  view source on GitHub ↗

! \internal Draws the viewport background pixmap of the plot. If a pixmap was provided via \ref setBackground, this function buffers the scaled version depending on \ref setBackgroundScaled and \ref setBackgroundScaledMode and then draws it inside the viewport with the provided \a painter. The scaled version is buffered in mScaledBackgroundPixmap to prevent expensive rescaling at e

Source from the content-addressed store, hash-verified

15046 \see setBackground, setBackgroundScaled, setBackgroundScaledMode
15047*/
15048void QCustomPlot::drawBackground(QCPPainter *painter)
15049{
15050 // Note: background color is handled in individual replot/save functions
15051
15052 // draw background pixmap (on top of fill, if brush specified):
15053 if (!mBackgroundPixmap.isNull())
15054 {
15055 if (mBackgroundScaled)
15056 {
15057 // check whether mScaledBackground needs to be updated:
15058 QSize scaledSize(mBackgroundPixmap.size());
15059 scaledSize.scale(mViewport.size(), mBackgroundScaledMode);
15060 if (mScaledBackgroundPixmap.size() != scaledSize)
15061 mScaledBackgroundPixmap = mBackgroundPixmap.scaled(mViewport.size(), mBackgroundScaledMode, Qt::SmoothTransformation);
15062 painter->drawPixmap(mViewport.topLeft(), mScaledBackgroundPixmap, QRect(0, 0, mViewport.width(), mViewport.height()) & mScaledBackgroundPixmap.rect());
15063 } else
15064 {
15065 painter->drawPixmap(mViewport.topLeft(), mBackgroundPixmap, QRect(0, 0, mViewport.width(), mViewport.height()));
15066 }
15067 }
15068}
15069
15070/*! \internal
15071

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected