Copy the pixel data from source buffer to scale buffer
if scale was changed to 100 percent and copy the pixel data
from scaled buffer to source buffer if scale was changed
from 100 percent. It allow refresh the Desktop Window
without sending FramebufferUpdateRequest message and
decrease the network traffic.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@597
3789f03b-4d11-0410-bbf8-
ca57d06f2519
if (!src_buffer) {
src_buffer = new ManagedPixelBuffer(format, src_width, src_height);
src_data = &(src_buffer->data);
+ memcpy(src_buffer->data, data, area() * (getPF().bpp/8));
}
} else {
scaling = false;
- if (src_buffer) delete src_buffer;
- src_buffer = 0;
- src_data = 0;
}
ScaledPixelBuffer::setScale(scale_);
recreateScaledBuffer();
+ if (scaling) {
+ scaleRect(Rect(0, 0, src_width, src_height));
+ } else {
+ memcpy(data, src_buffer->data, src_buffer->area() * (src_buffer->getPF().bpp/8));
+ if (src_buffer) {
+ delete src_buffer;
+ src_buffer = 0;
+ src_data = 0;
+ }
+ }
}
void ScaledDIBSectionBuffer::setPF(const PixelFormat &pf_) {