| 163 | } |
| 164 | |
| 165 | bool CursorCapture::CaptureCursorIcon(CaptureCursorBitmap *data, HICON icon) { |
| 166 | uint8_t *bitmap; |
| 167 | uint32_t height; |
| 168 | uint32_t width; |
| 169 | ICONINFO ii; |
| 170 | |
| 171 | if (!icon) { |
| 172 | return false; |
| 173 | } |
| 174 | if (!GetIconInfo(icon, &ii)) { |
| 175 | return false; |
| 176 | } |
| 177 | uint32_t bitmapSize = 0; |
| 178 | bitmap = cursor_capture_icon_bitmap(&ii, &width, &height, &bitmapSize); |
| 179 | if (bitmap) { |
| 180 | data->data_ = Data::From(std::string(bitmap, bitmap + bitmapSize)); |
| 181 | data->width_ = width; |
| 182 | data->height_ = height; |
| 183 | data->hotspot_x_ = ii.xHotspot; |
| 184 | data->hotspot_y_ = ii.yHotspot; |
| 185 | free(bitmap); |
| 186 | } else { |
| 187 | return false; |
| 188 | } |
| 189 | DeleteObject(ii.hbmColor); |
| 190 | DeleteObject(ii.hbmMask); |
| 191 | return true; |
| 192 | } |
| 193 | |
| 194 | void CursorCapture::Capture() { |
| 195 | CaptureCursorBitmap cursor_bitmap; |
nothing calls this directly
no test coverage detected