OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/plugin/pepper_cursor_setter.h" | 5 #include "remoting/client/plugin/pepper_cursor_setter.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "ppapi/cpp/image_data.h" | 10 #include "ppapi/cpp/image_data.h" |
9 #include "ppapi/cpp/mouse_cursor.h" | 11 #include "ppapi/cpp/mouse_cursor.h" |
10 #include "remoting/client/empty_cursor_filter.h" | 12 #include "remoting/client/empty_cursor_filter.h" |
11 #include "remoting/proto/control.pb.h" | 13 #include "remoting/proto/control.pb.h" |
12 | 14 |
13 namespace remoting { | 15 namespace remoting { |
14 | 16 |
15 PepperCursorSetter::PepperCursorSetter(const pp::InstanceHandle& instance) | 17 PepperCursorSetter::PepperCursorSetter(const pp::InstanceHandle& instance) |
16 : instance_(instance), delegate_stub_(nullptr) { | 18 : instance_(instance), delegate_stub_(nullptr) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 if (image.is_null()) { | 61 if (image.is_null()) { |
60 LOG(WARNING) << "Unable to create cursor image"; | 62 LOG(WARNING) << "Unable to create cursor image"; |
61 return false; | 63 return false; |
62 } | 64 } |
63 | 65 |
64 // Fill the pixel data and pass the cursor to PPAPI to set. | 66 // Fill the pixel data and pass the cursor to PPAPI to set. |
65 const int kBytesPerPixel = sizeof(uint32_t); | 67 const int kBytesPerPixel = sizeof(uint32_t); |
66 const uint32_t* src_row_data = reinterpret_cast<const uint32_t*>( | 68 const uint32_t* src_row_data = reinterpret_cast<const uint32_t*>( |
67 cursor_shape.data().data()); | 69 cursor_shape.data().data()); |
68 const int bytes_per_row = size.width() * kBytesPerPixel; | 70 const int bytes_per_row = size.width() * kBytesPerPixel; |
69 uint8* dst_row_data = reinterpret_cast<uint8*>(image.data()); | 71 uint8_t* dst_row_data = reinterpret_cast<uint8_t*>(image.data()); |
70 for (int row = 0; row < size.height(); row++) { | 72 for (int row = 0; row < size.height(); row++) { |
71 memcpy(dst_row_data, src_row_data, bytes_per_row); | 73 memcpy(dst_row_data, src_row_data, bytes_per_row); |
72 src_row_data += size.width(); | 74 src_row_data += size.width(); |
73 dst_row_data += image.stride(); | 75 dst_row_data += image.stride(); |
74 } | 76 } |
75 | 77 |
76 return pp::MouseCursor::SetCursor( | 78 return pp::MouseCursor::SetCursor( |
77 instance_, PP_MOUSECURSOR_TYPE_CUSTOM, image, hotspot); | 79 instance_, PP_MOUSECURSOR_TYPE_CUSTOM, image, hotspot); |
78 } | 80 } |
79 | 81 |
80 } // namespace remoting | 82 } // namespace remoting |
OLD | NEW |