Diffstat (limited to 'noncore/multimedia/camera/zcameraio.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/camera/zcameraio.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/noncore/multimedia/camera/zcameraio.cpp b/noncore/multimedia/camera/zcameraio.cpp index 56b2e13..51771a5 100644 --- a/noncore/multimedia/camera/zcameraio.cpp +++ b/noncore/multimedia/camera/zcameraio.cpp | |||
@@ -105,12 +105,13 @@ inline bool ZCameraIO::isAvailable() const | |||
105 | return _status[3] == 'A'; | 105 | return _status[3] == 'A'; |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | bool ZCameraIO::setCaptureFrame( int width, int height, int zoom, bool rot ) | 109 | bool ZCameraIO::setCaptureFrame( int width, int height, int zoom, bool rot ) |
110 | { | 110 | { |
111 | odebug << "setCaptureFrame( " << width << ", " << height << ", " << zoom << ", " << rot << " )" << oendl; | ||
111 | char b[100]; | 112 | char b[100]; |
112 | sprintf( b, "%c=%d,%d,%d,%d", rot ? 'R':'S', width, height, zoom, width*2 ); | 113 | sprintf( b, "%c=%d,%d,%d,%d", rot ? 'R':'S', width, height, zoom, width*2 ); |
113 | if ( write( b ) ) | 114 | if ( write( b ) ) |
114 | { | 115 | { |
115 | _width = width; | 116 | _width = width; |
116 | _height = height; | 117 | _height = height; |
@@ -170,24 +171,37 @@ bool ZCameraIO::write( char* buf, int len ) | |||
170 | return ::write( _driver, buf, len ) == len; | 171 | return ::write( _driver, buf, len ) == len; |
171 | } | 172 | } |
172 | 173 | ||
173 | 174 | ||
174 | bool ZCameraIO::snapshot( QImage* image ) | 175 | bool ZCameraIO::snapshot( QImage* image ) |
175 | { | 176 | { |
176 | setReadMode( IMAGE | XFLIP | YFLIP ); | 177 | setReadMode( STATUS ); |
177 | char buf[76800]; | 178 | |
179 | odebug << "finder reversed = " << isFinderReversed() << oendl; | ||
180 | odebug << "rotation = " << _rot << oendl; | ||
181 | |||
182 | if ( _rot ) // Portrait | ||
183 | { | ||
184 | setReadMode( IMAGE | isFinderReversed() ? XFLIP | YFLIP : 0 ); | ||
185 | } | ||
186 | else // Landscape | ||
187 | { | ||
188 | setReadMode( IMAGE | XFLIP | YFLIP ); //isFinderReversed() ? 0 : XFLIP ); | ||
189 | } | ||
190 | |||
191 | char buf[_readlen]; | ||
178 | char* bp = buf; | 192 | char* bp = buf; |
179 | unsigned char* p; | 193 | unsigned char* p; |
180 | 194 | ||
181 | read( bp, _readlen ); | 195 | read( bp, _readlen ); |
182 | 196 | ||
183 | image->create( 240, 160, 16 ); | 197 | image->create( _width, _height, 16 ); |
184 | for ( int i = 0; i < 160; ++i ) | 198 | for ( int i = 0; i < _height; ++i ) |
185 | { | 199 | { |
186 | p = image->scanLine( i ); | 200 | p = image->scanLine( i ); |
187 | for ( int j = 0; j < 240; j++ ) | 201 | for ( int j = 0; j < _width; j++ ) |
188 | { | 202 | { |
189 | *p = *bp; | 203 | *p = *bp; |
190 | p++; | 204 | p++; |
191 | bp++; | 205 | bp++; |
192 | *p = *bp; | 206 | *p = *bp; |
193 | p++; | 207 | p++; |