diff options
author | Peter Larabell <xgl.asyliax@gmail.com> | 2012-07-10 08:51:08 +0400 |
---|---|---|
committer | Peter Larabell <xgl.asyliax@gmail.com> | 2012-07-10 08:51:08 +0400 |
commit | 492d9aabe0a05f3df6e9d3c046f8cb5d885f0871 (patch) | |
tree | f15664c07b9caab66a09aa85f22a6a872749377b /source/blender/blenkernel/intern/mask.c | |
parent | 1f9adff26fd79f03f9d6616ef70976f0fc81ee0c (diff) |
some code refactors in raskter.c to sync it with build where mask tiling is being developed. Also adds a bit more mask tiling code.
Diffstat (limited to 'source/blender/blenkernel/intern/mask.c')
-rw-r--r-- | source/blender/blenkernel/intern/mask.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 5ff221a4011..6f6f15955cd 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -2282,6 +2282,77 @@ void BKE_mask_rasterize_layers(ListBase *masklayers, int width, int height, floa MEM_freeN(buffer_tmp); } +#ifdef __PLX_RASKTER_MT__ +void BKE_mask_init_layers(Mask *mask, struct layer_init_data *mlayer_data, int width, int height, const short do_aspect_correct){ + MaskLayer *masklay; + int numLayers=0; + int currLayer=0; + for (masklay = mask->masklayers->first; masklay; masklay = masklay->next) { + numLayers++; + } + mlayer_data = MEM_mallocN(sizeof(struct layer_init_data) * numLayers, __func__); //size correct? + + + for (masklay = mask->masklayers->first; masklay; masklay = masklay->next) { + MaskSpline *spline; + for (spline = masklay->splines.first; spline; spline = spline->next) { + float (*diff_points)[2]; + int tot_diff_point; + + float (*diff_feather_points)[2]; + int tot_diff_feather_points; + + diff_points = BKE_mask_spline_differentiate_with_resolution(spline, width, height, + &tot_diff_point); + + if (tot_diff_point) { + if (do_feather) { + diff_feather_points = + BKE_mask_spline_feather_differentiated_points_with_resolution(spline, width, height, + &tot_diff_feather_points); + } + else { + tot_diff_feather_points = 0; + diff_feather_points = NULL; + } + + if (do_aspect_correct) { + if (width != height) { + float *fp; + float *ffp; + int i; + float asp; + + if (width < height) { + fp = &diff_points[0][0]; + ffp = tot_diff_feather_points ? &diff_feather_points[0][0] : NULL; + asp = (float)width / (float)height; + } + else { + fp = &diff_points[0][1]; + ffp = tot_diff_feather_points ? &diff_feather_points[0][1] : NULL; + asp = (float)height / (float)width; + } + + for (i = 0; i < tot_diff_point; i++, fp += 2) { + (*fp) = (((*fp) - 0.5f) / asp) + 0.5f; + } + + if (tot_diff_feather_points) { + for (i = 0; i < tot_diff_feather_points; i++, ffp += 2) { + (*ffp) = (((*ffp) - 0.5f) / asp) + 0.5f; + } + } + } + } + PLX_init_base_data(mlayer_data[currLayer], diff_points, tot_diff_points, width, height); + currLayer++; + } + } + } +} +#endif + void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer, const short do_aspect_correct, const short do_mask_aa, const short do_feather) |