Fix T65812: Image empty has wrong aspect with limit texture size
This commit is contained in:
parent
d51b74f9e3
commit
a699a9680b
Notes:
blender-bot
2024-04-11 14:26:06 +02:00
Referenced by issue #65812, Image Empty: Wrong aspect ratio if Texture Size Limit is used
|
@ -1008,8 +1008,8 @@ static void DRW_shgroup_empty_image(OBJECT_Shaders *sh_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);
|
||||
size[0] = GPU_texture_orig_width(tex);
|
||||
size[1] = GPU_texture_orig_height(tex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -245,6 +245,9 @@ int GPU_texture_detach_framebuffer(GPUTexture *tex, struct GPUFrameBuffer *fb);
|
|||
int GPU_texture_target(const GPUTexture *tex);
|
||||
int GPU_texture_width(const GPUTexture *tex);
|
||||
int GPU_texture_height(const GPUTexture *tex);
|
||||
int GPU_texture_orig_width(const GPUTexture *tex);
|
||||
int GPU_texture_orig_height(const GPUTexture *tex);
|
||||
void GPU_texture_orig_size_set(GPUTexture *tex, int w, int h);
|
||||
int GPU_texture_layers(const GPUTexture *tex);
|
||||
eGPUTextureFormat GPU_texture_format(const GPUTexture *tex);
|
||||
int GPU_texture_samples(const GPUTexture *tex);
|
||||
|
|
|
@ -501,6 +501,9 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, int textarget
|
|||
BKE_image_release_ibuf(ima, ibuf, NULL);
|
||||
|
||||
*tex = GPU_texture_from_bindcode(textarget, bindcode);
|
||||
|
||||
GPU_texture_orig_size_set(*tex, ibuf->x, ibuf->y);
|
||||
|
||||
return *tex;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ typedef enum eGPUTextureFormatFlag {
|
|||
/* GPUTexture */
|
||||
struct GPUTexture {
|
||||
int w, h, d; /* width/height/depth */
|
||||
int orig_w, orig_h; /* width/height (of source data), optional. */
|
||||
int number; /* number for multitexture binding */
|
||||
int refcount; /* reference count */
|
||||
GLenum target; /* GL_TEXTURE_* */
|
||||
|
@ -1778,6 +1779,22 @@ int GPU_texture_height(const GPUTexture *tex)
|
|||
return tex->h;
|
||||
}
|
||||
|
||||
int GPU_texture_orig_width(const GPUTexture *tex)
|
||||
{
|
||||
return tex->orig_w;
|
||||
}
|
||||
|
||||
int GPU_texture_orig_height(const GPUTexture *tex)
|
||||
{
|
||||
return tex->orig_h;
|
||||
}
|
||||
|
||||
void GPU_texture_orig_size_set(GPUTexture *tex, int w, int h)
|
||||
{
|
||||
tex->orig_w = w;
|
||||
tex->orig_h = h;
|
||||
}
|
||||
|
||||
int GPU_texture_layers(const GPUTexture *tex)
|
||||
{
|
||||
return tex->d;
|
||||
|
|
Loading…
Reference in New Issue