| 2262 | } |
| 2263 | |
| 2264 | void StickerSetBox::Inner::paintSticker( |
| 2265 | Painter &p, |
| 2266 | int index, |
| 2267 | QPoint position, |
| 2268 | bool paused, |
| 2269 | crl::time now) const { |
| 2270 | if (_dragging.index != index) { |
| 2271 | const auto over = _elements[index].overAnimation.value( |
| 2272 | (index == _selected) ? 1. : 0.); |
| 2273 | if (over) { |
| 2274 | p.setOpacity(over); |
| 2275 | Ui::FillRoundRect( |
| 2276 | p, |
| 2277 | QRect( |
| 2278 | rtl() |
| 2279 | ? QPoint( |
| 2280 | width() - position.x() - _singleSize.width(), |
| 2281 | position.y()) |
| 2282 | : position, |
| 2283 | _singleSize), |
| 2284 | st::emojiPanHover, |
| 2285 | Ui::StickerHoverCorners); |
| 2286 | p.setOpacity(1); |
| 2287 | } |
| 2288 | } |
| 2289 | |
| 2290 | const auto hasShake = _shakeAnimation.animating(); |
| 2291 | if (hasShake) { |
| 2292 | shakeTransform(p, index, position, now); |
| 2293 | } |
| 2294 | |
| 2295 | const auto &element = _elements[index]; |
| 2296 | const auto document = element.document; |
| 2297 | const auto &media = element.documentMedia; |
| 2298 | const auto sticker = document->sticker(); |
| 2299 | media->checkStickerSmall(); |
| 2300 | |
| 2301 | if (sticker->setType == Data::StickersType::Emoji) { |
| 2302 | const_cast<Inner*>(this)->setupEmoji(index); |
| 2303 | } else if (media->loaded()) { |
| 2304 | if (sticker->isLottie() && !element.lottie) { |
| 2305 | const_cast<Inner*>(this)->setupLottie(index); |
| 2306 | } else if (sticker->isWebm() && !element.webm) { |
| 2307 | const_cast<Inner*>(this)->setupWebm(index); |
| 2308 | } |
| 2309 | } |
| 2310 | |
| 2311 | const auto premium = document->isPremiumSticker(); |
| 2312 | const auto size = ChatHelpers::ComputeStickerSize( |
| 2313 | document, |
| 2314 | boundingBoxSize()); |
| 2315 | const auto ppos = position + QPoint( |
| 2316 | (_singleSize.width() - size.width()) / 2, |
| 2317 | (_singleSize.height() - size.height()) / 2); |
| 2318 | auto lottieFrame = QImage(); |
| 2319 | if (element.emoji) { |
| 2320 | element.emoji->paint(p, { |
| 2321 | .textColor = st::windowFg->c, |
nothing calls this directly
no test coverage detected