From c811a9c44cc9685211494f2daa62c9272c96eb90 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 7 Oct 2015 10:30:23 +0300 Subject: libkmstest: cleanup colors and add xbgr8888 support --- libkmstest/color.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'libkmstest/color.cpp') diff --git a/libkmstest/color.cpp b/libkmstest/color.cpp index b5b9001..4d4a741 100644 --- a/libkmstest/color.cpp +++ b/libkmstest/color.cpp @@ -15,12 +15,19 @@ RGB::RGB(uint8_t r, uint8_t g, uint8_t b) this->a = 0; } +uint32_t RGB::rgb888() const +{ + return (r << 16) | (g << 8) | (b << 0); +} + +uint32_t RGB::bgr888() const +{ + return (b << 16) | (g << 8) | (r << 0); +} + uint16_t RGB::rgb565() const { - uint16_t r = (this->r >> 3) << 11; - uint16_t g = (this->g >> 2) << 5; - uint16_t b = (this->b >> 3) << 0; - return r | g | b; + return ((r >> 3) << 11) | ((g >> 2) << 5) | ((b >> 3) << 0); } YUV RGB::yuv() const -- cgit v1.2.3