MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / createCachedLabel

Method createCachedLabel

3rdparty/qcustomplot/qcustomplot.cpp:5960–5986  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5958*/
5959
5960QCPLabelPainterPrivate::CachedLabel *QCPLabelPainterPrivate::createCachedLabel(const LabelData &labelData) const
5961{
5962 CachedLabel *result = new CachedLabel;
5963
5964 // allocate pixmap with the correct size and pixel ratio:
5965 if (!qFuzzyCompare(1.0, mParentPlot->bufferDevicePixelRatio()))
5966 {
5967 result->pixmap = QPixmap(labelData.rotatedTotalBounds.size()*mParentPlot->bufferDevicePixelRatio());
5968#ifdef QCP_DEVICEPIXELRATIO_SUPPORTED
5969# ifdef QCP_DEVICEPIXELRATIO_FLOAT
5970 result->pixmap.setDevicePixelRatio(mParentPlot->devicePixelRatioF());
5971# else
5972 result->pixmap.setDevicePixelRatio(mParentPlot->devicePixelRatio());
5973# endif
5974#endif
5975 } else
5976 result->pixmap = QPixmap(labelData.rotatedTotalBounds.size());
5977 result->pixmap.fill(Qt::transparent);
5978
5979 // draw the label into the pixmap
5980 // offset is between label anchor and topleft of cache pixmap, so pixmap can be drawn at pos+offset to make the label anchor appear at pos.
5981 // We use rotatedTotalBounds.topLeft() because rotatedTotalBounds is in a coordinate system where the label anchor is at (0, 0)
5982 result->offset = labelData.rotatedTotalBounds.topLeft();
5983 QCPPainter cachePainter(&result->pixmap);
5984 drawText(&cachePainter, -result->offset, labelData);
5985 return result;
5986}
5987
5988QByteArray QCPLabelPainterPrivate::cacheKey(const QString &text, const QColor &color, double rotation, AnchorSide side) const
5989{

Callers

nothing calls this directly

Calls 3

setDevicePixelRatioMethod · 0.80
fillMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected