summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-02-05 09:10:58 +0200
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-02-11 18:24:30 +0200
commit12f41a33eab719183c758b3044a308107186427d (patch)
tree624c8b07e97615f174e3ccdccee9e4ddd30f85c0 /kms++
parent6048b54c35905abbedf8b2f606795ff99444237c (diff)
pixelformats: cleanup
Diffstat (limited to 'kms++')
-rw-r--r--kms++/inc/kms++/pixelformats.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/kms++/inc/kms++/pixelformats.h b/kms++/inc/kms++/pixelformats.h
index e334ee6..1b56495 100644
--- a/kms++/inc/kms++/pixelformats.h
+++ b/kms++/inc/kms++/pixelformats.h
@@ -77,12 +77,14 @@ inline PixelFormat FourCCToPixelFormat(const std::string& fourcc)
inline std::string PixelFormatToFourCC(PixelFormat f)
{
- char buf[5] = { (char)(((uint32_t)f >> 0) & 0xff),
- (char)(((uint32_t)f >> 8) & 0xff),
- (char)(((uint32_t)f >> 16) & 0xff),
- (char)(((uint32_t)f >> 24) & 0xff),
- 0 };
- return std::string(buf);
+ uint32_t v = (uint32_t)f;
+
+ char buf[4] = { (char)((v >> 0) & 0xff),
+ (char)((v >> 8) & 0xff),
+ (char)((v >> 16) & 0xff),
+ (char)((v >> 24) & 0xff),
+ };
+ return std::string(buf, 4);
}
enum class PixelColorType {