Page MenuHome
Paste P1005

Masterwork From Distant Lands
ActivePublic

Authored by Dalai Felinto (dfelinto) on Jun 14 2019, 9:05 PM.
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index bbf364960c9..126225d47d0 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -45,6 +45,7 @@
#include "BKE_constraint.h"
#include "BKE_curve.h"
#include "BKE_editmesh.h"
+#include "BKE_image.h"
#include "BKE_mball.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
@@ -921,12 +922,14 @@ static DRWShadingGroup *shgroup_theme_id_to_point(OBJECT_ShadingGroupList *sgl,
}
}
-static void image_calc_aspect(Image *ima, const int size[2], float r_image_aspect[2])
+static void image_calc_aspect(Image *ima, ImageUser *iuser, float r_image_aspect[2])
{
float ima_x, ima_y;
if (ima) {
- ima_x = size[0];
- ima_y = size[1];
+ int w, h;
+ BKE_image_get_size(ima, iuser, &w, &h);
+ ima_x = w;
+ ima_y = h;
}
else {
/* if no image, make it a 1x1 empty square, honor scale & offset */
@@ -968,27 +971,16 @@ static void DRW_shgroup_empty_image(OBJECT_Shaders *sh_data,
return;
}
- /* Calling 'BKE_image_get_size' may free the texture. Get the size from 'tex' instead,
- * see: T59347 */
- int size[2] = {0};
-
const bool use_alpha_blend = (ob->empty_image_flag & OB_EMPTY_IMAGE_USE_ALPHA_BLEND) != 0;
GPUTexture *tex = NULL;
Image *ima = ob->data;
if (ima != NULL) {
tex = GPU_texture_from_blender(ima, ob->iuser, GL_TEXTURE_2D);
- if (tex) {
- size[0] = GPU_texture_width(tex);
- size[1] = GPU_texture_height(tex);
- }
}
- CLAMP_MIN(size[0], 1);
- CLAMP_MIN(size[1], 1);
-
float image_aspect[2];
- image_calc_aspect(ob->data, size, image_aspect);
+ image_calc_aspect(ob->data, ob->iuser, image_aspect);
char depth_mode;
if (DRW_state_is_depth()) {

Event Timeline

Dalai Felinto (dfelinto) changed the title of this paste from untitled to Masterwork From Distant Lands.