| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 plane += stride - width; | 104 plane += stride - width; |
| 105 } | 105 } |
| 106 | 106 |
| 107 return false; | 107 return false; |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace | 110 } // namespace |
| 111 | 111 |
| 112 MouseCursor* CreateMouseCursorFromHCursor(HDC dc, HCURSOR cursor) { | 112 MouseCursor* CreateMouseCursorFromHCursor(HDC dc, HCURSOR cursor) { |
| 113 ICONINFO iinfo; | 113 ICONINFO iinfo = { 0 }; |
| 114 if (!GetIconInfo(cursor, &iinfo)) { | 114 if (!GetIconInfo(cursor, &iinfo)) { |
| 115 LOG_F(LS_ERROR) << "Unable to get cursor icon info. Error = " | 115 LOG_F(LS_ERROR) << "Unable to get cursor icon info. Error = " |
| 116 << GetLastError(); | 116 << GetLastError(); |
| 117 return NULL; | 117 iinfo = { 0 }; |
| 118 assert(GetIconInfo(LoadCursor(nullptr, IDC_ARROW), &iinfo)); |
| 118 } | 119 } |
| 119 | 120 |
| 120 int hotspot_x = iinfo.xHotspot; | 121 int hotspot_x = iinfo.xHotspot; |
| 121 int hotspot_y = iinfo.yHotspot; | 122 int hotspot_y = iinfo.yHotspot; |
| 122 | 123 |
| 123 // Make sure the bitmaps will be freed. | 124 // Make sure the bitmaps will be freed. |
| 124 win::ScopedBitmap scoped_mask(iinfo.hbmMask); | 125 win::ScopedBitmap scoped_mask(iinfo.hbmMask); |
| 125 win::ScopedBitmap scoped_color(iinfo.hbmColor); | 126 win::ScopedBitmap scoped_color(iinfo.hbmColor); |
| 126 bool is_color = iinfo.hbmColor != NULL; | 127 bool is_color = iinfo.hbmColor != NULL; |
| 127 | 128 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 240 |
| 240 // Pre-multiply the resulting pixels since MouseCursor uses premultiplied | 241 // Pre-multiply the resulting pixels since MouseCursor uses premultiplied |
| 241 // images. | 242 // images. |
| 242 AlphaMul(reinterpret_cast<uint32_t*>(image->data()), width, height); | 243 AlphaMul(reinterpret_cast<uint32_t*>(image->data()), width, height); |
| 243 | 244 |
| 244 return new MouseCursor( | 245 return new MouseCursor( |
| 245 image.release(), DesktopVector(hotspot_x, hotspot_y)); | 246 image.release(), DesktopVector(hotspot_x, hotspot_y)); |
| 246 } | 247 } |
| 247 | 248 |
| 248 } // namespace webrtc | 249 } // namespace webrtc |
| OLD | NEW |