diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-06-24 15:09:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-06-24 15:10:43 +0300 |
commit | a699a9680bf88cef76fcf6be89d62bdeb532bd4c (patch) | |
tree | 728173ce40b90f16e3830bb3fe7276ade4a9b98e /source/blender/gpu | |
parent | d51b74f9e3de4379dc675e08df8766b37105ee0e (diff) |
Fix T65812: Image empty has wrong aspect with limit texture size
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_texture.h | 3 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 3 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.c | 17 |
3 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h index d5e763987cb..4397234543b 100644 --- a/source/blender/gpu/GPU_texture.h +++ b/source/blender/gpu/GPU_texture.h @@ -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); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 9a341631833..d1d5e1d89a2 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -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; } diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 58d0dd5576f..54e93c361ca 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -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; |