diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-06 17:54:07 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-05-06 17:54:07 +0300 |
commit | bd309603c5359443ace5af4e11d0e4bcd17e4ac6 (patch) | |
tree | ba100e31a7018e77a1410942c5cce6a0c0ba1ebb /source/blender/editors/space_image | |
parent | dd52bf8fb9b84550948bcc31002d104b6d465d89 (diff) |
Clip invisible parts of image when drawing in 2D textures and GLSL Modes
This commit avoids draw of invisible parts of image in image editor,
making it faster to re-draw the image.
Especially handy when painting on a high-res image when zoomed-in.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 0ddbb1153c0..aff0a4c3d44 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -526,7 +526,12 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar, } if ((sima->flag & (SI_SHOW_R | SI_SHOW_G | SI_SHOW_B)) == 0) { - glaDrawImBuf_glsl_ctx(C, ibuf, x, y, GL_NEAREST); + int clip_max_x, clip_max_y; + UI_view2d_view_to_region(&ar->v2d, + ar->v2d.cur.xmax, ar->v2d.cur.ymax, + &clip_max_x, &clip_max_y); + glaDrawImBuf_glsl_ctx_clipping(C, ibuf, x, y, GL_NEAREST, + 0, 0, clip_max_x, clip_max_y); } else { unsigned char *display_buffer; |