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

Side by Side Diff: remoting/host/capturer_fake_ascii.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/capturer_fake_ascii.h ('k') | remoting/host/capturer_gdi.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/capturer_fake_ascii.h" 5 #include "remoting/host/capturer_fake_ascii.h"
6 6
7 #include "gfx/rect.h" 7 #include "gfx/rect.h"
8 8
9 namespace remoting { 9 namespace remoting {
10 10
11 static const int kWidth = 32; 11 static const int kWidth = 32;
12 static const int kHeight = 20; 12 static const int kHeight = 20;
13 static const int kBytesPerPixel = 1; 13 static const int kBytesPerPixel = 1;
14 14
15 CapturerFakeAscii::CapturerFakeAscii() { 15 CapturerFakeAscii::CapturerFakeAscii() {
16 } 16 }
17 17
18 CapturerFakeAscii::~CapturerFakeAscii() { 18 CapturerFakeAscii::~CapturerFakeAscii() {
19 } 19 }
20 20
21 void CapturerFakeAscii::CaptureRects(const RectVector& rects,
22 CaptureCompletedCallback* callback) {
23 GenerateImage();
24 DataPlanes planes;
25 planes.data[0] = buffers_[current_buffer_].get();
26 planes.strides[0] = bytes_per_row_;
27 scoped_refptr<CaptureData> capture_data(new CaptureData(planes,
28 width_,
29 height_,
30 pixel_format_));
31 FinishCapture(capture_data, callback);
32 }
33
34 void CapturerFakeAscii::ScreenConfigurationChanged() { 21 void CapturerFakeAscii::ScreenConfigurationChanged() {
35 width_ = kWidth; 22 width_ = kWidth;
36 height_ = kHeight; 23 height_ = kHeight;
37 pixel_format_ = PixelFormatAscii; 24 pixel_format_ = PixelFormatAscii;
38 bytes_per_row_ = width_ * kBytesPerPixel; 25 bytes_per_row_ = width_ * kBytesPerPixel;
39 26
40 // Create memory for the buffers. 27 // Create memory for the buffers.
41 int buffer_size = height_ * bytes_per_row_; 28 int buffer_size = height_ * bytes_per_row_;
42 for (int i = 0; i < kNumBuffers; i++) { 29 for (int i = 0; i < kNumBuffers; i++) {
43 buffers_[i].reset(new uint8[buffer_size]); 30 buffers_[i].reset(new uint8[buffer_size]);
44 } 31 }
45 } 32 }
46 33
34 void CapturerFakeAscii::CalculateInvalidRects() {
35 // Capture and invalidate the entire screen.
36 // Performing the capture here is modelled on the Windows
37 // GDI capturer.
38 GenerateImage();
39 InvalidateFullScreen();
40 }
41
42 void CapturerFakeAscii::CaptureRects(const InvalidRects& rects,
43 CaptureCompletedCallback* callback) {
44 DataPlanes planes;
45 planes.data[0] = buffers_[current_buffer_].get();
46 planes.strides[0] = bytes_per_row_;
47 scoped_refptr<CaptureData> capture_data(new CaptureData(planes,
48 width_,
49 height_,
50 pixel_format_));
51 FinishCapture(capture_data, callback);
52 }
53
47 void CapturerFakeAscii::GenerateImage() { 54 void CapturerFakeAscii::GenerateImage() {
48 for (int y = 0; y < height_; ++y) { 55 for (int y = 0; y < height_; ++y) {
49 uint8* row = buffers_[current_buffer_].get() + bytes_per_row_ * y; 56 uint8* row = buffers_[current_buffer_].get() + bytes_per_row_ * y;
50 for (int x = 0; x < bytes_per_row_; ++x) { 57 for (int x = 0; x < bytes_per_row_; ++x) {
51 if (y == 0 || x == 0 || x == (width_ - 1) || y == (height_ - 1)) { 58 if (y == 0 || x == 0 || x == (width_ - 1) || y == (height_ - 1)) {
52 row[x] = '*'; 59 row[x] = '*';
53 } else { 60 } else {
54 row[x] = ' '; 61 row[x] = ' ';
55 } 62 }
56 } 63 }
57 } 64 }
58 } 65 }
59 66
60 } // namespace remoting 67 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/capturer_fake_ascii.h ('k') | remoting/host/capturer_gdi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698