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

Side by Side Diff: remoting/client/mouse_input_filter.cc

Issue 8985007: Refactoring of the client-side input pipeline and scaling dimension management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "remoting/client/mouse_input_filter.h"
6
7 #include "remoting/proto/event.pb.h"
8
9 namespace remoting {
10
11 MouseInputFilter::MouseInputFilter(protocol::InputStub* input_stub)
12 : input_stub_(input_stub)
13 {
Sergey Ulanov 2011/12/20 00:05:35 Here and in all other methods: { should not be wra
Wez 2011/12/20 07:14:14 Done.
Wez 2011/12/20 07:14:14 Done.
14 input_size_.setEmpty();
15 output_size_.setEmpty();
16 }
17
18 MouseInputFilter::~MouseInputFilter()
19 {
20 }
21
22 void MouseInputFilter::InjectKeyEvent(const protocol::KeyEvent& event)
23 {
24 input_stub_->InjectKeyEvent(event);
25 }
26
27 void MouseInputFilter::InjectMouseEvent(const protocol::MouseEvent& event)
28 {
29 if (input_size_.isZero() || output_size_.isZero())
30 return;
31
32 protocol::MouseEvent out_event(event);
33 if (out_event.has_x()) {
34 out_event.set_x((out_event.x() * output_size_.width()) /
Sergey Ulanov 2011/12/20 00:05:35 I think this code would be more readable if you de
Wez 2011/12/20 07:14:14 Performance shouldn't be affected, since x() and s
35 input_size_.width());
36 out_event.set_x(std::max(0, std::min(output_size_.width()-1,
Sergey Ulanov 2011/12/20 00:05:35 spaces around -
Wez 2011/12/20 07:14:14 Done.
37 out_event.x())));
38 }
39 if (out_event.has_y()) {
40 out_event.set_y((out_event.y() * output_size_.height()) /
41 input_size_.height());
42 out_event.set_y(std::max(0, std::min(output_size_.height()-1,
43 out_event.y())));
44 }
45
46 input_stub_->InjectMouseEvent(out_event);
47 }
48
49 void MouseInputFilter::SetInputDimensions(const SkISize& size)
50 {
51 input_size_ = size;
52 }
53
54 void MouseInputFilter::SetOutputDimensions(const SkISize& size)
55 {
56 output_size_ = size;
57 }
58
59 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698