Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/opengl/scene_opengl.cpp
Show First 20 Lines • Show All 2556 Lines • ▼ Show 20 Line(s) | 2556 | for (int i = 0; i < bottom; ++i) { | |||
---|---|---|---|---|---|
2557 | uint32_t *dest = reinterpret_cast<uint32_t *>(image.scanLine(top + height + i)); | 2557 | uint32_t *dest = reinterpret_cast<uint32_t *>(image.scanLine(top + height + i)); | ||
2558 | clamp_row(left, width, right, lastRow + left, dest); | 2558 | clamp_row(left, width, right, lastRow + left, dest); | ||
2559 | } | 2559 | } | ||
2560 | } | 2560 | } | ||
2561 | 2561 | | |||
2562 | void SceneOpenGLDecorationRenderer::render() | 2562 | void SceneOpenGLDecorationRenderer::render() | ||
2563 | { | 2563 | { | ||
2564 | const QRegion scheduled = getScheduled(); | 2564 | const QRegion scheduled = getScheduled(); | ||
2565 | const bool dirty = areImageSizesDirty(); | 2565 | if (scheduled.isEmpty()) { | ||
2566 | if (scheduled.isEmpty() && !dirty) { | | |||
davidedmundson: Can you talk me through this change:
Previously when we have a non empty scheduled region but… | |||||
This check verifies whether the decoration is actually dirty; that's it, either the decoration was damaged by a call to KDecoration2::Decoration::update() or the decorated client was resized.
I think that's a question I should ask. You added this check. :-) zzag: This check verifies whether the decoration is actually dirty; that's it, either the decoration… | |||||
The key assumption: if areImageSizesDirty() returns true, then the scheduled region is not empty. zzag: The key assumption: if `areImageSizesDirty()` returns `true`, then the scheduled region is not… | |||||
Ha, you're right. Given markAsDirty schedules a region this should be fine. davidedmundson: >I think that's a question I should ask. You added this check. :-)
Ha, you're right.
Given… | |||||
2567 | return; | 2566 | return; | ||
2568 | } | 2567 | } | ||
2569 | if (dirty) { | 2568 | if (areImageSizesDirty()) { | ||
2570 | resizeTexture(); | 2569 | resizeTexture(); | ||
2571 | resetImageSizesDirty(); | 2570 | resetImageSizesDirty(); | ||
2572 | } | 2571 | } | ||
2573 | 2572 | | |||
2574 | if (!m_texture) { | 2573 | if (!m_texture) { | ||
2575 | // for invalid sizes we get no texture, see BUG 361551 | 2574 | // for invalid sizes we get no texture, see BUG 361551 | ||
2576 | return; | 2575 | return; | ||
2577 | } | 2576 | } | ||
2578 | 2577 | | |||
2579 | QRect left, top, right, bottom; | 2578 | QRect left, top, right, bottom; | ||
2580 | client()->client()->layoutDecorationRects(left, top, right, bottom); | 2579 | client()->client()->layoutDecorationRects(left, top, right, bottom); | ||
2581 | 2580 | | |||
2582 | const QRect geometry = dirty ? QRect(QPoint(0, 0), client()->client()->size()) : scheduled.boundingRect(); | | |||
2583 | | ||||
2584 | // We pad each part in the decoration atlas in order to avoid texture bleeding. | 2581 | // We pad each part in the decoration atlas in order to avoid texture bleeding. | ||
2585 | const int padding = 1; | 2582 | const int padding = 1; | ||
2586 | 2583 | | |||
2587 | auto renderPart = [=](const QRect &geo, const QRect &partRect, const QPoint &position, bool rotated = false) { | 2584 | auto renderPart = [=](const QRect &geo, const QRect &partRect, const QPoint &position, bool rotated = false) { | ||
2588 | if (!geo.isValid()) { | 2585 | if (!geo.isValid()) { | ||
2589 | return; | 2586 | return; | ||
2590 | } | 2587 | } | ||
2591 | 2588 | | |||
Show All 37 Lines | 2624 | if (rotated) { | |||
2629 | image = rotate(image, QRect(QPoint(), rect.size())); | 2626 | image = rotate(image, QRect(QPoint(), rect.size())); | ||
2630 | viewport = QRect(viewport.y(), viewport.x(), viewport.height(), viewport.width()); | 2627 | viewport = QRect(viewport.y(), viewport.x(), viewport.height(), viewport.width()); | ||
2631 | } | 2628 | } | ||
2632 | 2629 | | |||
2633 | const QPoint dirtyOffset = geo.topLeft() - partRect.topLeft(); | 2630 | const QPoint dirtyOffset = geo.topLeft() - partRect.topLeft(); | ||
2634 | m_texture->update(image, (position + dirtyOffset - viewport.topLeft()) * image.devicePixelRatio()); | 2631 | m_texture->update(image, (position + dirtyOffset - viewport.topLeft()) * image.devicePixelRatio()); | ||
2635 | }; | 2632 | }; | ||
2636 | 2633 | | |||
2634 | const QRect geometry = scheduled.boundingRect(); | ||||
2635 | | ||||
2637 | const QPoint topPosition(padding, padding); | 2636 | const QPoint topPosition(padding, padding); | ||
2638 | const QPoint bottomPosition(padding, topPosition.y() + top.height() + 2 * padding); | 2637 | const QPoint bottomPosition(padding, topPosition.y() + top.height() + 2 * padding); | ||
2639 | const QPoint leftPosition(padding, bottomPosition.y() + bottom.height() + 2 * padding); | 2638 | const QPoint leftPosition(padding, bottomPosition.y() + bottom.height() + 2 * padding); | ||
2640 | const QPoint rightPosition(padding, leftPosition.y() + left.width() + 2 * padding); | 2639 | const QPoint rightPosition(padding, leftPosition.y() + left.width() + 2 * padding); | ||
2641 | 2640 | | |||
2642 | renderPart(left.intersected(geometry), left, leftPosition, true); | 2641 | renderPart(left.intersected(geometry), left, leftPosition, true); | ||
2643 | renderPart(top.intersected(geometry), top, topPosition); | 2642 | renderPart(top.intersected(geometry), top, topPosition); | ||
2644 | renderPart(right.intersected(geometry), right, rightPosition, true); | 2643 | renderPart(right.intersected(geometry), right, rightPosition, true); | ||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |
Can you talk me through this change:
Previously when we have a non empty scheduled region but image sizes are dirty we didn't return early.
Was that purely a hack for decorations?