diff options
author | Ton Roosendaal <ton@blender.org> | 2013-03-17 21:32:45 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2013-03-17 21:32:45 +0400 |
commit | 66a35e089a64d27bfc09c2225a530069eca05875 (patch) | |
tree | a93913c51a8fa1f2ba292402fdab49be68a398ae /source/blender/editors/screen | |
parent | ce7bde967700fc9702cab1425c39a0cfb7a094b2 (diff) |
Fix for "draw images as texture"
Zooming in on images in Image window now shows pixels again (was filtered).
Now the glaDrawPixelsTex() and glaDrawPixelsAuto() have an argument to
define if images should zoom in with linear filter, or draw pixels.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/glutil.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 6e7972200c7..8501b53afae 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -482,7 +482,7 @@ static int get_cached_work_texture(int *w_r, int *h_r) return texid; } -void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, void *rect, float scaleX, float scaleY) +void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, int zoomfilter, void *rect, float scaleX, float scaleY) { unsigned char *uc_rect = (unsigned char *) rect; float *f_rect = (float *)rect; @@ -503,6 +503,7 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, /* don't want nasty border artifacts */ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, zoomfilter); #ifdef __APPLE__ /* workaround for os x 10.5/10.6 driver bug: http://lists.apple.com/archives/Mac-opengl/2008/Jul/msg00117.html */ @@ -585,9 +586,9 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format, #endif } -void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *rect) +void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, int zoomfilter, void *rect) { - glaDrawPixelsTexScaled(x, y, img_w, img_h, format, rect, 1.0f, 1.0f); + glaDrawPixelsTexScaled(x, y, img_w, img_h, format, zoomfilter, rect, 1.0f, 1.0f); } void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int format, int type, void *rect) @@ -670,7 +671,7 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo } /* uses either DrawPixelsSafe or DrawPixelsTex, based on user defined maximum */ -void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, void *rect) +void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, int zoomfilter, void *rect) { if (U.image_gpubuffer_limit) { /* Megapixels, use float math to prevent overflow */ @@ -678,7 +679,7 @@ void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, void if (U.image_gpubuffer_limit > (int)img_size) { glColor4f(1.0, 1.0, 1.0, 1.0); - glaDrawPixelsTex(x, y, img_w, img_h, format, rect); + glaDrawPixelsTex(x, y, img_w, img_h, format, zoomfilter, rect); return; } } |