-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 | |||
@@ -144,57 +144,59 @@ void KRFBBuffer::drawRawRectChunk( void *data, | |||
144 | b = b & blueMax; | 144 | b = b & blueMax; |
145 | 145 | ||
146 | r = ( r * 255 ) / redMax; | 146 | r = ( r * 255 ) / redMax; |
147 | g = ( g * 255 ) / greenMax; | 147 | g = ( g * 255 ) / greenMax; |
148 | b = ( b * 255 ) / blueMax; | 148 | b = ( b * 255 ) / blueMax; |
149 | 149 | ||
150 | uint *p = ( uint * ) img.scanLine( j ) + i; | 150 | uint *p = ( uint * ) img.scanLine( j ) + i; |
151 | *p = qRgb( r,g,b ); | 151 | *p = qRgb( r,g,b ); |
152 | } | 152 | } |
153 | } | 153 | } |
154 | } else if (decoder->format->bpp == 16 ) { | 154 | } else if (decoder->format->bpp == 16 ) { |
155 | 155 | ||
156 | CARD16 *d = (CARD16 *) data; | 156 | CARD16 *d = (CARD16 *) data; |
157 | 157 | ||
158 | uint r,g,b; | 158 | uint r,g,b; |
159 | 159 | ||
160 | for ( int j = 0; j < h; j++ ) { | 160 | for ( int j = 0; j < h; j++ ) { |
161 | for ( int i = 0; i < w ; i++ ) { | 161 | for ( int i = 0; i < w ; i++ ) { |
162 | CARD16 pixel = d[ j * w + i ]; | 162 | CARD16 pixel = d[ j * w + i ]; |
163 | pixel = Swap16IfLE( pixel ); | 163 | pixel = Swap16IfLE( pixel ); |
164 | 164 | ||
165 | r = pixel; | 165 | r = pixel; |
166 | r = r >> decoder->format->redShift; | 166 | r = r >> decoder->format->redShift; |
167 | r = r & redMax; | 167 | r = r & redMax; |
168 | 168 | ||
169 | g = pixel; | 169 | g = pixel; |
170 | g = g >> decoder->format->greenShift; | 170 | g = g >> decoder->format->greenShift; |
171 | g = g & greenMax; | 171 | g = g & greenMax; |
172 | 172 | ||
173 | b = pixel; | 173 | b = pixel; |
174 | b = b >> decoder->format->blueShift; | 174 | b = b >> decoder->format->blueShift; |
175 | b = b & blueMax; | 175 | b = b & blueMax; |
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 | ||