QStyleSheetstyle: misc cleanup of QStyleSheetBorderImageData
Remove unused member 'image' from QStyleSheetBorderImageData and replace c array with std::array<>. Pick-to: 6.9 Change-Id: I149ef72e443027a6b6d30f25e8c7b1adf4138fc5 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
da3422ca15
commit
d34754ea81
@ -333,16 +333,10 @@ static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = {
|
|||||||
|
|
||||||
struct QStyleSheetBorderImageData : public QSharedData
|
struct QStyleSheetBorderImageData : public QSharedData
|
||||||
{
|
{
|
||||||
QStyleSheetBorderImageData()
|
std::array<int, 4> cuts = {-1, -1, -1, -1};
|
||||||
: horizStretch(QCss::TileMode_Unknown), vertStretch(QCss::TileMode_Unknown)
|
QCss::TileMode horizStretch = QCss::TileMode_Unknown;
|
||||||
{
|
QCss::TileMode vertStretch = QCss::TileMode_Unknown;
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
cuts[i] = -1;
|
|
||||||
}
|
|
||||||
int cuts[4];
|
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
QImage image;
|
|
||||||
QCss::TileMode horizStretch, vertStretch;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QStyleSheetBackgroundData : public QSharedData
|
struct QStyleSheetBackgroundData : public QSharedData
|
||||||
@ -1015,9 +1009,9 @@ QRenderRule::QRenderRule(const QList<Declaration> &declarations, const QObject *
|
|||||||
if (decl.d->propertyId == BorderImage) {
|
if (decl.d->propertyId == BorderImage) {
|
||||||
QString uri;
|
QString uri;
|
||||||
QCss::TileMode horizStretch, vertStretch;
|
QCss::TileMode horizStretch, vertStretch;
|
||||||
int cuts[4];
|
std::array<int, 4> cuts;
|
||||||
|
|
||||||
decl.borderImageValue(&uri, cuts, &horizStretch, &vertStretch);
|
decl.borderImageValue(&uri, cuts.data(), &horizStretch, &vertStretch);
|
||||||
if (uri.isEmpty() || uri == "none"_L1) {
|
if (uri.isEmpty() || uri == "none"_L1) {
|
||||||
if (bd && bd->bi)
|
if (bd && bd->bi)
|
||||||
bd->bi->pixmap = QPixmap();
|
bd->bi->pixmap = QPixmap();
|
||||||
@ -1029,8 +1023,7 @@ QRenderRule::QRenderRule(const QList<Declaration> &declarations, const QObject *
|
|||||||
|
|
||||||
QStyleSheetBorderImageData *bi = bd->bi;
|
QStyleSheetBorderImageData *bi = bd->bi;
|
||||||
bi->pixmap = QStyleSheetStyle::loadPixmap(uri, object);
|
bi->pixmap = QStyleSheetStyle::loadPixmap(uri, object);
|
||||||
for (int i = 0; i < 4; i++)
|
bi->cuts = cuts;
|
||||||
bi->cuts[i] = cuts[i];
|
|
||||||
bi->horizStretch = horizStretch;
|
bi->horizStretch = horizStretch;
|
||||||
bi->vertStretch = vertStretch;
|
bi->vertStretch = vertStretch;
|
||||||
}
|
}
|
||||||
@ -1229,7 +1222,7 @@ void QRenderRule::drawBorderImage(QPainter *p, const QRect& rect)
|
|||||||
|
|
||||||
const QStyleSheetBorderImageData *borderImageData = border()->borderImage();
|
const QStyleSheetBorderImageData *borderImageData = border()->borderImage();
|
||||||
const int *targetBorders = border()->borders;
|
const int *targetBorders = border()->borders;
|
||||||
const int *sourceBorders = borderImageData->cuts;
|
const auto sourceBorders = borderImageData->cuts;
|
||||||
QMargins sourceMargins(sourceBorders[LeftEdge], sourceBorders[TopEdge],
|
QMargins sourceMargins(sourceBorders[LeftEdge], sourceBorders[TopEdge],
|
||||||
sourceBorders[RightEdge], sourceBorders[BottomEdge]);
|
sourceBorders[RightEdge], sourceBorders[BottomEdge]);
|
||||||
QMargins targetMargins(targetBorders[LeftEdge], targetBorders[TopEdge],
|
QMargins targetMargins(targetBorders[LeftEdge], targetBorders[TopEdge],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user