Skip to content

Commit

Permalink
[osx] Fix number of bits used per channel/sample on 32-bit RGB images…
Browse files Browse the repository at this point in the history
… (without alpha)

Fix aseprite/aseprite#4102
  • Loading branch information
dacap committed Oct 25, 2023
1 parent 4dee1ea commit 974e265
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clip_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ bool get_image_from_clipboard(image* output_img,

// We need three samples for Red/Green/Blue
if (bitmap.samplesPerPixel >= 3) {
int bits_per_sample = bitmap.bitsPerPixel / bitmap.samplesPerPixel;
// Here we are guessing the bits per sample (generally 8, not
// sure how many bits per sample macOS uses for 16bpp
// NSBitmapFormat or if this format is even used).
int bits_per_sample = (bitmap.bitsPerPixel == 16 ? 5: 8);
int bits_shift = 0;

// With alpha
Expand Down

0 comments on commit 974e265

Please sign in to comment.