Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan-Hall <Ethan1080>2022-03-09 16:53:01 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-03-09 16:53:07 +0300
commitef3d76fbaa37110fd857f3aabff815600e43915a (patch)
tree0f14ff80884fcf5845c2fda2480d5ce156b6ad30 /source/blender/blenkernel
parent6be665926c581a7a2dac82c50d75bb530baee863 (diff)
Fix wrong detection of alpha for grayscale images, after recent changes
Differential Revision: https://developer.blender.org/D14286
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_image.h2
-rw-r--r--source/blender/blenkernel/intern/image.c11
2 files changed, 5 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index b3001ecc880..a5a2d57f9d3 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -371,7 +371,7 @@ void BKE_image_merge(struct Main *bmain, struct Image *dest, struct Image *sourc
bool BKE_image_scale(struct Image *image, int width, int height);
/**
- * Check if texture has alpha (depth=32).
+ * Check if texture has alpha (planes == 32 || planes == 16).
*/
bool BKE_image_has_alpha(struct Image *image);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 8a212ed0d7d..e01f8cb76c8 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -5853,17 +5853,14 @@ void BKE_image_user_file_path_ex(ImageUser *iuser, Image *ima, char *filepath, b
BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(&ima->id));
}
-bool BKE_image_has_alpha(struct Image *image)
+bool BKE_image_has_alpha(Image *image)
{
- ImBuf *ibuf;
void *lock;
- int planes;
-
- ibuf = BKE_image_acquire_ibuf(image, NULL, &lock);
- planes = (ibuf ? ibuf->planes : 0);
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, &lock);
+ const int planes = (ibuf ? ibuf->planes : 0);
BKE_image_release_ibuf(image, ibuf, lock);
- if (planes == 32) {
+ if (planes == 32 || planes == 16) {
return true;
}