From e8974548e30a28738b46c681a7e50c27aab27db6 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 23 Apr 2009 11:11:02 +0200 Subject: Add BGR format to qvfb --- tools/qvfb/config.ui | 10 ++++++++++ tools/qvfb/qvfbview.cpp | 5 ++++- tools/qvfb/qvfbview.h | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/qvfb/config.ui b/tools/qvfb/config.ui index ac91d3e..82a3d38 100644 --- a/tools/qvfb/config.ui +++ b/tools/qvfb/config.ui @@ -272,6 +272,16 @@ + + + + Swap red and blue channels + + + BGR format + + + diff --git a/tools/qvfb/qvfbview.cpp b/tools/qvfb/qvfbview.cpp index c2df8fd..e7c99ed 100644 --- a/tools/qvfb/qvfbview.cpp +++ b/tools/qvfb/qvfbview.cpp @@ -89,7 +89,7 @@ QVFbAbstractView::~QVFbAbstractView() QVFbView::QVFbView(int id, int w, int h, int d, Rotation r, QWidget *parent) : QVFbAbstractView(parent), - viewdepth(d), viewFormat(DefaultFormat), rsh(0), gsh(0), bsh(0), rmax(15), gmax(15), bmax(15), + viewdepth(d), viewFormat(DefaultFormat), rgb_swapped(0), rsh(0), gsh(0), bsh(0), rmax(15), gmax(15), bmax(15), contentsWidth(w), contentsHeight(h), gred(1.0), ggreen(1.0), gblue(1.0), gammatable(0), refreshRate(30), animation(0), hzm(0.0), vzm(0.0), mView(0), @@ -601,6 +601,9 @@ QImage QVFbView::getBuffer(const QRect &r, int &leading) const break; } + if (rgb_swapped) + img = img.rgbSwapped(); + if ( brightness != 255 ) { if (img.format() == QImage::Format_Indexed8) { QVector c = img.colorTable(); diff --git a/tools/qvfb/qvfbview.h b/tools/qvfb/qvfbview.h index d533613..1d43bdc 100644 --- a/tools/qvfb/qvfbview.h +++ b/tools/qvfb/qvfbview.h @@ -77,6 +77,7 @@ public: virtual int displayHeight() const = 0; virtual int displayDepth() const = 0; virtual PixelFormat displayFormat() const { return DefaultFormat; } + virtual bool rgbSwapped() const { return false; } virtual Rotation displayRotation() const = 0; virtual void setGamma(double gr, double gg, double gb) = 0; @@ -105,6 +106,7 @@ public slots: virtual void skinKeyPressEvent( int code, const QString& text, bool autorep=FALSE ) = 0; virtual void skinKeyReleaseEvent( int code, const QString& text, bool autorep=FALSE ) = 0; virtual void setViewFormat(PixelFormat) {} + virtual void setRgbSwapped( bool ) {}; virtual void embedDisplay(WId) {} }; @@ -120,6 +122,7 @@ public: int displayHeight() const; int displayDepth() const; PixelFormat displayFormat() const; + bool rgbSwapped() const { return rgb_swapped; } Rotation displayRotation() const; bool touchScreenEmulation() const { return emulateTouchscreen; } @@ -151,6 +154,7 @@ public slots: void skinKeyPressEvent(int code, const QString& text, bool autorep=FALSE); void skinKeyReleaseEvent(int code, const QString& text, bool autorep=FALSE); void setViewFormat(PixelFormat); + void setRgbSwapped(bool b) { rgb_swapped = b; } #ifdef Q_WS_X11 void embedDisplay(WId id); #endif @@ -180,6 +184,7 @@ private: void setDirty(const QRect&); int viewdepth; // "faked" depth PixelFormat viewFormat; + bool rgb_swapped; int rsh; int gsh; int bsh; -- cgit v0.12