OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/client/gl_cursor.h" | 5 #include "remoting/client/gl_cursor.h" |
6 | 6 |
7 #include "remoting/base/util.h" | 7 #include "remoting/base/util.h" |
8 #include "remoting/client/gl_canvas.h" | 8 #include "remoting/client/gl_canvas.h" |
9 #include "remoting/client/gl_math.h" | 9 #include "remoting/client/gl_math.h" |
10 #include "remoting/client/gl_render_layer.h" | 10 #include "remoting/client/gl_render_layer.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 current_cursor_width_ = cursor_shape.width(); | 42 current_cursor_width_ = cursor_shape.width(); |
43 current_cursor_height_ = cursor_shape.height(); | 43 current_cursor_height_ = cursor_shape.height(); |
44 current_cursor_hotspot_x_ = cursor_shape.hotspot_x(); | 44 current_cursor_hotspot_x_ = cursor_shape.hotspot_x(); |
45 current_cursor_hotspot_y_ = cursor_shape.hotspot_y(); | 45 current_cursor_hotspot_y_ = cursor_shape.hotspot_y(); |
46 | 46 |
47 SetCurrentCursorShape(size_changed); | 47 SetCurrentCursorShape(size_changed); |
48 | 48 |
49 SetCursorPosition(cursor_x_, cursor_y_); | 49 SetCursorPosition(cursor_x_, cursor_y_); |
50 } | 50 } |
51 | 51 |
52 void GlCursor::SetCursorPosition(int x, int y) { | 52 void GlCursor::SetCursorPosition(float x, float y) { |
53 cursor_x_ = x; | 53 cursor_x_ = x; |
54 cursor_y_ = y; | 54 cursor_y_ = y; |
55 if (!current_cursor_data_) { | 55 if (!current_cursor_data_) { |
56 return; | 56 return; |
57 } | 57 } |
58 std::array<float, 8> positions; | 58 std::array<float, 8> positions; |
59 FillRectangleVertexPositions( | 59 FillRectangleVertexPositions( |
60 x - current_cursor_hotspot_x_, y - current_cursor_hotspot_y_, | 60 x - current_cursor_hotspot_x_, y - current_cursor_hotspot_y_, |
61 current_cursor_width_, current_cursor_height_, &positions); | 61 current_cursor_width_, current_cursor_height_, &positions); |
62 if (layer_) { | 62 if (layer_) { |
(...skipping 29 matching lines...) Expand all Loading... |
92 layer_->SetTexture(current_cursor_data_.get(), current_cursor_width_, | 92 layer_->SetTexture(current_cursor_data_.get(), current_cursor_width_, |
93 current_cursor_height_, 0); | 93 current_cursor_height_, 0); |
94 } else { | 94 } else { |
95 layer_->UpdateTexture(current_cursor_data_.get(), 0, 0, | 95 layer_->UpdateTexture(current_cursor_data_.get(), 0, 0, |
96 current_cursor_width_, current_cursor_width_, 0); | 96 current_cursor_width_, current_cursor_width_, 0); |
97 } | 97 } |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 } // namespace remoting | 101 } // namespace remoting |
OLD | NEW |