diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
commit | bf7f88413be3831a9372d323d02fc0335b9f9188 (patch) | |
tree | 516fdef9206245b40a14f99b4e3d9ef9289196e0 /src/gvcore/xcursor.cpp | |
parent | e238aa77b1fb3c2f55aef2ef2c91ce52166d2cc8 (diff) | |
download | gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.tar.gz gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.zip |
TQt4 port Gwenview
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1233720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gvcore/xcursor.cpp')
-rw-r--r-- | src/gvcore/xcursor.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/gvcore/xcursor.cpp b/src/gvcore/xcursor.cpp index 79df377..d3c3acc 100644 --- a/src/gvcore/xcursor.cpp +++ b/src/gvcore/xcursor.cpp @@ -24,9 +24,9 @@ #include "xcursor.h" -#include <qimage.h> +#include <tqimage.h> #include <kdebug.h> -#include <qvaluevector.h> +#include <tqvaluevector.h> #ifdef GV_HAVE_XCURSOR #include <X11/Xlib.h> @@ -37,12 +37,12 @@ namespace Gwenview { #ifdef GV_HAVE_XCURSOR -class XCursorFormat : public QImageFormat { +class XCursorFormat : public TQImageFormat { public: XCursorFormat(); - virtual int decode(QImage& img, QImageConsumer* consumer, + virtual int decode(TQImage& img, TQImageConsumer* consumer, const uchar* buffer, int length); - QByteArray array; + TQByteArray array; int pos; bool was_seek_error; }; @@ -89,7 +89,7 @@ XCursorFormat::XCursorFormat() { } -int XCursorFormat::decode(QImage& img, QImageConsumer* cons, +int XCursorFormat::decode(TQImage& img, TQImageConsumer* cons, const uchar* buffer, int length) { if( length > 0 ) @@ -98,11 +98,11 @@ int XCursorFormat::decode(QImage& img, QImageConsumer* cons, array.resize( old_size + length ); memcpy( array.data() + old_size, buffer, length ); } -// Qt's image async IO and Xcursor library have so nicely incompatible data reading :-/ +// TQt's image async IO and Xcursor library have so nicely incompatible data reading :-/ // Xcursor can read a file only as a whole. One can provide XcursorFile with functions // for reading, writing and seeking. And seeking is the stupid part on Xcursor's side, // as there's no way to suspend reading until more data is available. This means we -// basically have to read the whole file first. However, Qt's image async IO just keeps +// basically have to read the whole file first. However, TQt's image async IO just keeps // feeding data and when there's end of the data it just does nothing and doesn't tell // the decoder. // So the trick will be calling XcursorXcFileLoadImage() but whenever there will be @@ -124,19 +124,19 @@ int XCursorFormat::decode(QImage& img, QImageConsumer* cons, ++cur ) { XcursorImage* cursor = cursors->images[ cur ]; - img = QImage( reinterpret_cast<uchar *>( cursor->pixels ), - cursor->width, cursor->height, 32, NULL, 0, QImage::BigEndian ); + img = TQImage( reinterpret_cast<uchar *>( cursor->pixels ), + cursor->width, cursor->height, 32, NULL, 0, TQImage::BigEndian ); img.setAlphaBuffer( true ); // Convert the image to non-premultiplied alpha - Q_UINT32 *pixels = reinterpret_cast<Q_UINT32 *>( img.bits() ); + TQ_UINT32 *pixels = reinterpret_cast<TQ_UINT32 *>( img.bits() ); for ( int i = 0; i < (img.width() * img.height()); i++ ) { - float alpha = qAlpha( pixels[i] ) / 255.0; + float alpha = tqAlpha( pixels[i] ) / 255.0; if ( alpha > 0.0 && alpha < 1.0 ) - pixels[i] = qRgba( int( qRed(pixels[i]) / alpha ), - int( qGreen(pixels[i]) / alpha ), - int( qBlue(pixels[i]) / alpha ), - qAlpha(pixels[i]) ); + pixels[i] = tqRgba( int( tqRed(pixels[i]) / alpha ), + int( tqGreen(pixels[i]) / alpha ), + int( tqBlue(pixels[i]) / alpha ), + tqAlpha(pixels[i]) ); } // Create a deep copy of the image so the image data is preserved img = img.copy(); @@ -148,7 +148,7 @@ int XCursorFormat::decode(QImage& img, QImageConsumer* cons, if( cursors->nimage > 1 ) cons->setLooping( 0 ); } - cons->changed( QRect( QPoint( 0, 0 ), img.size())); + cons->changed( TQRect( TQPoint( 0, 0 ), img.size())); cons->frameDone(); cons->setFramePeriod( cursor->delay ); } @@ -164,7 +164,7 @@ int XCursorFormat::decode(QImage& img, QImageConsumer* cons, } #endif -QImageFormat* XCursorFormatType::decoderFor( +TQImageFormat* XCursorFormatType::decoderFor( const uchar* buffer, int length) { #ifdef GV_HAVE_XCURSOR |