Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/scene_qpainter_drm_backend.cpp
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | |||||
63 | void DrmQPainterBackend::initOutput(DrmOutput *output) | 63 | void DrmQPainterBackend::initOutput(DrmOutput *output) | ||
64 | { | 64 | { | ||
65 | Output o; | 65 | Output o; | ||
66 | auto initBuffer = [&o, output, this] (int index) { | 66 | auto initBuffer = [&o, output, this] (int index) { | ||
67 | o.buffer[index] = m_backend->createBuffer(output->pixelSize()); | 67 | o.buffer[index] = m_backend->createBuffer(output->pixelSize()); | ||
68 | o.buffer[index]->map(); | 68 | o.buffer[index]->map(); | ||
69 | o.buffer[index]->image()->fill(Qt::black); | 69 | o.buffer[index]->image()->fill(Qt::black); | ||
70 | }; | 70 | }; | ||
71 | connect(output, &DrmOutput::modeChanged, this, | ||||
72 | [output, this] { | ||||
73 | auto it = std::find_if(m_outputs.begin(), m_outputs.end(), | ||||
74 | [output] (const auto &o) { | ||||
75 | return o.output == output; | ||||
76 | } | ||||
77 | ); | ||||
78 | if (it == m_outputs.end()) { | ||||
79 | return; | ||||
80 | } | ||||
81 | delete (*it).buffer[0]; | ||||
82 | delete (*it).buffer[1]; | ||||
83 | auto initBuffer = [it, output, this] (int index) { | ||||
84 | it->buffer[index] = m_backend->createBuffer(output->pixelSize()); | ||||
85 | it->buffer[index]->map(); | ||||
86 | it->buffer[index]->image()->fill(Qt::black); | ||||
87 | }; | ||||
88 | initBuffer(0); | ||||
89 | initBuffer(1); | ||||
90 | } | ||||
91 | ); | ||||
71 | initBuffer(0); | 92 | initBuffer(0); | ||
72 | initBuffer(1); | 93 | initBuffer(1); | ||
73 | o.output = output; | 94 | o.output = output; | ||
74 | m_outputs << o; | 95 | m_outputs << o; | ||
75 | } | 96 | } | ||
76 | 97 | | |||
77 | QImage *DrmQPainterBackend::buffer() | 98 | QImage *DrmQPainterBackend::buffer() | ||
78 | { | 99 | { | ||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |