Changeset View
Changeset View
Standalone View
Standalone View
scene_opengl.cpp
Show First 20 Lines • Show All 2242 Lines • ▼ Show 20 Line(s) | 2239 | if ((left.width() - leftOffset() > topLevel()->width()) || | |||
---|---|---|---|---|---|
2243 | // if our shadow is bigger than the window, we don't render the shadow | 2243 | // if our shadow is bigger than the window, we don't render the shadow | ||
2244 | setShadowRegion(QRegion()); | 2244 | setShadowRegion(QRegion()); | ||
2245 | return; | 2245 | return; | ||
2246 | } | 2246 | } | ||
2247 | 2247 | | |||
2248 | const QRectF outerRect(QPointF(-leftOffset(), -topOffset()), | 2248 | const QRectF outerRect(QPointF(-leftOffset(), -topOffset()), | ||
2249 | QPointF(topLevel()->width() + rightOffset(), topLevel()->height() + bottomOffset())); | 2249 | QPointF(topLevel()->width() + rightOffset(), topLevel()->height() + bottomOffset())); | ||
2250 | 2250 | | |||
2251 | const int width = qMax(topLeft.width(), bottomLeft.width()) + | 2251 | const int width = std::max({topLeft.width(), left.width(), bottomLeft.width()}) + | ||
2252 | qMax(top.width(), bottom.width()) + | 2252 | std::max(top.width(), bottom.width()) + | ||
2253 | qMax(topRight.width(), bottomRight.width()); | 2253 | std::max({topRight.width(), right.width(), bottomRight.width()}); | ||
2254 | const int height = qMax(topLeft.height(), topRight.height()) + | 2254 | const int height = std::max({topLeft.height(), top.height(), topRight.height()}) + | ||
2255 | qMax(left.height(), right.height()) + | 2255 | std::max(left.height(), right.height()) + | ||
2256 | qMax(bottomLeft.height(), bottomRight.height()); | 2256 | std::max({bottomLeft.height(), bottom.height(), bottomRight.height()}); | ||
2257 | 2257 | | |||
2258 | qreal tx1(0.0), tx2(0.0), ty1(0.0), ty2(0.0); | 2258 | qreal tx1(0.0), tx2(0.0), ty1(0.0), ty2(0.0); | ||
2259 | 2259 | | |||
2260 | tx2 = topLeft.width()/width; | 2260 | tx2 = topLeft.width()/width; | ||
2261 | ty2 = topLeft.height()/height; | 2261 | ty2 = topLeft.height()/height; | ||
2262 | WindowQuad topLeftQuad(WindowQuadShadow); | 2262 | WindowQuad topLeftQuad(WindowQuadShadow); | ||
2263 | topLeftQuad[ 0 ] = WindowVertex(outerRect.x(), outerRect.y(), tx1, ty1); | 2263 | topLeftQuad[ 0 ] = WindowVertex(outerRect.x(), outerRect.y(), tx1, ty1); | ||
2264 | topLeftQuad[ 1 ] = WindowVertex(outerRect.x() + topLeft.width(), outerRect.y(), tx2, ty1); | 2264 | topLeftQuad[ 1 ] = WindowVertex(outerRect.x() + topLeft.width(), outerRect.y(), tx2, ty1); | ||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | 2341 | { | |||
2349 | const QSize top(shadowPixmap(ShadowElementTop).size()); | 2349 | const QSize top(shadowPixmap(ShadowElementTop).size()); | ||
2350 | const QSize topRight(shadowPixmap(ShadowElementTopRight).size()); | 2350 | const QSize topRight(shadowPixmap(ShadowElementTopRight).size()); | ||
2351 | const QSize right(shadowPixmap(ShadowElementRight).size()); | 2351 | const QSize right(shadowPixmap(ShadowElementRight).size()); | ||
2352 | const QSize bottom(shadowPixmap(ShadowElementBottom).size()); | 2352 | const QSize bottom(shadowPixmap(ShadowElementBottom).size()); | ||
2353 | const QSize bottomLeft(shadowPixmap(ShadowElementBottomLeft).size()); | 2353 | const QSize bottomLeft(shadowPixmap(ShadowElementBottomLeft).size()); | ||
2354 | const QSize left(shadowPixmap(ShadowElementLeft).size()); | 2354 | const QSize left(shadowPixmap(ShadowElementLeft).size()); | ||
2355 | const QSize topLeft(shadowPixmap(ShadowElementTopLeft).size()); | 2355 | const QSize topLeft(shadowPixmap(ShadowElementTopLeft).size()); | ||
2356 | const QSize bottomRight(shadowPixmap(ShadowElementBottomRight).size()); | 2356 | const QSize bottomRight(shadowPixmap(ShadowElementBottomRight).size()); | ||
2357 | 2357 | | |||
2358 | const int width = qMax(topLeft.width(), bottomLeft.width()) + | 2358 | const int width = std::max({topLeft.width(), left.width(), bottomLeft.width()}) + | ||
mart: oh, i get it now, i like that logic | |||||
2359 | qMax(top.width(), bottom.width()) + | 2359 | std::max(top.width(), bottom.width()) + | ||
2360 | qMax(topRight.width(), bottomRight.width()); | 2360 | std::max({topRight.width(), right.width(), bottomRight.width()}); | ||
2361 | 2361 | const int height = std::max({topLeft.height(), top.height(), topRight.height()}) + | |||
2362 | const int height = qMax(topRight.height(), topLeft.height()) + | 2362 | std::max(left.height(), right.height()) + | ||
2363 | qMax(left.height(), right.height()) + | 2363 | std::max({bottomLeft.height(), bottom.height(), bottomRight.height()}); | ||
2364 | qMax(bottomLeft.height(), bottomRight.height()); | | |||
2365 | 2364 | | |||
2366 | if (width == 0 || height == 0) { | 2365 | if (width == 0 || height == 0) { | ||
2367 | return false; | 2366 | return false; | ||
2368 | } | 2367 | } | ||
2369 | 2368 | | |||
2370 | QImage image(width, height, QImage::Format_ARGB32); | 2369 | QImage image(width, height, QImage::Format_ARGB32); | ||
2371 | image.fill(Qt::transparent); | 2370 | image.fill(Qt::transparent); | ||
2372 | QPainter p; | 2371 | QPainter p; | ||
▲ Show 20 Lines • Show All 183 Lines • Show Last 20 Lines |
oh, i get it now, i like that logic