summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
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 {