From 235afbde971e6f5deea6b7a78d64b75614e18cab Mon Sep 17 00:00:00 2001
From: Jyri Sarha <jsarha@ti.com>
Date: Mon, 15 Aug 2016 16:12:49 +0300
Subject: Add missing BGR color formats to draw_test_pattern_part().

---
 kms++util/src/testpat.cpp | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'kms++util')

diff --git a/kms++util/src/testpat.cpp b/kms++util/src/testpat.cpp
index 1297e61..519f960 100644
--- a/kms++util/src/testpat.cpp
+++ b/kms++util/src/testpat.cpp
@@ -105,7 +105,9 @@ static void draw_test_pattern_part(IMappedFramebuffer& fb, unsigned start_y, uns
 	case PixelFormat::ARGB8888:
 	case PixelFormat::ABGR8888:
 	case PixelFormat::RGB888:
+	case PixelFormat::BGR888:
 	case PixelFormat::RGB565:
+	case PixelFormat::BGR565:
 		for (y = start_y; y < end_y; y++) {
 			for (x = 0; x < w; x++) {
 				RGB pixel = get_test_pattern_pixel(fb, x, y);
-- 
cgit v1.2.3


From 13883ffaa3e04c4ab465581127411feb4dce1b89 Mon Sep 17 00:00:00 2001
From: Jyri Sarha <jsarha@ti.com>
Date: Mon, 15 Aug 2016 16:17:49 +0300
Subject: Fix byte order of 24-bit formats.

---
 kms++util/src/drawing.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'kms++util')

diff --git a/kms++util/src/drawing.cpp b/kms++util/src/drawing.cpp
index 44634e1..f8cc03f 100644
--- a/kms++util/src/drawing.cpp
+++ b/kms++util/src/drawing.cpp
@@ -26,17 +26,17 @@ void draw_rgb_pixel(IMappedFramebuffer& buf, unsigned x, unsigned y, RGB color)
 	case PixelFormat::RGB888:
 	{
 		uint8_t *p = buf.map(0) + buf.stride(0) * y + x * 3;
-		p[0] = color.r;
+		p[0] = color.b;
 		p[1] = color.g;
-		p[2] = color.b;
+		p[2] = color.r;
 		break;
 	}
 	case PixelFormat::BGR888:
 	{
 		uint8_t *p = buf.map(0) + buf.stride(0) * y + x * 3;
-		p[0] = color.b;
+		p[0] = color.r;
 		p[1] = color.g;
-		p[2] = color.r;
+		p[2] = color.b;
 		break;
 	}
 	case PixelFormat::RGB565:
-- 
cgit v1.2.3