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/display/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/display/gl_canvas.h" |
9 #include "remoting/client/gl_math.h" | 9 #include "remoting/client/display/gl_math.h" |
10 #include "remoting/client/gl_render_layer.h" | 10 #include "remoting/client/display/gl_render_layer.h" |
11 #include "remoting/client/gl_texture_ids.h" | 11 #include "remoting/client/display/gl_texture_ids.h" |
12 #include "remoting/proto/control.pb.h" | 12 #include "remoting/proto/control.pb.h" |
13 #include "third_party/libyuv/include/libyuv/convert_argb.h" | 13 #include "third_party/libyuv/include/libyuv/convert_argb.h" |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 | 16 |
17 namespace { | 17 namespace { |
18 const int kDefaultCursorDataSize = 32 * 32 * GlRenderLayer::kBytesPerPixel; | 18 const int kDefaultCursorDataSize = 32 * 32 * GlRenderLayer::kBytesPerPixel; |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 GlCursor::GlCursor() {} | 21 GlCursor::GlCursor() {} |
22 | 22 |
23 GlCursor::~GlCursor() {} | 23 GlCursor::~GlCursor() {} |
24 | 24 |
25 void GlCursor::SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) { | 25 void GlCursor::SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) { |
26 int data_size = cursor_shape.width() * cursor_shape.height() * | 26 int data_size = cursor_shape.width() * cursor_shape.height() * |
27 GlRenderLayer::kBytesPerPixel; | 27 GlRenderLayer::kBytesPerPixel; |
28 if (current_cursor_data_size_ < data_size) { | 28 if (current_cursor_data_size_ < data_size) { |
29 current_cursor_data_size_ = | 29 current_cursor_data_size_ = |
30 kDefaultCursorDataSize > data_size ? kDefaultCursorDataSize : data_size; | 30 kDefaultCursorDataSize > data_size ? kDefaultCursorDataSize : data_size; |
31 current_cursor_data_.reset(new uint8_t[current_cursor_data_size_]); | 31 current_cursor_data_.reset(new uint8_t[current_cursor_data_size_]); |
32 } | 32 } |
33 int stride = cursor_shape.width() * GlRenderLayer::kBytesPerPixel; | 33 int stride = cursor_shape.width() * GlRenderLayer::kBytesPerPixel; |
34 libyuv::ABGRToARGB( | 34 libyuv::ABGRToARGB( |
35 reinterpret_cast<const uint8_t*>(cursor_shape.data().data()), stride, | 35 reinterpret_cast<const uint8_t*>(cursor_shape.data().data()), stride, |
36 current_cursor_data_.get(), stride, cursor_shape.width(), | 36 current_cursor_data_.get(), stride, cursor_shape.width(), |
37 cursor_shape.height()); | 37 cursor_shape.height()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |