diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-04-23 09:11:02 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2009-04-23 09:12:57 (GMT) |
commit | e8974548e30a28738b46c681a7e50c27aab27db6 (patch) | |
tree | e20491714e3d437638b1c62e958e61dd32b5488d /tools/qvfb | |
parent | 74934cba48910e366d96e4e596e8676d8434fe24 (diff) | |
download | Qt-e8974548e30a28738b46c681a7e50c27aab27db6.zip Qt-e8974548e30a28738b46c681a7e50c27aab27db6.tar.gz Qt-e8974548e30a28738b46c681a7e50c27aab27db6.tar.bz2 |
Add BGR format to qvfb
Diffstat (limited to 'tools/qvfb')
-rw-r--r-- | tools/qvfb/config.ui | 10 | ||||
-rw-r--r-- | tools/qvfb/qvfbview.cpp | 5 | ||||
-rw-r--r-- | tools/qvfb/qvfbview.h | 5 |
3 files changed, 19 insertions, 1 deletions
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 @@ </property> </widget> </item> + <item> + <widget class="QCheckBox" name="rgbSwapped"> + <property name="toolTip"> + <string>Swap red and blue channels</string> + </property> + <property name="text"> + <string>BGR format</string> + </property> + </widget> + </item> </layout> </widget> </item> 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<QRgb> 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; |