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

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

Issue 7992011: Move us fully from gfx:: over to skia types for consistency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for bad DEPS Created 9 years, 2 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.h ('k') | remoting/host/capturer_fake_ascii.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.h" 5 #include "remoting/host/capturer_fake.h"
6 6
7 #include "ui/gfx/rect.h"
8
9 namespace remoting { 7 namespace remoting {
10 8
11 // CapturerFake generates a white picture of size kWidth x kHeight with a 9 // CapturerFake generates a white picture of size kWidth x kHeight with a
12 // rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed pixels 10 // rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed pixels
13 // per frame along both axes, and bounces off the sides of the screen. 11 // per frame along both axes, and bounces off the sides of the screen.
14 static const int kWidth = 800; 12 static const int kWidth = 800;
15 static const int kHeight = 600; 13 static const int kHeight = 600;
16 static const int kBoxWidth = 140; 14 static const int kBoxWidth = 140;
17 static const int kBoxHeight = 140; 15 static const int kBoxHeight = 140;
18 static const int kSpeed = 20; 16 static const int kSpeed = 20;
(...skipping 13 matching lines...) Expand all
32 box_speed_y_(kSpeed), 30 box_speed_y_(kSpeed),
33 current_buffer_(0), 31 current_buffer_(0),
34 pixel_format_(media::VideoFrame::RGB32) { 32 pixel_format_(media::VideoFrame::RGB32) {
35 ScreenConfigurationChanged(); 33 ScreenConfigurationChanged();
36 } 34 }
37 35
38 CapturerFake::~CapturerFake() { 36 CapturerFake::~CapturerFake() {
39 } 37 }
40 38
41 void CapturerFake::ScreenConfigurationChanged() { 39 void CapturerFake::ScreenConfigurationChanged() {
42 size_ = gfx::Size(kWidth, kHeight); 40 size_ = SkISize::Make(kWidth, kHeight);
43 bytes_per_row_ = size_.width() * kBytesPerPixel; 41 bytes_per_row_ = size_.width() * kBytesPerPixel;
44 pixel_format_ = media::VideoFrame::RGB32; 42 pixel_format_ = media::VideoFrame::RGB32;
45 43
46 // Create memory for the buffers. 44 // Create memory for the buffers.
47 int buffer_size = size_.height() * bytes_per_row_; 45 int buffer_size = size_.height() * bytes_per_row_;
48 for (int i = 0; i < kNumBuffers; i++) { 46 for (int i = 0; i < kNumBuffers; i++) {
49 buffers_[i].reset(new uint8[buffer_size]); 47 buffers_[i].reset(new uint8[buffer_size]);
50 } 48 }
51 } 49 }
52 50
53 media::VideoFrame::Format CapturerFake::pixel_format() const { 51 media::VideoFrame::Format CapturerFake::pixel_format() const {
54 return pixel_format_; 52 return pixel_format_;
55 } 53 }
56 54
57 void CapturerFake::ClearInvalidRegion() { 55 void CapturerFake::ClearInvalidRegion() {
58 helper.ClearInvalidRegion(); 56 helper.ClearInvalidRegion();
59 } 57 }
60 58
61 void CapturerFake::InvalidateRegion(const SkRegion& invalid_region) { 59 void CapturerFake::InvalidateRegion(const SkRegion& invalid_region) {
62 helper.InvalidateRegion(invalid_region); 60 helper.InvalidateRegion(invalid_region);
63 } 61 }
64 62
65 void CapturerFake::InvalidateScreen(const gfx::Size& size) { 63 void CapturerFake::InvalidateScreen(const SkISize& size) {
66 helper.InvalidateScreen(size); 64 helper.InvalidateScreen(size);
67 } 65 }
68 66
69 void CapturerFake::InvalidateFullScreen() { 67 void CapturerFake::InvalidateFullScreen() {
70 helper.InvalidateFullScreen(); 68 helper.InvalidateFullScreen();
71 } 69 }
72 70
73 void CapturerFake::CaptureInvalidRegion(CaptureCompletedCallback* callback) { 71 void CapturerFake::CaptureInvalidRegion(CaptureCompletedCallback* callback) {
74 scoped_ptr<CaptureCompletedCallback> callback_deleter(callback); 72 scoped_ptr<CaptureCompletedCallback> callback_deleter(callback);
75 73
(...skipping 11 matching lines...) Expand all
87 scoped_refptr<CaptureData> capture_data(new CaptureData(planes, 85 scoped_refptr<CaptureData> capture_data(new CaptureData(planes,
88 size_, 86 size_,
89 pixel_format_)); 87 pixel_format_));
90 capture_data->mutable_dirty_region() = invalid_region; 88 capture_data->mutable_dirty_region() = invalid_region;
91 89
92 helper.set_size_most_recent(capture_data->size()); 90 helper.set_size_most_recent(capture_data->size());
93 91
94 callback->Run(capture_data); 92 callback->Run(capture_data);
95 } 93 }
96 94
97 const gfx::Size& CapturerFake::size_most_recent() const { 95 const SkISize& CapturerFake::size_most_recent() const {
98 return helper.size_most_recent(); 96 return helper.size_most_recent();
99 } 97 }
100 98
101 void CapturerFake::GenerateImage() { 99 void CapturerFake::GenerateImage() {
102 memset(buffers_[current_buffer_].get(), 0xff, 100 memset(buffers_[current_buffer_].get(), 0xff,
103 size_.width() * size_.height() * kBytesPerPixel); 101 size_.width() * size_.height() * kBytesPerPixel);
104 102
105 uint8* row = buffers_[current_buffer_].get() + 103 uint8* row = buffers_[current_buffer_].get() +
106 (box_pos_y_ * size_.width() + box_pos_x_) * kBytesPerPixel; 104 (box_pos_y_ * size_.width() + box_pos_x_) * kBytesPerPixel;
107 105
(...skipping 17 matching lines...) Expand all
125 row[x * kBytesPerPixel] = r; 123 row[x * kBytesPerPixel] = r;
126 row[x * kBytesPerPixel+1] = g; 124 row[x * kBytesPerPixel+1] = g;
127 row[x * kBytesPerPixel+2] = b; 125 row[x * kBytesPerPixel+2] = b;
128 row[x * kBytesPerPixel+3] = 0xff; 126 row[x * kBytesPerPixel+3] = 0xff;
129 } 127 }
130 row += bytes_per_row_; 128 row += bytes_per_row_;
131 } 129 }
132 } 130 }
133 131
134 } // namespace remoting 132 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/capturer_fake.h ('k') | remoting/host/capturer_fake_ascii.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698