[decorations] Fix rendering for depth 30 (10bpc)
When the display is set to 30-bit depth (10-bit per color component), decorations of some clients appear garbled when compositing is disabled. This is because the pixel format of the QImage in which the decorations were rendered differed from the the X pixmap into which the pixels were being copied by means of xcb_put_image(). For lack of a more robust way, this change guesses A2RGB30 for depth=30, and keeps using ARGB32 as before for any other depth. I don't expect anything other to 32bpp to be supported by KWin anyway. Tested on amdgpu with KWIN_OPENGL_INTERFACE=egl. BUG: 406302 FIXED-IN: 5.19.4
This commit is contained in:
parent
72cd67cbf6
commit
0c67eb983c
1 changed files with 20 additions and 1 deletions
|
@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
#include "decorationrenderer.h"
|
||||
#include "decoratedclient.h"
|
||||
#include "decorations/decorations_logging.h"
|
||||
#include "deleted.h"
|
||||
#include "abstract_client.h"
|
||||
#include "screens.h"
|
||||
|
@ -67,7 +68,25 @@ QImage Renderer::renderToImage(const QRect &geo)
|
|||
{
|
||||
Q_ASSERT(m_client);
|
||||
auto dpr = client()->client()->screenScale();
|
||||
QImage image(geo.width() * dpr, geo.height() * dpr, QImage::Format_ARGB32_Premultiplied);
|
||||
|
||||
// Guess the pixel format of the X pixmap into which the QImage will be copied.
|
||||
QImage::Format format;
|
||||
const int depth = client()->client()->depth();
|
||||
switch (depth) {
|
||||
case 30:
|
||||
format = QImage::Format_A2RGB30_Premultiplied;
|
||||
break;
|
||||
case 24:
|
||||
case 32:
|
||||
format = QImage::Format_ARGB32_Premultiplied;
|
||||
break;
|
||||
default:
|
||||
qCCritical(KWIN_DECORATIONS) << "Unsupported client depth" << depth;
|
||||
format = QImage::Format_ARGB32_Premultiplied;
|
||||
break;
|
||||
};
|
||||
|
||||
QImage image(geo.width() * dpr, geo.height() * dpr, format);
|
||||
image.setDevicePixelRatio(dpr);
|
||||
image.fill(Qt::transparent);
|
||||
QPainter p(&image);
|
||||
|
|
Loading…
Reference in a new issue