diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-17 11:31:57 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-17 11:31:57 +0300 |
commit | 9d2292ef7e39756d249797a6b972076f096f2750 (patch) | |
tree | b25fc88001a820ca64c2a05edd14bc902042122a /source/blender/editors/space_image | |
parent | c42e38299434b44ee9fd30c250a615915de58d01 (diff) |
misc maintenance changes
- metaball tessellation functuion was calculating density when it didn't need to.
- image drawing was using a float as a loop counter, in extreme cases this could cause an infinite loop.
- remove/comment unused vars.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index e2d58b1df5f..22ca549637e 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -473,13 +473,18 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene, 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(); + const double time_current= PIL_check_seconds_timer(); + + const int xmax= ceil(ar->v2d.cur.xmax); + const int ymax= ceil(ar->v2d.cur.ymax); + const int xmin= floor(ar->v2d.cur.xmin); + const int ymin= floor(ar->v2d.cur.ymin); + + int x; - 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) { + for(x=xmin; x<xmax; x++) { + int y; + for(y=ymin; y<ymax; y++) { if(ima && (ima->tpageflag & IMA_TILES)) draw_image_buffer_tiled(sima, ar, scene, ima, ibuf, x, y, zoomx, zoomy); else |