summaryrefslogtreecommitdiffstats
path: root/common/rfb/PixelFormat.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2009-03-31 14:06:53 +0000
committerPierre Ossman <ossman@cendio.se>2009-03-31 14:06:53 +0000
commit19501b8e23ec152bf883ef52bccfa978df4a245b (patch)
treeafe9de9dce72d80b23d59617ddac9879e6206b38 /common/rfb/PixelFormat.cxx
parenteed5d1f7f11628f8656320adae8f3c38b45ee74f (diff)
downloadtigervnc-19501b8e23ec152bf883ef52bccfa978df4a245b.tar.gz
tigervnc-19501b8e23ec152bf883ef52bccfa978df4a245b.zip
Optimise the common pixel format conversion RGB24 to RGB32.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3730 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/rfb/PixelFormat.cxx')
-rw-r--r--common/rfb/PixelFormat.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/common/rfb/PixelFormat.cxx b/common/rfb/PixelFormat.cxx
index e8cb1a21..b00bc823 100644
--- a/common/rfb/PixelFormat.cxx
+++ b/common/rfb/PixelFormat.cxx
@@ -180,6 +180,44 @@ Pixel PixelFormat::pixelFromRGB(rdr::U8 red, rdr::U8 green, rdr::U8 blue,
}
+void PixelFormat::bufferFromRGB(rdr::U8 *dst, const rdr::U8* src,
+ int pixels, ColourMap* cm) const
+{
+ if (is888()) {
+ // Optimised common case
+ rdr::U8 *r, *g, *b;
+
+ r = dst + redShift/8;
+ g = dst + greenShift/8;
+ b = dst + blueShift/8;
+
+ while (pixels--) {
+ *r = *(src++);
+ *g = *(src++);
+ *b = *(src++);
+ r += 4;
+ g += 4;
+ b += 4;
+ }
+ } else {
+ // Generic code
+ Pixel p;
+ rdr::U8 r, g, b;
+
+ while (pixels--) {
+ r = *(src++);
+ g = *(src++);
+ b = *(src++);
+
+ p = pixelFromRGB(r, g, b, cm);
+
+ bufferFromPixel(dst, p);
+ dst += bpp/8;
+ }
+ }
+}
+
+
void PixelFormat::rgbFromPixel(Pixel p, ColourMap* cm, Colour* rgb) const
{
rdr::U16 r, g, b;