From a9e7ecab862183399c5947931f2bad69ecec393d Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 5 Feb 2025 11:28:23 +0200 Subject: PixelFormats: New PixelFormatInfo code New pixel format code, from Python pixutils library. Signed-off-by: Tomi Valkeinen --- kms++util/src/cpuframebuffer.cpp | 5 ++--- kms++util/src/testpat.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'kms++util/src') diff --git a/kms++util/src/cpuframebuffer.cpp b/kms++util/src/cpuframebuffer.cpp index c3bc248..8eac8c4 100644 --- a/kms++util/src/cpuframebuffer.cpp +++ b/kms++util/src/cpuframebuffer.cpp @@ -14,11 +14,10 @@ CPUFramebuffer::CPUFramebuffer(uint32_t width, uint32_t height, PixelFormat form m_num_planes = format_info.num_planes; for (unsigned i = 0; i < format_info.num_planes; ++i) { - const PixelFormatPlaneInfo& pi = format_info.planes[i]; FramebufferPlane& plane = m_planes[i]; - plane.stride = width * pi.bitspp / 8; - plane.size = plane.stride * height / pi.ysub; + plane.stride = format_info.stride(width, i); + plane.size = format_info.planesize(plane.stride, height, i); plane.offset = 0; plane.map = new uint8_t[plane.size]; } diff --git a/kms++util/src/testpat.cpp b/kms++util/src/testpat.cpp index 7699243..029684a 100644 --- a/kms++util/src/testpat.cpp +++ b/kms++util/src/testpat.cpp @@ -118,7 +118,7 @@ static void draw_test_pattern_part(IFramebuffer& fb, unsigned start_y, unsigned break; case PixelColorType::YUV: - switch (plane_info.xsub + plane_info.ysub) { + switch (plane_info.hsub + plane_info.vsub) { case 2: for (y = start_y; y < end_y; y++) { for (x = 0; x < w; x++) { -- cgit v1.2.3