Commit a00f3fc
committed
Add support capturing QtQuick windows backed by Qt Rhi
This is an interesting QtQuick backend to support because of some of the
inherent design limitations we have to work around. But we are now able
to capture and draw target decorations for these windows backed by Rhi
now.
The first problem we have to tackle is actually capturing the window
contents, but fortunately Qt already has public API to do this. They
don't provide a mapping from their bespoke Rhi texture format to QImage
unfortunately, but I added a user-visible error message so it's easier
for people to submit bugreports for any missing cases.
I tried to optimize the readback as best I could, and the performance is
about on-par to the OpenGL screen grabber. (I didn't actually benchmark,
but it looks good enough to my own eyes.)
Another tricky problem to tackle is drawing the remote target
decorations, because we previously assumed we always had a QPainter to
draw in. (For context, the client's viewport is drawn in QPainter and in
the OpenGL there's QOpenGLPaintDevice available.) Not only that, but we
can't exactly tell *when* to let Qt readback the swapchain image. The
pre-existing screengrabbers grabbed the backbuffer before we drew target
decorations so we could draw them client-side.
For the drawing part I don't think there's anything we could do save for
rewriting it in QtRHI, so we upload it into a texture and draw it onto
the backbuffer. Yes it is "slow" but it's more than good enough than it
not working at all.
For the target decoration part that's not going to be easily possible,
so I decided to not do it! Instead, we let ourselves capture the full
window contents *including* the decorations we drew. We then skip
drawing decorations client-side, and it's practically the same
experience save for anything drawn outside the window. That limitation
is going to be planned to be addressed in a future patch.1 parent 5bb3e8d commit a00f3fc
8 files changed
Lines changed: 441 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
| 509 | + | |
| 510 | + | |
509 | 511 | | |
510 | 512 | | |
511 | 513 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
82 | 94 | | |
83 | 95 | | |
84 | 96 | | |
85 | 97 | | |
86 | 98 | | |
87 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
88 | 103 | | |
89 | 104 | | |
90 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| |||
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
615 | | - | |
616 | | - | |
617 | | - | |
| 615 | + | |
618 | 616 | | |
| 617 | + | |
| 618 | + | |
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
155 | 161 | | |
156 | 162 | | |
157 | 163 | | |
| |||
0 commit comments