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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_image/space_image.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 5660320ae8a..1d23a409748 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -673,19 +673,17 @@ static void image_main_region_draw(const bContext *C, ARegion *region)
/* Draw Meta data of the image isn't added to the DrawManager as it is
* used in other areas as well. */
if (sima->flag & SI_DRAW_METADATA) {
- Image *ima = ED_space_image(sima);
- if (ima != NULL) {
+ void *lock;
+ /* `ED_space_image_get_zoom` temporarily locks the image, so this needs to be done before
+ * the image is locked when calling `ED_space_image_acquire_buffer`. */
+ float zoomx, zoomy;
+ ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
+ ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
+ if (ibuf) {
int x, y;
rctf frame;
- float zoomx, zoomy;
- void *lock;
-
- ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
- ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
-
BLI_rctf_init(&frame, 0.0f, ibuf->x, 0.0f, ibuf->y);
UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
-
ED_region_image_metadata_draw(x, y, ibuf, &frame, zoomx, zoomy);
ED_space_image_release_buffer(sima, ibuf, lock);
}