Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2010-12-14 21:02:41 +0300
committerTon Roosendaal <ton@blender.org>2010-12-14 21:02:41 +0300
commit9ac68ad4abf2f4bb4fc92c292170a7cf6c29b319 (patch)
tree128b666894274882e649418e8af2a81d25ce133f /source/blender/imbuf/intern/scaling.c
parent73ea636abb6f9d4d25155f630ac606973e9bf335 (diff)
Bugfix #22040
Old bug report: Image Editor, Painting: crash when texture was visible in Material or Texture preview. Was caused by paint code freeing mipmaps. Now replaced with a mipmap tag (to be done again), and a new mipmap function that doesn't re-allocate.
Diffstat (limited to 'source/blender/imbuf/intern/scaling.c')
-rw-r--r--source/blender/imbuf/intern/scaling.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index 73dcc0c8ea9..1f50deaee2a 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -286,26 +286,16 @@ struct ImBuf *IMB_double_y(struct ImBuf *ibuf1)
return (ibuf2);
}
-
-struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1)
+/* result in ibuf2, scaling should be done correctly */
+void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
{
- struct ImBuf *ibuf2;
uchar *p1, *p2 = NULL, *dest;
float *p1f, *destf, *p2f = NULL;
int x,y;
int do_rect, do_float;
- if (ibuf1==NULL) return (0);
- if (ibuf1->rect==NULL && ibuf1->rect_float==NULL) return (0);
-
do_rect= (ibuf1->rect != NULL);
-
- if (ibuf1->x <= 1) return(IMB_half_y(ibuf1));
- if (ibuf1->y <= 1) return(IMB_half_x(ibuf1));
- ibuf2=IMB_allocImBuf((ibuf1->x)/2, (ibuf1->y)/2, ibuf1->depth, ibuf1->flags);
- if (ibuf2==NULL) return (0);
-
p1f = ibuf1->rect_float;
destf=ibuf2->rect_float;
p1 = (uchar *) ibuf1->rect;
@@ -343,9 +333,26 @@ struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1)
if (do_float) p1f+=4;
}
}
- return (ibuf2);
+
}
+struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1)
+{
+ struct ImBuf *ibuf2;
+
+ if (ibuf1==NULL) return (0);
+ if (ibuf1->rect==NULL && ibuf1->rect_float==NULL) return (0);
+
+ if (ibuf1->x <= 1) return(IMB_half_y(ibuf1));
+ if (ibuf1->y <= 1) return(IMB_half_x(ibuf1));
+
+ ibuf2=IMB_allocImBuf((ibuf1->x)/2, (ibuf1->y)/2, ibuf1->depth, ibuf1->flags);
+ if (ibuf2==NULL) return (0);
+
+ imb_onehalf_no_alloc(ibuf2, ibuf1);
+
+ return (ibuf2);
+}
/* q_scale_linear_interpolation helper functions */