Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/opengl/scene_opengl.cpp
Show First 20 Lines • Show All 792 Lines • ▼ Show 20 Line(s) | 792 | if (options->glPreferBufferSwap() == Options::ExtendDamage) { // only Extend "large" repaints | |||
---|---|---|---|---|---|
793 | const QRegion displayRegion(0, 0, screenSize.width(), screenSize.height()); | 793 | const QRegion displayRegion(0, 0, screenSize.width(), screenSize.height()); | ||
794 | uint damagedPixels = 0; | 794 | uint damagedPixels = 0; | ||
795 | const uint fullRepaintLimit = (opaqueFullscreen?0.49f:0.748f)*screenSize.width()*screenSize.height(); | 795 | const uint fullRepaintLimit = (opaqueFullscreen?0.49f:0.748f)*screenSize.width()*screenSize.height(); | ||
796 | // 16:9 is 75% of 4:3 and 2.55:1 is 49.01% of 5:4 | 796 | // 16:9 is 75% of 4:3 and 2.55:1 is 49.01% of 5:4 | ||
797 | // (5:4 is the most square format and 2.55:1 is Cinemascope55 - the widest ever shot | 797 | // (5:4 is the most square format and 2.55:1 is Cinemascope55 - the widest ever shot | ||
798 | // movie aspect - two times ;-) It's a Fox format, though, so maybe we want to restrict | 798 | // movie aspect - two times ;-) It's a Fox format, though, so maybe we want to restrict | ||
799 | // to 2.20:1 - Panavision - which has actually been used for interesting movies ...) | 799 | // to 2.20:1 - Panavision - which has actually been used for interesting movies ...) | ||
800 | // would be 57% of 5/4 | 800 | // would be 57% of 5/4 | ||
801 | foreach (const QRect &r, region.rects()) { | 801 | for (const QRect &r : region) { | ||
802 | // damagedPixels += r.width() * r.height(); // combined window damage test | 802 | // damagedPixels += r.width() * r.height(); // combined window damage test | ||
fredrik: This can also be written as:
for (const QRect &r : region) {
...
}
Note that QRegion… | |||||
803 | damagedPixels = r.width() * r.height(); // experimental single window damage testing | 803 | damagedPixels = r.width() * r.height(); // experimental single window damage testing | ||
804 | if (damagedPixels > fullRepaintLimit) { | 804 | if (damagedPixels > fullRepaintLimit) { | ||
805 | region = displayRegion; | 805 | region = displayRegion; | ||
806 | return; | 806 | return; | ||
807 | } | 807 | } | ||
808 | } | 808 | } | ||
809 | } else if (options->glPreferBufferSwap() == Options::PaintFullScreen) { // forced full rePaint | 809 | } else if (options->glPreferBufferSwap() == Options::PaintFullScreen) { // forced full rePaint | ||
810 | region = QRegion(0, 0, screenSize.width(), screenSize.height()); | 810 | region = QRegion(0, 0, screenSize.width(), screenSize.height()); | ||
▲ Show 20 Lines • Show All 362 Lines • ▼ Show 20 Line(s) | 1169 | { | |||
1173 | m_hardwareClipping = region != infiniteRegion() && (mask & PAINT_WINDOW_TRANSFORMED) && !(mask & PAINT_SCREEN_TRANSFORMED); | 1173 | m_hardwareClipping = region != infiniteRegion() && (mask & PAINT_WINDOW_TRANSFORMED) && !(mask & PAINT_SCREEN_TRANSFORMED); | ||
1174 | if (region != infiniteRegion() && !m_hardwareClipping) { | 1174 | if (region != infiniteRegion() && !m_hardwareClipping) { | ||
1175 | WindowQuadList quads; | 1175 | WindowQuadList quads; | ||
1176 | quads.reserve(data.quads.count()); | 1176 | quads.reserve(data.quads.count()); | ||
1177 | 1177 | | |||
1178 | const QRegion filterRegion = region.translated(-x(), -y()); | 1178 | const QRegion filterRegion = region.translated(-x(), -y()); | ||
1179 | // split all quads in bounding rect with the actual rects in the region | 1179 | // split all quads in bounding rect with the actual rects in the region | ||
1180 | foreach (const WindowQuad &quad, data.quads) { | 1180 | foreach (const WindowQuad &quad, data.quads) { | ||
1181 | foreach (const QRect &r, filterRegion.rects()) { | 1181 | for (const QRect &r : filterRegion) { | ||
1182 | const QRectF rf(r); | 1182 | const QRectF rf(r); | ||
1183 | const QRectF quadRect(QPointF(quad.left(), quad.top()), QPointF(quad.right(), quad.bottom())); | 1183 | const QRectF quadRect(QPointF(quad.left(), quad.top()), QPointF(quad.right(), quad.bottom())); | ||
1184 | const QRectF &intersected = rf.intersected(quadRect); | 1184 | const QRectF &intersected = rf.intersected(quadRect); | ||
1185 | if (intersected.isValid()) { | 1185 | if (intersected.isValid()) { | ||
1186 | if (quadRect == intersected) { | 1186 | if (quadRect == intersected) { | ||
1187 | // case 1: completely contains, include and do not check other rects | 1187 | // case 1: completely contains, include and do not check other rects | ||
1188 | quads << quad; | 1188 | quads << quad; | ||
1189 | break; | 1189 | break; | ||
▲ Show 20 Lines • Show All 1275 Lines • Show Last 20 Lines |
This can also be written as:
for (const QRect &r : region) {
}
Note that QRegion::begin() returns a const_iterator, and doesn't detach().