UI: Allow Clipboard Copy/Paste Images #105833
@ -2332,8 +2332,9 @@ static uint *getClipboardImageDibV5(int *r_width, int *r_height)
|
|||||||
|
|
||||||
int offset = bitmapV5Header->bV5Size + bitmapV5Header->bV5ClrUsed * sizeof(RGBQUAD);
|
int offset = bitmapV5Header->bV5Size + bitmapV5Header->bV5ClrUsed * sizeof(RGBQUAD);
|
||||||
|
|
||||||
if (bitmapV5Header->bV5Compression == BI_BITFIELDS)
|
if (bitmapV5Header->bV5Compression == BI_BITFIELDS) {
|
||||||
offset += 12;
|
offset += 12;
|
||||||
|
}
|
||||||
BYTE *buffer = (BYTE *)bitmapV5Header + offset;
|
BYTE *buffer = (BYTE *)bitmapV5Header + offset;
|
||||||
int bitcount = bitmapV5Header->bV5BitCount;
|
int bitcount = bitmapV5Header->bV5BitCount;
|
||||||
int width = bitmapV5Header->bV5Width;
|
int width = bitmapV5Header->bV5Width;
|
||||||
|
@ -2087,8 +2087,21 @@ ImBuf *WM_clipboard_image_get(void)
|
|||||||
|
|
||||||
bool WM_clipboard_image_set(ImBuf *ibuf)
|
bool WM_clipboard_image_set(ImBuf *ibuf)
|
||||||
{
|
{
|
||||||
|
bool free_byte_buffer = false;
|
||||||
|
if (ibuf->rect == NULL) {
|
||||||
|
/* Add a byte buffer if it does not have one. */
|
||||||
IMB_rect_from_float(ibuf);
|
IMB_rect_from_float(ibuf);
|
||||||
return (bool)GHOST_putClipboardImage(ibuf->rect, ibuf->x, ibuf->y);
|
free_byte_buffer = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool success = (bool)GHOST_putClipboardImage(ibuf->rect, ibuf->x, ibuf->y);
|
||||||
|
|
||||||
|
if (free_byte_buffer) {
|
||||||
|
/* Remove the byte buffer if we added it. */
|
||||||
|
imb_freerectImBuf(ibuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
Loading…
Reference in New Issue
Block a user