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:
authorPeter Larabell <xgl.asyliax@gmail.com>2012-07-10 08:51:08 +0400
committerPeter Larabell <xgl.asyliax@gmail.com>2012-07-10 08:51:08 +0400
commit492d9aabe0a05f3df6e9d3c046f8cb5d885f0871 (patch)
treef15664c07b9caab66a09aa85f22a6a872749377b /source/blender
parent1f9adff26fd79f03f9d6616ef70976f0fc81ee0c (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')
-rw-r--r--source/blender/blenkernel/BKE_mask.h6
-rw-r--r--source/blender/blenkernel/intern/mask.c71
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.h5
3 files changed, 82 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index ee7c13ba7cb..936628bf0e7 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -184,6 +184,12 @@ void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer,
const short do_aspect_correct, const short do_mask_aa,
const short do_feather);
+/* initialization for tiling */
+#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);
+#endif
+
#define MASKPOINT_ISSEL_ANY(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f2) & SELECT)
#define MASKPOINT_ISSEL_KNOT(p) ( (p)->bezt.f2 & SELECT)
#define MASKPOINT_ISSEL_HANDLE_ONLY(p) ( (((p)->bezt.f1 | (p)->bezt.f2) & SELECT) && (((p)->bezt.f2 & SELECT) == 0) )
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)
diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h
index df1cad3c0f6..74fd12277e8 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.h
+++ b/source/blender/compositor/operations/COM_MaskOperation.h
@@ -31,6 +31,10 @@
#include "BLI_listbase.h"
#include "IMB_imbuf_types.h"
+#ifdef __PLX_RASKTER_MT__
+#include "../../../../intern/raskter/raskter.h"
+#endif
+
/**
* Class with implementation of mask rasterization
*/
@@ -43,6 +47,7 @@ protected:
bool m_do_smooth;
bool m_do_feather;
float *m_rasterizedMask;
+
ListBase m_maskLayers;
/**