summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2015-10-30 00:38:06 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2015-10-31 08:55:04 +0200
commit887fb3bf2bf6496687fcb53f95092690dae90855 (patch)
treedef40da99d482f026da1bfb74b7810def611fe4f
parent41b420c97c5f80903798fb1a5d854c3b6db0ae2b (diff)
Add AR24 & AB24 formats
-rw-r--r--libkms++/dumbframebuffer.cpp2
-rw-r--r--libkms++/pixelformats.h3
-rw-r--r--libkmstest/color.cpp9
-rw-r--r--libkmstest/testpat.cpp4
4 files changed, 14 insertions, 4 deletions
diff --git a/libkms++/dumbframebuffer.cpp b/libkms++/dumbframebuffer.cpp
index c64010a..fa5562c 100644
--- a/libkms++/dumbframebuffer.cpp
+++ b/libkms++/dumbframebuffer.cpp
@@ -65,6 +65,8 @@ static const map<PixelFormat, FormatInfo> format_info_array = {
/* RGB32 */
{ PixelFormat::XRGB8888, { 1, { { 32, 1, 1 } }, } },
{ PixelFormat::XBGR8888, { 1, { { 32, 1, 1 } }, } },
+ { PixelFormat::ARGB8888, { 1, { { 32, 1, 1 } }, } },
+ { PixelFormat::ABGR8888, { 1, { { 32, 1, 1 } }, } },
};
void DumbFramebuffer::Create()
diff --git a/libkms++/pixelformats.h b/libkms++/pixelformats.h
index 75e325c..693dcee 100644
--- a/libkms++/pixelformats.h
+++ b/libkms++/pixelformats.h
@@ -19,6 +19,9 @@ enum class PixelFormat : uint32_t
XRGB8888 = MakeFourCC("XR24"),
XBGR8888 = MakeFourCC("XB24"),
+ ARGB8888 = MakeFourCC("AR24"),
+ ABGR8888 = MakeFourCC("AB24"),
+
RGB565 = MakeFourCC("RG16"),
};
diff --git a/libkmstest/color.cpp b/libkmstest/color.cpp
index 4d4a741..78012ac 100644
--- a/libkmstest/color.cpp
+++ b/libkmstest/color.cpp
@@ -4,7 +4,8 @@ namespace kms
{
RGB::RGB()
{
- r = g = b = a = 0;
+ r = g = b = 0;
+ a = 255;
}
RGB::RGB(uint8_t r, uint8_t g, uint8_t b)
@@ -12,17 +13,17 @@ RGB::RGB(uint8_t r, uint8_t g, uint8_t b)
this->r = r;
this->g = g;
this->b = b;
- this->a = 0;
+ this->a = 255;
}
uint32_t RGB::rgb888() const
{
- return (r << 16) | (g << 8) | (b << 0);
+ return (a << 24) | (r << 16) | (g << 8) | (b << 0);
}
uint32_t RGB::bgr888() const
{
- return (b << 16) | (g << 8) | (r << 0);
+ return (a << 24) | (b << 16) | (g << 8) | (r << 0);
}
uint16_t RGB::rgb565() const
diff --git a/libkmstest/testpat.cpp b/libkmstest/testpat.cpp
index 1618855..b054cf6 100644
--- a/libkmstest/testpat.cpp
+++ b/libkmstest/testpat.cpp
@@ -20,12 +20,14 @@ static void draw_rgb_pixel(DumbFramebuffer& buf, unsigned x, unsigned y, RGB col
{
switch (buf.format()) {
case PixelFormat::XRGB8888:
+ case PixelFormat::ARGB8888:
{
uint32_t *p = (uint32_t*)(buf.map(0) + buf.stride(0) * y + x * 4);
*p = color.rgb888();
break;
}
case PixelFormat::XBGR8888:
+ case PixelFormat::ABGR8888:
{
uint32_t *p = (uint32_t*)(buf.map(0) + buf.stride(0) * y + x * 4);
*p = color.bgr888();
@@ -219,6 +221,8 @@ static void draw_test_pattern_impl(DumbFramebuffer& fb)
switch (fb.format()) {
case PixelFormat::XRGB8888:
case PixelFormat::XBGR8888:
+ case PixelFormat::ARGB8888:
+ case PixelFormat::ABGR8888:
case PixelFormat::RGB565:
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {