Diffstat (limited to 'noncore/comm/keypebble/krfbbuffer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/comm/keypebble/krfbbuffer.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/noncore/comm/keypebble/krfbbuffer.cpp b/noncore/comm/keypebble/krfbbuffer.cpp index 4885261..5a52f31 100644 --- a/noncore/comm/keypebble/krfbbuffer.cpp +++ b/noncore/comm/keypebble/krfbbuffer.cpp | |||
@@ -150,7 +150,38 @@ void KRFBBuffer::drawRawRectChunk( void *data, | |||
150 | *p = qRgb( r,g,b ); | 150 | *p = qRgb( r,g,b ); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | } | 153 | } else if (decoder->format->bpp == 16 ) { |
154 | |||
155 | CARD16 *d = (CARD16 *) data; | ||
156 | |||
157 | uint r,g,b; | ||
158 | |||
159 | for ( int j = 0; j < h; j++ ) { | ||
160 | for ( int i = 0; i < w ; i++ ) { | ||
161 | CARD16 pixel = d[ j * w + i ]; | ||
162 | pixel = Swap16IfLE( pixel ); | ||
163 | |||
164 | r = pixel; | ||
165 | r = r >> decoder->format->redShift; | ||
166 | r = r & redMax; | ||
167 | |||
168 | g = pixel; | ||
169 | g = g >> decoder->format->greenShift; | ||
170 | g = g & greenMax; | ||
171 | |||
172 | b = pixel; | ||
173 | b = b >> decoder->format->blueShift; | ||
174 | b = b & blueMax; | ||
175 | |||
176 | r = ( r * 255 ) / redMax; | ||
177 | g = ( g * 255 ) / greenMax; | ||
178 | b = ( b * 255 ) / blueMax; | ||
179 | |||
180 | ulong *p = ( ulong * ) img.scanLine( j ) + i; | ||
181 | *p = qRgb( r,g,b ); | ||
182 | } | ||
183 | } | ||
184 | } | ||
154 | else { | 185 | else { |
155 | p.setBrush( QBrush( Qt::black ) ); | 186 | p.setBrush( QBrush( Qt::black ) ); |
156 | p.drawRect( x, y, w, h ); | 187 | p.drawRect( x, y, w, h ); |