summaryrefslogtreecommitdiffstats
path: root/remoting/host/capturer_mac.cc
diff options
context:
space:
mode:
authorsimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-03 16:54:48 +0000
committersimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-03 16:54:48 +0000
commitd8a6ca901e27fe58e1385492b0fc0cc8bbccaa10 (patch)
tree97322432de7e2381eb065cc3af19d53abba6e2f3 /remoting/host/capturer_mac.cc
parent804443aef39615edd5b731aa5bfb3c611aeae697 (diff)
downloadchromium_src-d8a6ca901e27fe58e1385492b0fc0cc8bbccaa10.zip
chromium_src-d8a6ca901e27fe58e1385492b0fc0cc8bbccaa10.tar.gz
chromium_src-d8a6ca901e27fe58e1385492b0fc0cc8bbccaa10.tar.bz2
Revert 76747 - Let the host change resolution.
The screen size flows through the video pipeline, instead of being set statically when that pipeline is constructed. Only the Windows host actually detects when the screen size has changed. BUG=72469 TEST=none Review URL: http://codereview.chromium.org/6573005 TBR=simonmorris@chromium.org Review URL: http://codereview.chromium.org/6610018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76748 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/capturer_mac.cc')
-rw-r--r--remoting/host/capturer_mac.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/remoting/host/capturer_mac.cc b/remoting/host/capturer_mac.cc
index 614386f..dd94649 100644
--- a/remoting/host/capturer_mac.cc
+++ b/remoting/host/capturer_mac.cc
@@ -12,10 +12,7 @@ namespace remoting {
CapturerMac::CapturerMac(MessageLoop* message_loop)
: Capturer(message_loop),
- cgl_context_(NULL),
- width_(0),
- height_(0),
- bytes_per_row_(0) {
+ cgl_context_(NULL) {
// TODO(dmaclach): move this initialization out into session_manager,
// or at least have session_manager call into here to initialize it.
CGError err =
@@ -54,7 +51,7 @@ void CapturerMac::ScreenConfigurationChanged() {
height_ = CGDisplayPixelsHigh(mainDevice);
pixel_format_ = media::VideoFrame::RGB32;
bytes_per_row_ = width_ * sizeof(uint32_t);
- size_t buffer_size = height_ * bytes_per_row_;
+ size_t buffer_size = height() * bytes_per_row_;
for (int i = 0; i < kNumBuffers; ++i) {
buffers_[i].reset(new uint8[buffer_size]);
}
@@ -96,17 +93,19 @@ void CapturerMac::CaptureRects(const InvalidRects& rects,
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
// Read a block of pixels from the frame buffer.
+ int h = height();
+ int w = width();
uint8* flip_buffer = flip_buffer_.get();
uint8* current_buffer = buffers_[current_buffer_].get();
- glReadPixels(0, 0, width_, height_, GL_BGRA, GL_UNSIGNED_BYTE, flip_buffer);
+
+ glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, flip_buffer);
glPopClientAttrib();
// OpenGL reads with a vertical flip, and sadly there is no optimized
// way to get it flipped automatically.
- for (int y = 0; y < height_; ++y) {
+ for (int y = 0; y < h; ++y) {
uint8* flip_row = &(flip_buffer[y * bytes_per_row_]);
- uint8* current_row =
- &(current_buffer[(height_ - (y + 1)) * bytes_per_row_]);
+ uint8* current_row = &(current_buffer[(h - (y + 1)) * bytes_per_row_]);
memcpy(current_row, flip_row, bytes_per_row_);
}
@@ -115,7 +114,7 @@ void CapturerMac::CaptureRects(const InvalidRects& rects,
planes.strides[0] = bytes_per_row_;
scoped_refptr<CaptureData> data(
- new CaptureData(planes, width_, height_, pixel_format()));
+ new CaptureData(planes, w, h, pixel_format()));
data->mutable_dirty_rects() = rects;
FinishCapture(data, callback);
}
@@ -124,7 +123,7 @@ void CapturerMac::ScreenRefresh(CGRectCount count, const CGRect *rect_array) {
InvalidRects rects;
for (CGRectCount i = 0; i < count; ++i) {
CGRect rect = rect_array[i];
- rect.origin.y = height_ - rect.size.height;
+ rect.origin.y = height() - rect.size.height;
rects.insert(gfx::Rect(rect));
}
InvalidateRects(rects);
@@ -136,7 +135,7 @@ void CapturerMac::ScreenUpdateMove(CGScreenUpdateMoveDelta delta,
InvalidRects rects;
for (CGRectCount i = 0; i < count; ++i) {
CGRect rect = rect_array[i];
- rect.origin.y = height_ - rect.size.height;
+ rect.origin.y = height() - rect.size.height;
rects.insert(gfx::Rect(rect));
rect = CGRectOffset(rect, delta.dX, delta.dY);
rects.insert(gfx::Rect(rect));