diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 23:18:44 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-06 23:18:44 +0000 |
commit | 8a15f0149b7ccd709574151ce7eeb1add16e7cc7 (patch) | |
tree | 57eb261afb052374a778b4aa18919be0c6dc83f9 /remoting/base/decoder_zlib.cc | |
parent | 1e7b565652875f8f16e5211d1fecaed17efe26e1 (diff) | |
download | chromium_src-8a15f0149b7ccd709574151ce7eeb1add16e7cc7.zip chromium_src-8a15f0149b7ccd709574151ce7eeb1add16e7cc7.tar.gz chromium_src-8a15f0149b7ccd709574151ce7eeb1add16e7cc7.tar.bz2 |
Reverse rows in DecoderZlib for remoting
Windows images are upside down, so when we decode the stream and paint the
image we need to reverse the rows.
This is a temporary solution since it sets to reverse rows by default. We'll
move to use the information from the update stream to determine we should
reverse or not.
Review URL: http://codereview.chromium.org/2883055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55314 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base/decoder_zlib.cc')
-rw-r--r-- | remoting/base/decoder_zlib.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/remoting/base/decoder_zlib.cc b/remoting/base/decoder_zlib.cc index 3e23f95..e44a2f2 100644 --- a/remoting/base/decoder_zlib.cc +++ b/remoting/base/decoder_zlib.cc @@ -18,7 +18,11 @@ DecoderZlib::DecoderZlib() bytes_per_pixel_(0), updated_rects_(NULL), row_pos_(0), - row_y_(0) { + row_y_(0), + // TODO(hclam): We should use the information from the update stream + // to determine whether we should reverse the rows or not. + // But for simplicity we set to be always true. + reverse_rows_(true) { } bool DecoderZlib::BeginDecode(scoped_refptr<media::VideoFrame> frame, @@ -106,9 +110,18 @@ bool DecoderZlib::HandleRectData(HostMessage* message) { const int in_size = message->update_stream_packet().rect_data().data().size(); const int row_size = rect_width_ * bytes_per_pixel_; - const int stride = frame_->stride(media::VideoFrame::kRGBPlane); - uint8* out = frame_->data(media::VideoFrame::kRGBPlane) + - stride * (rect_y_ + row_y_) + bytes_per_pixel_ * rect_x_; + int stride = frame_->stride(media::VideoFrame::kRGBPlane); + uint8* rect_begin = frame_->data(media::VideoFrame::kRGBPlane); + if (reverse_rows_) { + // Advance the pointer to the last row. + rect_begin += (frame_->height() - 1) * stride; + + // And then make the stride negative. + stride = -stride; + } + + uint8* out = rect_begin + stride * (rect_y_ + row_y_) + + bytes_per_pixel_ * rect_x_; // Consume all the data in the message. bool decompress_again = true; |