Fix: Targa with Palette Shows Grayscale in Viewport. #106047

Merged
Jeroen Bakker merged 3 commits from Jeroen-Bakker/blender:image-target-draws-grayscale into main 2023-03-24 07:46:44 +01:00

3 Commits

Author SHA1 Message Date
Jeroen Bakker ded52ca25f Remove unneeded comment. 2023-03-24 07:45:25 +01:00
Jeroen Bakker df6dde1834 Don't be stupid and remove shift left/right. 2023-03-23 15:36:16 +01:00
Jeroen Bakker 454030f542 Fix: Targa using a palette can display as grayscale in Viewport.
Viewport assumes that when the number of planes of the image
buffer is less or equal to 8 it is a gray scale image. In that
case it will optimize the texture to be stored as a grayscale
image on the GPU.

When using a targa file with a palette, the bitplanes were not
extracted from the actual colors, but from the number of colors
that were present in the palette.

Image buffers don't support palettes so that doesn't make sense.
This PR uses the bitdepth of the actual colors inside the palette
to identify the number of planes to use in the image buffer.

Fix: #105976
2023-03-23 15:30:12 +01:00