| 5958 | */ |
| 5959 | |
| 5960 | QCPLabelPainterPrivate::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 | |
| 5988 | QByteArray QCPLabelPainterPrivate::cacheKey(const QString &text, const QColor &color, double rotation, AnchorSide side) const |
| 5989 | { |
nothing calls this directly
no test coverage detected