diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-23 04:45:41 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-23 04:45:41 +0400 |
commit | 9fd605c0502d991af30a4d4b91681b4116658f45 (patch) | |
tree | 26cda9f5361b94fdf3c1d53edd72b0ee128e450f /source/blender/editors/space_image/image_draw.c | |
parent | e2b6cea3b95ca41854661726ccea684421738c8f (diff) |
2.5: Image Editor
* Menu and header more complete now.
* Clean up Game Properties panel and moved View Properties panel
to python.
* Fix some drawing issues when combining tiles, repeat and aspect,
some also from 2.4x, these options didn't work together 100%.
Diffstat (limited to 'source/blender/editors/space_image/image_draw.c')
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 122e298baaa..e61931f2fad 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -311,12 +311,14 @@ static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, fl // glColorMask(1, 1, 1, 1); } +#ifdef WITH_LCMS static void sima_draw_colorcorrected_pixels(float x1, float y1, ImBuf *ibuf) { colorcorrection_do_ibuf(ibuf, "MONOSCNR.ICM"); /* path is hardcoded here, find some place better */ glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->crect); } +#endif static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *recti) { @@ -450,7 +452,7 @@ static unsigned int *get_part_from_ibuf(ImBuf *ibuf, short startx, short starty, return rectmain; } -static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, ImBuf *ibuf, float zoomx, float zoomy) +static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, ImBuf *ibuf, float fx, float fy, float zoomx, float zoomy) { unsigned int *rect; int dx, dy, sx, sy, x, y; @@ -477,7 +479,7 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, I /* draw repeated */ for(sy=0; sy+dy<=ibuf->y; sy+= dy) { for(sx=0; sx+dx<=ibuf->x; sx+= dx) { - UI_view2d_view_to_region(&ar->v2d, (float)sx/(float)ibuf->x, (float)sy/(float)ibuf->y, &x, &y); + UI_view2d_to_region_no_clip(&ar->v2d, fx + (float)sx/(float)ibuf->x, fy + (float)sy/(float)ibuf->y, &x, &y); glaDrawPixelsSafe(x, y, dx, dy, dx, GL_RGBA, GL_UNSIGNED_BYTE, rect); } @@ -488,16 +490,19 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, I MEM_freeN(rect); } -static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *scene, ImBuf *ibuf, float zoomx, float zoomy) +static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *scene, Image *ima, ImBuf *ibuf, float zoomx, float zoomy) { float x, y; double time_current; time_current = PIL_check_seconds_timer(); - for(x=ar->v2d.cur.xmin; x<ar->v2d.cur.xmax; x += zoomx) { - for(y=ar->v2d.cur.ymin; y<ar->v2d.cur.ymax; y += zoomy) { - draw_image_buffer(sima, ar, scene, ibuf, x, y, zoomx, zoomy); + for(x=floor(ar->v2d.cur.xmin); x<ar->v2d.cur.xmax; x += 1.0f) { + for(y=floor(ar->v2d.cur.ymin); y<ar->v2d.cur.ymax; y += 1.0f) { + if(ima && (ima->tpageflag & IMA_TILES)) + draw_image_buffer_tiled(sima, ar, ima, ibuf, x, y, zoomx, zoomy); + else + draw_image_buffer(sima, ar, scene, ibuf, x, y, zoomx, zoomy); /* only draw until running out of time */ if((PIL_check_seconds_timer() - time_current) > 0.25) @@ -667,9 +672,9 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene) if(ibuf==NULL) draw_image_grid(ar, zoomx, zoomy); else if(sima->flag & SI_DRAW_TILE) - draw_image_buffer_repeated(sima, ar, scene, ibuf, zoomx, zoomy); + draw_image_buffer_repeated(sima, ar, scene, ima, ibuf, zoomx, zoomy); else if(ima && (ima->tpageflag & IMA_TILES)) - draw_image_buffer_tiled(sima, ar, ima, ibuf, zoomx, zoomy); + draw_image_buffer_tiled(sima, ar, ima, ibuf, 0.0f, 0.0, zoomx, zoomy); else draw_image_buffer(sima, ar, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy); @@ -699,12 +704,5 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene) } } #endif - -#if 0 - /* it is important to end a view in a transform compatible with buttons */ - bwin_scalematrix(sa->win, sima->blockscale, sima->blockscale, sima->blockscale); - if(!(G.rendering && show_render)) - image_blockhandlers(sa); -#endif } |