author | treke <treke> | 2002-09-05 04:42:25 (UTC) |
---|---|---|
committer | treke <treke> | 2002-09-05 04:42:25 (UTC) |
commit | e2186a49cb5cbdf01b56f57818a15a760ff25b2e (patch) (unidiff) | |
tree | f22e7342c7a3adcccb6eed52a314fe8e301cc624 /noncore/comm/keypebble/krfbbuffer.cpp | |
parent | fd3239820e471044bf279a2964702573572859d6 (diff) | |
download | opie-e2186a49cb5cbdf01b56f57818a15a760ff25b2e.zip opie-e2186a49cb5cbdf01b56f57818a15a760ff25b2e.tar.gz opie-e2186a49cb5cbdf01b56f57818a15a760ff25b2e.tar.bz2 |
Added support for client side scaling of the screen. Slow, but sometimes usable.
Diffstat (limited to 'noncore/comm/keypebble/krfbbuffer.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/comm/keypebble/krfbbuffer.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/noncore/comm/keypebble/krfbbuffer.cpp b/noncore/comm/keypebble/krfbbuffer.cpp index 5a52f31..f1cb929 100644 --- a/noncore/comm/keypebble/krfbbuffer.cpp +++ b/noncore/comm/keypebble/krfbbuffer.cpp | |||
@@ -3,12 +3,14 @@ | |||
3 | #include <qbrush.h> | 3 | #include <qbrush.h> |
4 | #include <qimage.h> | 4 | #include <qimage.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | #include "krfbdecoder.h" | 7 | #include "krfbdecoder.h" |
8 | #include "krfbbuffer.h" | 8 | #include "krfbbuffer.h" |
9 | #include "krfbconnection.h" | ||
10 | #include "krfbserver.h" | ||
9 | #include "krfbserverinfo.h" | 11 | #include "krfbserverinfo.h" |
10 | 12 | ||
11 | // | 13 | // |
12 | // Endian stuff | 14 | // Endian stuff |
13 | // | 15 | // |
14 | #ifndef KDE_USE_FINAL | 16 | #ifndef KDE_USE_FINAL |
@@ -83,23 +85,25 @@ void KRFBBuffer::copyRect( int srcX, int srcY, | |||
83 | 85 | ||
84 | void KRFBBuffer::drawRawRectChunk( void *data, | 86 | void KRFBBuffer::drawRawRectChunk( void *data, |
85 | int x, int y, int w, int h ) | 87 | int x, int y, int w, int h ) |
86 | { | 88 | { |
87 | QImage img( w, h, 32 ); | 89 | QImage img( w, h, 32 ); |
88 | 90 | ||
91 | int scaleFactor=decoder->con->options()->scaleFactor; | ||
89 | int redMax = Swap16IfLE( decoder->format->redMax ); | 92 | int redMax = Swap16IfLE( decoder->format->redMax ); |
90 | int greenMax = Swap16IfLE( decoder->format->greenMax ); | 93 | int greenMax = Swap16IfLE( decoder->format->greenMax ); |
91 | int blueMax = Swap16IfLE( decoder->format->blueMax ); | 94 | int blueMax = Swap16IfLE( decoder->format->blueMax ); |
92 | 95 | ||
93 | QPainter p( pix ); | 96 | QPainter p( pix ); |
94 | 97 | ||
95 | if ( decoder->format->bpp == 8 ) { | 98 | if ( decoder->format->bpp == 8 ) { |
96 | uchar *d = (unsigned char *) data; | 99 | uchar *d = (unsigned char *) data; |
97 | 100 | ||
98 | uint r,g,b; | 101 | uint r,g,b; |
99 | 102 | ||
103 | |||
100 | for ( int j = 0; j < h; j++ ) { | 104 | for ( int j = 0; j < h; j++ ) { |
101 | for ( int i = 0; i < w ; i++ ) { | 105 | for ( int i = 0; i < w ; i++ ) { |
102 | r = d[ j * w + i ]; | 106 | r = d[ j * w + i ]; |
103 | r = r >> decoder->format->redShift; | 107 | r = r >> decoder->format->redShift; |
104 | r = r & redMax; | 108 | r = r & redMax; |
105 | 109 | ||
@@ -184,11 +188,16 @@ void KRFBBuffer::drawRawRectChunk( void *data, | |||
184 | } | 188 | } |
185 | else { | 189 | else { |
186 | p.setBrush( QBrush( Qt::black ) ); | 190 | p.setBrush( QBrush( Qt::black ) ); |
187 | p.drawRect( x, y, w, h ); | 191 | p.drawRect( x, y, w, h ); |
188 | } | 192 | } |
189 | 193 | ||
194 | if (scaleFactor > 1) { | ||
195 | p.drawImage( x/scaleFactor, y/scaleFactor, img.smoothScale(w/scaleFactor,h/scaleFactor) ); | ||
196 | emit updated( x/scaleFactor, y/scaleFactor, w/scaleFactor, h/scaleFactor ); | ||
197 | } | ||
198 | else { | ||
190 | p.drawImage( x, y, img ); | 199 | p.drawImage( x, y, img ); |
191 | |||
192 | emit updated( x, y, w, h ); | 200 | emit updated( x, y, w, h ); |
193 | } | 201 | } |
202 | } | ||
194 | 203 | ||