! \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
| 15796 | \see setBackground, setBackgroundScaled, setBackgroundScaledMode |
| 15797 | */ |
| 15798 | void QCustomPlot::drawBackground(QCPPainter *painter) |
| 15799 | { |
| 15800 | // Note: background color is handled in individual replot/save functions |
| 15801 | |
| 15802 | // draw background pixmap (on top of fill, if brush specified): |
| 15803 | if (!mBackgroundPixmap.isNull()) |
| 15804 | { |
| 15805 | if (mBackgroundScaled) |
| 15806 | { |
| 15807 | // check whether mScaledBackground needs to be updated: |
| 15808 | QSize scaledSize(mBackgroundPixmap.size()); |
| 15809 | scaledSize.scale(mViewport.size(), mBackgroundScaledMode); |
| 15810 | if (mScaledBackgroundPixmap.size() != scaledSize) |
| 15811 | mScaledBackgroundPixmap = mBackgroundPixmap.scaled(mViewport.size(), mBackgroundScaledMode, Qt::SmoothTransformation); |
| 15812 | painter->drawPixmap(mViewport.topLeft(), mScaledBackgroundPixmap, QRect(0, 0, mViewport.width(), mViewport.height()) & mScaledBackgroundPixmap.rect()); |
| 15813 | } else |
| 15814 | { |
| 15815 | painter->drawPixmap(mViewport.topLeft(), mBackgroundPixmap, QRect(0, 0, mViewport.width(), mViewport.height())); |
| 15816 | } |
| 15817 | } |
| 15818 | } |
| 15819 | |
| 15820 | /*! \internal |
| 15821 |