Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: remoting/host/capturer_gdi.cc

Issue 3013015: Initial pass at integrating Differ into the chromoting host code.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/capturer_gdi.h ('k') | remoting/host/capturer_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/capturer_gdi.cc
===================================================================
--- remoting/host/capturer_gdi.cc (revision 55264)
+++ remoting/host/capturer_gdi.cc (working copy)
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "remoting/host/capturer_gdi.h"
+#include "remoting/host/differ.h"
#include "gfx/rect.h"
@@ -13,8 +14,10 @@
// 32 bit RGBA is 4 bytes per pixel.
static const int kBytesPerPixel = 4;
-CapturerGdi::CapturerGdi() : desktop_dc_(NULL),
- memory_dc_(NULL) {
+CapturerGdi::CapturerGdi()
+ : desktop_dc_(NULL),
+ memory_dc_(NULL),
+ capture_fullscreen_(true) {
memset(target_bitmap_, 0, sizeof(target_bitmap_));
memset(buffers_, 0, sizeof(buffers_));
}
@@ -57,6 +60,9 @@
pixel_format_ = PixelFormatRgb32;
bytes_per_row_ = rounded_width * kBytesPerPixel;
+ // Create a differ for this screen size.
+ differ_.reset(new Differ(width_, height_, 4, bytes_per_row_));
+
// Create a device independant bitmap (DIB) that is the same size.
BITMAPINFO bmi;
memset(&bmi, 0, sizeof(bmi));
@@ -75,15 +81,41 @@
static_cast<void**>(&buffers_[i]),
NULL, 0);
}
+
+ capture_fullscreen_ = true;
}
-void CapturerGdi::CaptureRects(const RectVector& rects,
+void CapturerGdi::CalculateInvalidRects() {
+ ClearInvalidRects();
+ CaptureImage();
+
+ if (capture_fullscreen_) {
+ InvalidateFullScreen();
+ } else {
+ // Calculate the difference between the previous and current screen.
+ int prev_buffer_id = current_buffer_ - 1;
+ if (prev_buffer_id < 0) {
+ prev_buffer_id = kNumBuffers - 1;
+ }
+
+ void* prev_buffer = buffers_[prev_buffer_id];
+ void* curr_buffer = buffers_[current_buffer_];
+
+ InvalidRects rects;
+ differ_->CalcDirtyRects(prev_buffer, curr_buffer, &rects);
+
+ InvalidateRects(rects);
+ }
+
+ capture_fullscreen_ = false;
+}
+
+void CapturerGdi::CaptureRects(const InvalidRects& rects,
CaptureCompletedCallback* callback) {
DataPlanes planes;
planes.data[0] = static_cast<uint8*>(buffers_[current_buffer_]);
planes.strides[0] = bytes_per_row_;
- CaptureImage();
scoped_refptr<CaptureData> data(new CaptureData(planes,
width(),
height(),
@@ -94,7 +126,7 @@
}
void CapturerGdi::CaptureImage() {
- // Selection the target bitmap into the memory dc.
+ // Select the target bitmap into the memory dc.
SelectObject(memory_dc_, target_bitmap_[current_buffer_]);
// And then copy the rect from desktop to memory.
« no previous file with comments | « remoting/host/capturer_gdi.h ('k') | remoting/host/capturer_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698