common: make the atlas repack shared and testable
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Failing after 20s
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Failing after 20s
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Failing after 20s
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Failing after 20s
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Failing after 19s
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Failing after 20s
build / module (push) Failing after 16s
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Failing after 19s
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Failing after 19s
build / host-linux (push) Failing after 18s
build / host-windows-cross (push) Failing after 18s
build / obs (clang) (push) Failing after 19s
build / docs (push) Failing after 3s
build / obs (gcc) (push) Failing after 19s
build / host-windows-native (push) Canceled after 0s
build / idd (push) Canceled after 0s
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Failing after 20s
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Failing after 20s
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Failing after 20s
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Failing after 20s
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Failing after 19s
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Failing after 20s
build / module (push) Failing after 16s
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Failing after 19s
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Failing after 19s
build / host-linux (push) Failing after 18s
build / host-windows-cross (push) Failing after 18s
build / obs (clang) (push) Failing after 19s
build / docs (push) Failing after 3s
build / obs (gcc) (push) Failing after 19s
build / host-windows-native (push) Canceled after 0s
build / idd (push) Canceled after 0s
Moves the per-display copy out of the XCB backend into common so it can be unit tested directly and reused by other backends. The test uses a unique value per source pixel, so a copy landing at the wrong offset cannot pass by coincidence, and checks truncation against guard bytes. Also adds a scripted end-to-end test and teaches the verification tool to report a blank capture source as a skip rather than a failure.
This commit is contained in:
1 parent
ba32d48a6a
commit
faaf63bc93
6 files changed
+354
-42
No files matched your search
@@ -242,6 +242,53 @@ bool lgDisplaysPack(
|
||||
return true;
|
||||
}
|
||||
|
||||
void lgDisplaysRepack(
|
||||
uint8_t * dst,
|
||||
unsigned dstPitch,
|
||||
unsigned dstHeight,
|
||||
const uint8_t * src,
|
||||
unsigned srcPitch,
|
||||
unsigned srcWidth,
|
||||
unsigned srcHeight,
|
||||
const KVMFRDisplay * displays,
|
||||
const uint32_t * srcX,
|
||||
const uint32_t * srcY,
|
||||
unsigned count,
|
||||
unsigned bytesPerPixel)
|
||||
{
|
||||
for(unsigned i = 0; i < count; ++i)
|
||||
{
|
||||
const KVMFRDisplay * d = &displays[i];
|
||||
|
||||
// a display should always sit inside the source, but never trust it to
|
||||
if (srcX[i] >= srcWidth || srcY[i] >= srcHeight)
|
||||
continue;
|
||||
|
||||
unsigned width = d->atlasWidth;
|
||||
unsigned rows = d->atlasHeight;
|
||||
|
||||
if (srcX[i] + width > srcWidth)
|
||||
width = srcWidth - srcX[i];
|
||||
if (srcY[i] + rows > srcHeight)
|
||||
rows = srcHeight - srcY[i];
|
||||
|
||||
// clip to the destination, so a short buffer truncates rather than overruns
|
||||
if (d->atlasY >= dstHeight)
|
||||
continue;
|
||||
if (d->atlasY + rows > dstHeight)
|
||||
rows = dstHeight - d->atlasY;
|
||||
|
||||
const size_t bytes = (size_t)width * bytesPerPixel;
|
||||
for(unsigned y = 0; y < rows; ++y)
|
||||
memcpy(
|
||||
dst + (size_t)(d->atlasY + y) * dstPitch +
|
||||
(size_t)d->atlasX * bytesPerPixel,
|
||||
src + (size_t)(srcY[i] + y) * srcPitch +
|
||||
(size_t)srcX[i] * bytesPerPixel,
|
||||
bytes);
|
||||
}
|
||||
}
|
||||
|
||||
int lgDisplaysFindAtPoint(const KVMFRDisplay * displays, unsigned count,
|
||||
int32_t x, int32_t y)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user