Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/qpainter/scene_qpainter.cpp
Show First 20 Lines • Show All 281 Lines • ▼ Show 20 Line(s) | 277 | if (!opaque) { | |||
---|---|---|---|---|---|
282 | tempPainter.save(); | 282 | tempPainter.save(); | ||
283 | tempPainter.translate(toplevel->frameGeometry().topLeft() - toplevel->visibleRect().topLeft()); | 283 | tempPainter.translate(toplevel->frameGeometry().topLeft() - toplevel->visibleRect().topLeft()); | ||
284 | painter = &tempPainter; | 284 | painter = &tempPainter; | ||
285 | } | 285 | } | ||
286 | renderShadow(painter); | 286 | renderShadow(painter); | ||
287 | renderWindowDecorations(painter); | 287 | renderWindowDecorations(painter); | ||
288 | 288 | | |||
289 | // render content | 289 | // render content | ||
290 | const QRect target = QRect(toplevel->clientPos(), toplevel->clientSize()); | 290 | QRect source; | ||
291 | QSize srcSize = pixmap->image().size(); | 291 | QRect target; | ||
292 | if (pixmap->surface() && pixmap->surface()->scale() == 1 && srcSize != toplevel->clientSize()) { | 292 | if (toplevel->isClient()) { | ||
293 | // special case for XWayland windows | 293 | // special case for XWayland windows | ||
294 | srcSize = toplevel->clientSize(); | 294 | source = QRect(toplevel->clientPos(), toplevel->clientSize()); | ||
295 | target = source; | ||||
296 | } else { | ||||
297 | source = pixmap->image().rect(); | ||||
298 | target = toplevel->bufferGeometry().translated(-pos()); | ||||
295 | } | 299 | } | ||
296 | const QRect src = QRect(toplevel->clientPos() + toplevel->clientContentPos(), srcSize); | 300 | painter->drawImage(target, pixmap->image(), source); | ||
297 | painter->drawImage(target, pixmap->image(), src); | | |||
298 | 301 | | |||
299 | // render subsurfaces | 302 | // render subsurfaces | ||
300 | const auto &children = pixmap->children(); | 303 | const auto &children = pixmap->children(); | ||
301 | for (auto pixmap : children) { | 304 | for (auto pixmap : children) { | ||
302 | if (pixmap->subSurface().isNull() || pixmap->subSurface()->surface().isNull() || !pixmap->subSurface()->surface()->isMapped()) { | 305 | if (pixmap->subSurface().isNull() || pixmap->subSurface()->surface().isNull() || !pixmap->subSurface()->surface()->isMapped()) { | ||
303 | continue; | 306 | continue; | ||
304 | } | 307 | } | ||
305 | paintSubSurface(painter, toplevel->clientPos(), static_cast<QPainterWindowPixmap*>(pixmap)); | 308 | paintSubSurface(painter, bufferOffset(), static_cast<QPainterWindowPixmap*>(pixmap)); | ||
306 | } | 309 | } | ||
307 | 310 | | |||
308 | if (!opaque) { | 311 | if (!opaque) { | ||
309 | tempPainter.restore(); | 312 | tempPainter.restore(); | ||
310 | tempPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); | 313 | tempPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); | ||
311 | QColor translucent(Qt::transparent); | 314 | QColor translucent(Qt::transparent); | ||
312 | translucent.setAlphaF(data.opacity()); | 315 | translucent.setAlphaF(data.opacity()); | ||
313 | tempPainter.fillRect(QRect(QPoint(0, 0), toplevel->visibleRect().size()), translucent); | 316 | tempPainter.fillRect(QRect(QPoint(0, 0), toplevel->visibleRect().size()), translucent); | ||
▲ Show 20 Lines • Show All 587 Lines • Show Last 20 Lines |