summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 18:16:53 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 18:16:53 +0000
commitd3a4b09d49a617e667e79c387fbe3570c7fac950 (patch)
treeb67e7d9e794de45f347f745020b8af370a523f6c /remoting
parent20a648064480d72460d3b6b0b211ea781cdd6c55 (diff)
downloadchromium_src-d3a4b09d49a617e667e79c387fbe3570c7fac950.zip
chromium_src-d3a4b09d49a617e667e79c387fbe3570c7fac950.tar.gz
chromium_src-d3a4b09d49a617e667e79c387fbe3570c7fac950.tar.bz2
Change chromoting images to upright by default
Remove all the ugly code to have reverse rows. All images are upright now. BUG=71872 TEST=Everything in chromoting still works and upright. Review URL: http://codereview.chromium.org/6546057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75609 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/base/decoder_row_based.cc14
-rw-r--r--remoting/base/decoder_row_based.h8
-rw-r--r--remoting/base/decoder_vp8.cc12
-rw-r--r--remoting/base/decoder_vp8.h3
-rw-r--r--remoting/base/encode_decode_unittest.cc2
-rw-r--r--remoting/host/capturer_gdi.cc2
-rw-r--r--remoting/host/capturer_linux.cc19
7 files changed, 8 insertions, 52 deletions
diff --git a/remoting/base/decoder_row_based.cc b/remoting/base/decoder_row_based.cc
index 25e738f..f349272 100644
--- a/remoting/base/decoder_row_based.cc
+++ b/remoting/base/decoder_row_based.cc
@@ -32,11 +32,7 @@ DecoderRowBased::DecoderRowBased(Decompressor* decompressor,
decompressor_(decompressor),
encoding_(encoding),
row_pos_(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) {
+ row_y_(0) {
}
DecoderRowBased::~DecoderRowBased() {
@@ -92,14 +88,6 @@ Decoder::DecodeResult DecoderRowBased::DecodePacket(const VideoPacket* packet) {
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 * (clip_.y() + row_y_) +
kBytesPerPixel * clip_.x();
diff --git a/remoting/base/decoder_row_based.h b/remoting/base/decoder_row_based.h
index 05c2e3c..2afd60e 100644
--- a/remoting/base/decoder_row_based.h
+++ b/remoting/base/decoder_row_based.h
@@ -26,11 +26,6 @@ class DecoderRowBased : public Decoder {
virtual void Reset();
virtual VideoPacketFormat::Encoding Encoding();
- // TODO(hclam): Should make this into the Decoder interface.
- // TODO(ajwong): Before putting into the interface, we should decide if the
- // Host should normalize the coordinate system.
- void set_reverse_rows(bool reverse) { reverse_rows_ = reverse; }
-
private:
enum State {
kUninitialized,
@@ -68,9 +63,6 @@ class DecoderRowBased : public Decoder {
// The current row in the rect that we are updaing.
int row_y_;
- // True if we should decode the image upside down.
- bool reverse_rows_;
-
UpdatedRects updated_rects_;
DISALLOW_COPY_AND_ASSIGN(DecoderRowBased);
diff --git a/remoting/base/decoder_vp8.cc b/remoting/base/decoder_vp8.cc
index d7744a8..785382a 100644
--- a/remoting/base/decoder_vp8.cc
+++ b/remoting/base/decoder_vp8.cc
@@ -18,8 +18,7 @@ extern "C" {
namespace remoting {
DecoderVp8::DecoderVp8()
- : reverse_rows_(true),
- state_(kUninitialized),
+ : state_(kUninitialized),
codec_(NULL) {
}
@@ -84,10 +83,6 @@ Decoder::DecodeResult DecoderVp8::DecodePacket(const VideoPacket* packet) {
// Perform YUV conversion.
uint8* data_start = frame_->data(media::VideoFrame::kRGBPlane);
int stride = frame_->stride(media::VideoFrame::kRGBPlane);
- if (reverse_rows_) {
- data_start = data_start + (frame_->height() - 1) * stride;
- stride = -stride;
- }
// Propogate updated rects.
updated_rects_.clear();
@@ -109,11 +104,6 @@ Decoder::DecodeResult DecoderVp8::DecodePacket(const VideoPacket* packet) {
image->stride[0],
image->stride[1],
stride);
-
- // Since the image generated by client is upside-down we need to report
- // updated rects as upside-down.
- if (reverse_rows_)
- r.set_y(image->d_h - r.bottom());
updated_rects_.push_back(r);
}
return DECODE_DONE;
diff --git a/remoting/base/decoder_vp8.h b/remoting/base/decoder_vp8.h
index 6e15a0b..08f60e2 100644
--- a/remoting/base/decoder_vp8.h
+++ b/remoting/base/decoder_vp8.h
@@ -31,9 +31,6 @@ class DecoderVp8 : public Decoder {
kError,
};
- // True if we should decode the image upside down.
- bool reverse_rows_;
-
// The internal state of the decoder.
State state_;
diff --git a/remoting/base/encode_decode_unittest.cc b/remoting/base/encode_decode_unittest.cc
index d1d409d..10baf7c 100644
--- a/remoting/base/encode_decode_unittest.cc
+++ b/remoting/base/encode_decode_unittest.cc
@@ -13,14 +13,12 @@ namespace remoting {
TEST(EncodeDecodeTest, EncodeAndDecodeZlib) {
scoped_ptr<EncoderRowBased> encoder(EncoderRowBased::CreateZlibEncoder());
scoped_ptr<DecoderRowBased> decoder(DecoderRowBased::CreateZlibDecoder());
- decoder->set_reverse_rows(false);
TestEncoderDecoder(encoder.get(), decoder.get(), true);
}
TEST(EncodeDecodeTest, EncodeAndDecodeSmallOutputBufferZlib) {
scoped_ptr<EncoderRowBased> encoder(EncoderRowBased::CreateZlibEncoder(64));
scoped_ptr<DecoderRowBased> decoder(DecoderRowBased::CreateZlibDecoder());
- decoder->set_reverse_rows(false);
TestEncoderDecoder(encoder.get(), decoder.get(), true);
}
diff --git a/remoting/host/capturer_gdi.cc b/remoting/host/capturer_gdi.cc
index ab325321..bdaf756 100644
--- a/remoting/host/capturer_gdi.cc
+++ b/remoting/host/capturer_gdi.cc
@@ -68,7 +68,7 @@ void CapturerGdi::ScreenConfigurationChanged() {
// Create a device independant bitmap (DIB) that is the same size.
BITMAPINFO bmi;
memset(&bmi, 0, sizeof(bmi));
- bmi.bmiHeader.biHeight = height_;
+ bmi.bmiHeader.biHeight = -height_;
bmi.bmiHeader.biWidth = width_;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = kBytesPerPixel * 8;
diff --git a/remoting/host/capturer_linux.cc b/remoting/host/capturer_linux.cc
index 5295b0f..f8e3fc6 100644
--- a/remoting/host/capturer_linux.cc
+++ b/remoting/host/capturer_linux.cc
@@ -286,17 +286,8 @@ void CapturerLinuxPimpl::CaptureRects(
// TODO(ajwong): We should only repair the rects that were copied!
XDamageSubtract(display_, damage_handle_, None, None);
- // Flip the rectangles based on y axis.
- InvalidRects inverted_rects;
- for (InvalidRects::const_iterator it = rects.begin();
- it != rects.end();
- ++it) {
- inverted_rects.insert(gfx::Rect(it->x(), capturer_->height() - it->bottom(),
- it->width(), it->height()));
- }
-
- capture_data->mutable_dirty_rects() = inverted_rects;
- last_invalid_rects_ = inverted_rects;
+ capture_data->mutable_dirty_rects() = rects;
+ last_invalid_rects_ = rects;
last_buffer_ = buffer;
// TODO(ajwong): These completion signals back to the upper class are very
@@ -326,14 +317,14 @@ void CapturerLinuxPimpl::FastBlit(XImage* image, int dest_x, int dest_y,
const int dst_stride = planes.strides[0];
const int src_stride = image->bytes_per_line;
- // Produce an upside down image.
- uint8* dst_pos = dst_buffer + dst_stride * (capturer_->height() - dest_y - 1);
+ uint8* dst_pos = dst_buffer + dst_stride * dest_y;
dst_pos += dest_x * kBytesPerPixel;
+
for (int y = 0; y < image->height; ++y) {
memcpy(dst_pos, src_pos, image->width * kBytesPerPixel);
src_pos += src_stride;
- dst_pos -= dst_stride;
+ dst_pos += dst_stride;
}
}