summaryrefslogtreecommitdiffstats
path: root/remoting/host/capturer_mac.cc
diff options
context:
space:
mode:
authorjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 10:10:10 +0000
committerjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 10:10:10 +0000
commit0ea4fc7dcb594a37ecc7cb9810438d8c695ac67d (patch)
treec1ea5b8e74c2d3fbb66f64a326791215f2acee0d /remoting/host/capturer_mac.cc
parent870aa63fb54f2d8e2826e9d59bf2a36886159804 (diff)
downloadchromium_src-0ea4fc7dcb594a37ecc7cb9810438d8c695ac67d.zip
chromium_src-0ea4fc7dcb594a37ecc7cb9810438d8c695ac67d.tar.gz
chromium_src-0ea4fc7dcb594a37ecc7cb9810438d8c695ac67d.tar.bz2
Don't flip buffer--process it with a negative stride instead.
BUG=79040 TEST= Review URL: http://codereview.chromium.org/6871012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81931 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/capturer_mac.cc')
-rw-r--r--remoting/host/capturer_mac.cc19
1 files changed, 4 insertions, 15 deletions
diff --git a/remoting/host/capturer_mac.cc b/remoting/host/capturer_mac.cc
index 6eb446d..f0efc7f 100644
--- a/remoting/host/capturer_mac.cc
+++ b/remoting/host/capturer_mac.cc
@@ -56,7 +56,6 @@ class CapturerMac : public Capturer {
CGLContextObj cgl_context_;
static const int kNumBuffers = 2;
scoped_array<uint8> buffers_[kNumBuffers];
- scoped_array<uint8> flip_buffer_;
// A thread-safe list of invalid rectangles, and the size of the most
// recently captured screen.
@@ -127,7 +126,6 @@ void CapturerMac::ScreenConfigurationChanged() {
for (int i = 0; i < kNumBuffers; ++i) {
buffers_[i].reset(new uint8[buffer_size]);
}
- flip_buffer_.reset(new uint8[buffer_size]);
CGLPixelFormatAttribute attributes[] = {
kCGLPFAFullScreen,
kCGLPFADisplayMask,
@@ -181,23 +179,14 @@ void CapturerMac::CaptureInvalidRects(CaptureCompletedCallback* callback) {
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
// Read a block of pixels from the frame buffer.
- 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, width_, height_, GL_BGRA, GL_UNSIGNED_BYTE,
+ current_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) {
- uint8* flip_row = &(flip_buffer[y * bytes_per_row_]);
- uint8* current_row =
- &(current_buffer[(height_ - (y + 1)) * bytes_per_row_]);
- memcpy(current_row, flip_row, bytes_per_row_);
- }
-
DataPlanes planes;
- planes.data[0] = buffers_[current_buffer_].get();
- planes.strides[0] = bytes_per_row_;
+ planes.data[0] = buffers_[current_buffer_].get() + height_ * bytes_per_row_;
+ planes.strides[0] = -bytes_per_row_;
scoped_refptr<CaptureData> data(
new CaptureData(planes, gfx::Size(width_, height_), pixel_format()));