diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2015-10-07 10:30:23 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2015-10-07 10:30:23 +0300 |
commit | c811a9c44cc9685211494f2daa62c9272c96eb90 (patch) | |
tree | 6fb3dee09422f2979cb4d48cb91f0ac77a719dd2 /libkmstest/color.cpp | |
parent | dd43e09dd207430e3fc8d3b3749f21b1aa7d304e (diff) |
libkmstest: cleanup colors and add xbgr8888 support
Diffstat (limited to 'libkmstest/color.cpp')
-rw-r--r-- | libkmstest/color.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
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 |