MCPcopy Create free account
hub / github.com/RGAA-Software/GoDesk / CaptureCursorIcon

Method CaptureCursorIcon

src/render/plugins/dda_capture/cursor_capture.cpp:165–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected