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 "ui/ozone/platform/dri/dri_surface_factory.h" | 5 #include "ui/ozone/platform/dri/dri_surface_factory.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 new DriSurface(window_manager_->GetWindowDelegate(widget), drm_)); | 103 new DriSurface(window_manager_->GetWindowDelegate(widget), drm_)); |
104 } | 104 } |
105 | 105 |
106 bool DriSurfaceFactory::LoadEGLGLES2Bindings( | 106 bool DriSurfaceFactory::LoadEGLGLES2Bindings( |
107 AddGLLibraryCallback add_gl_library, | 107 AddGLLibraryCallback add_gl_library, |
108 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { | 108 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { |
109 return false; | 109 return false; |
110 } | 110 } |
111 | 111 |
112 void DriSurfaceFactory::SetHardwareCursor(gfx::AcceleratedWidget widget, | 112 void DriSurfaceFactory::SetHardwareCursor(gfx::AcceleratedWidget widget, |
113 const SkBitmap& image, | 113 const std::vector<SkBitmap>& bitmaps, |
114 const gfx::Point& location) { | 114 const gfx::Point& location, |
115 cursor_bitmap_ = image; | 115 int frame_delay_ms) { |
| 116 cursor_bitmaps_ = bitmaps; |
116 cursor_location_ = location; | 117 cursor_location_ = location; |
| 118 cursor_frame_delay_ms_ = frame_delay_ms; |
| 119 |
| 120 if (bitmaps.size() > 1) |
| 121 NOTIMPLEMENTED(); // No animation of animated cursors. |
117 | 122 |
118 if (state_ != INITIALIZED) | 123 if (state_ != INITIALIZED) |
119 return; | 124 return; |
120 | 125 |
121 ResetCursor(widget); | 126 ResetCursor(widget); |
122 } | 127 } |
123 | 128 |
124 void DriSurfaceFactory::MoveHardwareCursor(gfx::AcceleratedWidget widget, | 129 void DriSurfaceFactory::MoveHardwareCursor(gfx::AcceleratedWidget widget, |
125 const gfx::Point& location) { | 130 const gfx::Point& location) { |
126 cursor_location_ = location; | 131 cursor_location_ = location; |
127 | 132 |
128 if (state_ != INITIALIZED) | 133 if (state_ != INITIALIZED) |
129 return; | 134 return; |
130 | 135 |
131 HardwareDisplayController* controller = | 136 HardwareDisplayController* controller = |
132 window_manager_->GetWindowDelegate(widget)->GetController(); | 137 window_manager_->GetWindowDelegate(widget)->GetController(); |
133 if (controller) | 138 if (controller) |
134 controller->MoveCursor(location); | 139 controller->MoveCursor(location); |
135 } | 140 } |
136 | 141 |
137 //////////////////////////////////////////////////////////////////////////////// | 142 //////////////////////////////////////////////////////////////////////////////// |
138 // DriSurfaceFactory private | 143 // DriSurfaceFactory private |
139 | 144 |
140 void DriSurfaceFactory::ResetCursor(gfx::AcceleratedWidget widget) { | 145 void DriSurfaceFactory::ResetCursor(gfx::AcceleratedWidget widget) { |
141 HardwareDisplayController* controller = | 146 HardwareDisplayController* controller = |
142 window_manager_->GetWindowDelegate(widget)->GetController(); | 147 window_manager_->GetWindowDelegate(widget)->GetController(); |
143 | 148 |
144 if (!cursor_bitmap_.empty()) { | 149 if (cursor_bitmaps_.size()) { |
145 // Draw new cursor into backbuffer. | 150 // Draw new cursor into backbuffer. |
146 UpdateCursorImage(cursor_buffers_[cursor_frontbuffer_ ^ 1].get(), | 151 UpdateCursorImage(cursor_buffers_[cursor_frontbuffer_ ^ 1].get(), |
147 cursor_bitmap_); | 152 cursor_bitmaps_[0]); |
148 | 153 |
149 // Reset location & buffer. | 154 // Reset location & buffer. |
150 if (controller) { | 155 if (controller) { |
151 controller->MoveCursor(cursor_location_); | 156 controller->MoveCursor(cursor_location_); |
152 controller->SetCursor(cursor_buffers_[cursor_frontbuffer_ ^ 1]); | 157 controller->SetCursor(cursor_buffers_[cursor_frontbuffer_ ^ 1]); |
153 cursor_frontbuffer_ ^= 1; | 158 cursor_frontbuffer_ ^= 1; |
154 } | 159 } |
155 } else { | 160 } else { |
156 // No cursor set. | 161 // No cursor set. |
157 if (controller) | 162 if (controller) |
158 controller->UnsetCursor(); | 163 controller->UnsetCursor(); |
159 } | 164 } |
160 } | 165 } |
161 | 166 |
162 } // namespace ui | 167 } // namespace ui |
OLD | NEW |