author | mouse <mouse> | 2004-03-31 14:54:16 (UTC) |
---|---|---|
committer | mouse <mouse> | 2004-03-31 14:54:16 (UTC) |
commit | 0a56adea03683be6066622bbbbae1f0b8c73db12 (patch) (unidiff) | |
tree | 9b2ff9aabd303397edd12cd2589d7fb25315308c | |
parent | 4f6dbea16af4c6edb7cdc619be4cacf672f8aee8 (diff) | |
download | opie-0a56adea03683be6066622bbbbae1f0b8c73db12.zip opie-0a56adea03683be6066622bbbbae1f0b8c73db12.tar.gz opie-0a56adea03683be6066622bbbbae1f0b8c73db12.tar.bz2 |
dirty bugfix (segfault with scaleFactor > 1), see inside for more info
-rw-r--r-- | noncore/comm/keypebble/krfbbuffer.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/comm/keypebble/krfbbuffer.cpp b/noncore/comm/keypebble/krfbbuffer.cpp index 92918d4..4cec0c2 100644 --- a/noncore/comm/keypebble/krfbbuffer.cpp +++ b/noncore/comm/keypebble/krfbbuffer.cpp | |||
@@ -176,25 +176,27 @@ void KRFBBuffer::drawRawRectChunk( void *data, | |||
176 | 176 | ||
177 | r = ( r * 255 ) / redMax; | 177 | r = ( r * 255 ) / redMax; |
178 | g = ( g * 255 ) / greenMax; | 178 | g = ( g * 255 ) / greenMax; |
179 | b = ( b * 255 ) / blueMax; | 179 | b = ( b * 255 ) / blueMax; |
180 | 180 | ||
181 | ulong *p = ( ulong * ) img.scanLine( j ) + i; | 181 | ulong *p = ( ulong * ) img.scanLine( j ) + i; |
182 | *p = qRgb( r,g,b ); | 182 | *p = qRgb( r,g,b ); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | } | 185 | } |
186 | else { | 186 | else { |
187 | p.setBrush( QBrush( Qt::black ) ); | 187 | p.setBrush( QBrush( Qt::black ) ); |
188 | p.drawRect( x, y, w, h ); | 188 | p.drawRect( x, y, w, h ); |
189 | } | 189 | } |
190 | 190 | ||
191 | if (scaleFactor > 1) { | 191 | if (scaleFactor > 1) { |
192 | p.drawImage( x/scaleFactor, y/scaleFactor, img.smoothScale(w/scaleFactor,h/scaleFactor) ); | 192 | /* FIXME: proper zero width/height handling */ |
193 | if (w/scaleFactor != 0) | ||
194 | p.drawImage( x/scaleFactor, y/scaleFactor, img.smoothScale(w/scaleFactor,h/scaleFactor) ); | ||
193 | emit updated( x/scaleFactor, y/scaleFactor, w/scaleFactor, h/scaleFactor ); | 195 | emit updated( x/scaleFactor, y/scaleFactor, w/scaleFactor, h/scaleFactor ); |
194 | } | 196 | } |
195 | else { | 197 | else { |
196 | p.drawImage( x, y, img); | 198 | p.drawImage( x, y, img); |
197 | emit updated( x, y, w, h ); | 199 | emit updated( x, y, w, h ); |
198 | } | 200 | } |
199 | } | 201 | } |
200 | 202 | ||