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

Side by Side Diff: remoting/host/capturer_fake_ascii.cc

Issue 7491070: Switch over to using SkRegions to calculate dirty areas. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed up shared lib compile Created 9 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_helper.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/gfx/rect.h" 7 #include "ui/gfx/rect.h"
8 8
9 namespace remoting { 9 namespace remoting {
10 10
(...skipping 19 matching lines...) Expand all
30 int buffer_size = height_ * bytes_per_row_; 30 int buffer_size = height_ * bytes_per_row_;
31 for (int i = 0; i < kNumBuffers; i++) { 31 for (int i = 0; i < kNumBuffers; i++) {
32 buffers_[i].reset(new uint8[buffer_size]); 32 buffers_[i].reset(new uint8[buffer_size]);
33 } 33 }
34 } 34 }
35 35
36 media::VideoFrame::Format CapturerFakeAscii::pixel_format() const { 36 media::VideoFrame::Format CapturerFakeAscii::pixel_format() const {
37 return pixel_format_; 37 return pixel_format_;
38 } 38 }
39 39
40 void CapturerFakeAscii::ClearInvalidRects() { 40 void CapturerFakeAscii::ClearInvalidRegion() {
41 helper.ClearInvalidRects(); 41 helper_.ClearInvalidRegion();
42 } 42 }
43 43
44 void CapturerFakeAscii::InvalidateRects(const InvalidRects& inval_rects) { 44 void CapturerFakeAscii::InvalidateRegion(const SkRegion& invalid_region) {
45 helper.InvalidateRects(inval_rects); 45 helper_.InvalidateRegion(invalid_region);
46 } 46 }
47 47
48 void CapturerFakeAscii::InvalidateScreen(const gfx::Size& size) { 48 void CapturerFakeAscii::InvalidateScreen(const gfx::Size& size) {
49 helper.InvalidateScreen(size); 49 helper_.InvalidateScreen(size);
50 } 50 }
51 51
52 void CapturerFakeAscii::InvalidateFullScreen() { 52 void CapturerFakeAscii::InvalidateFullScreen() {
53 helper.InvalidateFullScreen(); 53 helper_.InvalidateFullScreen();
54 } 54 }
55 55
56 void CapturerFakeAscii::CaptureInvalidRects( 56 void CapturerFakeAscii::CaptureInvalidRegion(
57 CaptureCompletedCallback* callback) { 57 CaptureCompletedCallback* callback) {
58 scoped_ptr<CaptureCompletedCallback> callback_deleter(callback); 58 scoped_ptr<CaptureCompletedCallback> callback_deleter(callback);
59 59
60 GenerateImage(); 60 GenerateImage();
61 DataPlanes planes; 61 DataPlanes planes;
62 planes.data[0] = buffers_[current_buffer_].get(); 62 planes.data[0] = buffers_[current_buffer_].get();
63 current_buffer_ = (current_buffer_ + 1) % kNumBuffers; 63 current_buffer_ = (current_buffer_ + 1) % kNumBuffers;
64 planes.strides[0] = bytes_per_row_; 64 planes.strides[0] = bytes_per_row_;
65 scoped_refptr<CaptureData> capture_data(new CaptureData( 65 scoped_refptr<CaptureData> capture_data(new CaptureData(
66 planes, gfx::Size(width_, height_), pixel_format_)); 66 planes, gfx::Size(width_, height_), pixel_format_));
67 67
68 helper.set_size_most_recent(capture_data->size()); 68 helper_.set_size_most_recent(capture_data->size());
69 69
70 callback->Run(capture_data); 70 callback->Run(capture_data);
71 } 71 }
72 72
73 const gfx::Size& CapturerFakeAscii::size_most_recent() const { 73 const gfx::Size& CapturerFakeAscii::size_most_recent() const {
74 return helper.size_most_recent(); 74 return helper_.size_most_recent();
75 } 75 }
76 76
77 void CapturerFakeAscii::GenerateImage() { 77 void CapturerFakeAscii::GenerateImage() {
78 for (int y = 0; y < height_; ++y) { 78 for (int y = 0; y < height_; ++y) {
79 uint8* row = buffers_[current_buffer_].get() + bytes_per_row_ * y; 79 uint8* row = buffers_[current_buffer_].get() + bytes_per_row_ * y;
80 for (int x = 0; x < bytes_per_row_; ++x) { 80 for (int x = 0; x < bytes_per_row_; ++x) {
81 if (y == 0 || x == 0 || x == (width_ - 1) || y == (height_ - 1)) { 81 if (y == 0 || x == 0 || x == (width_ - 1) || y == (height_ - 1)) {
82 row[x] = '*'; 82 row[x] = '*';
83 } else { 83 } else {
84 row[x] = ' '; 84 row[x] = ' ';
85 } 85 }
86 } 86 }
87 } 87 }
88 } 88 }
89 89
90 } // namespace remoting 90 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/capturer_fake_ascii.h ('k') | remoting/host/capturer_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698