Diffstat (limited to 'noncore/multimedia/camera/zcameraio.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/camera/zcameraio.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/noncore/multimedia/camera/zcameraio.cpp b/noncore/multimedia/camera/zcameraio.cpp index 1c449e7..c940b45 100644 --- a/noncore/multimedia/camera/zcameraio.cpp +++ b/noncore/multimedia/camera/zcameraio.cpp @@ -200,119 +200,112 @@ bool ZCameraIO::read( char* b, int len ) bool ZCameraIO::write( char* buf, int len ) { if ( !len ) len = strlen( buf ); odebug << "writing '" << buf << "' to driver." << oendl; return ::write( _driver, buf, len ) == len; } bool ZCameraIO::snapshot( QImage* image ) { setReadMode( STATUS ); odebug << "finder reversed = " << isFinderReversed() << oendl; odebug << "rotation = " << _rot << oendl; int readmode; if ( _flip == -1 ) // AUTO { if ( _rot ) // Portrait { readmode = IMAGE | isFinderReversed() ? XFLIP | YFLIP : 0; } else // Landscape { readmode = IMAGE | XFLIP | YFLIP; } } else // OVERRIDE { readmode = IMAGE | _flip; } setReadMode( readmode ); char buf[_readlen]; char* bp = buf; unsigned char* p; read( bp, _readlen ); image->create( _width, _height, 16 ); for ( int i = 0; i < _height; ++i ) { p = image->scanLine( i ); for ( int j = 0; j < _width; j++ ) { *p = *bp; p++; bp++; *p = *bp; p++; bp++; } } return true; } bool ZCameraIO::snapshot( unsigned char* buf ) { setReadMode( STATUS ); odebug << "finder reversed = " << isFinderReversed() << oendl; odebug << "rotation = " << _rot << oendl; int readmode; if ( _flip == -1 ) // AUTO { if ( _rot ) // Portrait { readmode = IMAGE | isFinderReversed() ? XFLIP | YFLIP : 0; } else // Landscape { readmode = IMAGE | XFLIP | YFLIP; } } else // OVERRIDE { readmode = IMAGE | _flip; } setReadMode( readmode ); read( (char*) buf, _readlen ); } void ZCameraIO::captureFrame( int w, int h, int zoom, QImage* image ) { int pw = _width; int ph = _height; - if ( _rot ) - setCaptureFrame( h, w, zoom*256, true ); - else - setCaptureFrame( w, h, zoom*256, false ); + setCaptureFrame( w, h, zoom*256, _rot ); snapshot( image ); setCaptureFrame( pw, ph, _zoom, _rot ); } void ZCameraIO::captureFrame( int w, int h, int zoom, unsigned char* buf ) { //FIXME: this is too slow int pw = _width; int ph = _height; - if ( _rot ) - setCaptureFrame( h, w, zoom*256, true ); - else - setCaptureFrame( w, h, zoom*256, false ); - + setCaptureFrame( w, h, zoom*256, _rot ); snapshot( buf ); setCaptureFrame( pw, ph, _zoom, _rot ); } |