Fix T65812: Image empty has wrong aspect with limit texture size
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user