summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dd43e09)
raw | patch | inline | side by side (parent: dd43e09)
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Wed, 7 Oct 2015 07:30:23 +0000 (10:30 +0300) | ||
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Wed, 7 Oct 2015 07:30:23 +0000 (10:30 +0300) |
libkmstest/color.cpp | patch | blob | history | |
libkmstest/color.h | patch | blob | history | |
libkmstest/colorbar.cpp | patch | blob | history | |
libkmstest/testpat.cpp | patch | blob | history |
diff --git a/libkmstest/color.cpp b/libkmstest/color.cpp
index b5b90019646b6b244bf5b70e1c5495cae8acecc0..4d4a7414a37f8f06967b5755a5566d9487856832 100644 (file)
--- a/libkmstest/color.cpp
+++ b/libkmstest/color.cpp
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
diff --git a/libkmstest/color.h b/libkmstest/color.h
index 1db47e8a930be9ddb7d72ea25a33cd4a7ff2fc5d..f84fc689d6c0d28406b6acfac2d55a87977648bb 100644 (file)
--- a/libkmstest/color.h
+++ b/libkmstest/color.h
RGB();
RGB(uint8_t r, uint8_t g, uint8_t b);
+ uint32_t rgb888() const;
+ uint32_t bgr888() const;
uint16_t rgb565() const;
YUV yuv() const;
- union {
- struct
- {
- uint8_t b;
- uint8_t g;
- uint8_t r;
- uint8_t a;
- };
-
- uint32_t raw;
+ struct
+ {
+ uint8_t b;
+ uint8_t g;
+ uint8_t r;
+ uint8_t a;
};
};
YUV(uint8_t y, uint8_t u, uint8_t v);
YUV(const RGB& rgb);
- union {
- struct
- {
- uint8_t v;
- uint8_t u;
- uint8_t y;
- uint8_t a;
- };
-
- uint32_t raw;
+ struct
+ {
+ uint8_t v;
+ uint8_t u;
+ uint8_t y;
+ uint8_t a;
};
};
}
index 31a4510fc3fa63401393d00139bf2bcdb4682c53..c1b6c16588d2656100eec0f0db69d9b7b0da1e6c 100644 (file)
--- a/libkmstest/colorbar.cpp
+++ b/libkmstest/colorbar.cpp
}
for (int x = xpos; x < xpos + width; ++x)
- line[x] = bcol.raw;
+ line[x] = bcol.rgb888();
}
}
diff --git a/libkmstest/testpat.cpp b/libkmstest/testpat.cpp
index c8188d8a00b2e56d00834d49c24c3be3b5f4ba0b..f621b911da772f96c456dcd5e43d4c6da6b78452 100644 (file)
--- a/libkmstest/testpat.cpp
+++ b/libkmstest/testpat.cpp
case PixelFormat::XRGB8888:
{
uint32_t *p = (uint32_t*)(buf.map(0) + buf.stride(0) * y + x * 4);
- *p = color.raw;
+ *p = color.rgb888();
+ break;
+ }
+ case PixelFormat::XBGR8888:
+ {
+ uint32_t *p = (uint32_t*)(buf.map(0) + buf.stride(0) * y + x * 4);
+ *p = color.bgr888();
break;
}
case PixelFormat::RGB565: