summaryrefslogtreecommitdiffstats
path: root/remoting/client
diff options
context:
space:
mode:
authorgarykac@google.com <garykac@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-28 21:57:12 +0000
committergarykac@google.com <garykac@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-28 21:57:12 +0000
commit9386906c3d0db55101066b7d2e89967bc452b237 (patch)
tree703606ac23c416980f24a3ce22e14737430d3c12 /remoting/client
parent6738128e5d2b6bb42eac2fb591d30a0a99b76600 (diff)
downloadchromium_src-9386906c3d0db55101066b7d2e89967bc452b237.zip
chromium_src-9386906c3d0db55101066b7d2e89967bc452b237.tar.gz
chromium_src-9386906c3d0db55101066b7d2e89967bc452b237.tar.bz2
Add flag to decoder class to flip the image vertically since that is required
on some platforms. BUG=none TEST=run code, verify that screen is upside-up. Review URL: http://codereview.chromium.org/2878009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51052 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r--remoting/client/decoder_verbatim.cc12
-rw-r--r--remoting/client/decoder_verbatim.h4
2 files changed, 14 insertions, 2 deletions
diff --git a/remoting/client/decoder_verbatim.cc b/remoting/client/decoder_verbatim.cc
index aba5dce..e9b88ef 100644
--- a/remoting/client/decoder_verbatim.cc
+++ b/remoting/client/decoder_verbatim.cc
@@ -9,7 +9,8 @@
namespace remoting {
DecoderVerbatim::DecoderVerbatim()
- : updated_rects_(NULL) {
+ : updated_rects_(NULL),
+ reverse_rows_(true) {
}
bool DecoderVerbatim::BeginDecode(scoped_refptr<media::VideoFrame> frame,
@@ -51,13 +52,20 @@ bool DecoderVerbatim::PartialDecode(HostMessage* message) {
// Copy the data line by line.
const int src_stride = bytes_per_pixel * width;
const char* src = message->update_stream_packet().data().c_str();
+ int src_stride_dir = src_stride;
+ if (reverse_rows_) {
+ // Copy rows from bottom to top to flip the image vertically.
+ src += (height - 1) * src_stride;
+ // Change the direction of the stride to work bottom to top.
+ src_stride_dir *= -1;
+ }
const int dest_stride = frame_->stride(media::VideoFrame::kRGBPlane);
uint8* dest = frame_->data(media::VideoFrame::kRGBPlane) +
dest_stride * y + bytes_per_pixel * x;
for (int i = 0; i < height; ++i) {
memcpy(dest, src, src_stride);
dest += dest_stride;
- src += src_stride;
+ src += src_stride_dir;
}
updated_rects_->clear();
diff --git a/remoting/client/decoder_verbatim.h b/remoting/client/decoder_verbatim.h
index b1f776c..85b49c6 100644
--- a/remoting/client/decoder_verbatim.h
+++ b/remoting/client/decoder_verbatim.h
@@ -30,6 +30,10 @@ class DecoderVerbatim : public Decoder {
scoped_refptr<media::VideoFrame> frame_;
UpdatedRects* updated_rects_;
+ // True if we should reverse the rows when copying data into the target
+ // frame buffer.
+ bool reverse_rows_;
+
DISALLOW_COPY_AND_ASSIGN(DecoderVerbatim);
};