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:
authorCampbell Barton <ideasman42@gmail.com>2012-09-15 15:48:20 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-15 15:48:20 +0400
commit232571c61a0120e71d980e47351d0656475dcbb5 (patch)
tree1980460d86e5743306ce676f28c5feb399248469 /source/blender/render/intern
parent219b748dfc556d9920434fc67a9d0e980e8e7fab (diff)
code cleanup: replace macro for BLI_rect size/center with inline functions.
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r--source/blender/render/intern/source/convertblender.c4
-rw-r--r--source/blender/render/intern/source/imagetexture.c14
-rw-r--r--source/blender/render/intern/source/initrender.c4
-rw-r--r--source/blender/render/intern/source/pipeline.c20
-rw-r--r--source/blender/render/intern/source/render_result.c8
-rw-r--r--source/blender/render/intern/source/rendercore.c4
-rw-r--r--source/blender/render/intern/source/shadbuf.c7
7 files changed, 32 insertions, 29 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 51e5b30a31c..81697cc55c3 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -5242,11 +5242,11 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con
/* size of 1 pixel mapped to viewplane coords */
float psize;
- psize = BLI_RCT_SIZE_X(&re->viewplane) / (float)re->winx;
+ psize = BLI_rctf_size_x(&re->viewplane) / (float)re->winx;
/* x angle of a pixel */
pixelphix = atan(psize / re->clipsta);
- psize = BLI_RCT_SIZE_Y(&re->viewplane) / (float)re->winy;
+ psize = BLI_rctf_size_y(&re->viewplane) / (float)re->winy;
/* y angle of a pixel */
pixelphiy = atan(psize / re->clipsta);
}
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 7f0484c8ee6..7a9df51e493 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -396,8 +396,8 @@ static float square_rctf(rctf *rf)
{
float x, y;
- x = BLI_RCT_SIZE_X(rf);
- y = BLI_RCT_SIZE_Y(rf);
+ x = BLI_rctf_size_x(rf);
+ y = BLI_rctf_size_y(rf);
return x * y;
}
@@ -405,7 +405,7 @@ static float clipx_rctf(rctf *rf, float x1, float x2)
{
float size;
- size = BLI_RCT_SIZE_X(rf);
+ size = BLI_rctf_size_x(rf);
if (rf->xmin<x1) {
rf->xmin = x1;
@@ -417,8 +417,8 @@ static float clipx_rctf(rctf *rf, float x1, float x2)
rf->xmin = rf->xmax;
return 0.0;
}
- else if (size!=0.0f) {
- return BLI_RCT_SIZE_X(rf) / size;
+ else if (size != 0.0f) {
+ return BLI_rctf_size_x(rf) / size;
}
return 1.0;
}
@@ -427,7 +427,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
{
float size;
- size = BLI_RCT_SIZE_Y(rf);
+ size = BLI_rctf_size_y(rf);
if (rf->ymin<y1) {
rf->ymin = y1;
@@ -441,7 +441,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
return 0.0;
}
else if (size != 0.0f) {
- return BLI_RCT_SIZE_Y(rf) / size;
+ return BLI_rctf_size_y(rf) / size;
}
return 1.0;
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 66f230a40f5..88c64b44b64 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -610,8 +610,8 @@ void initparts(Render *re, int do_crop)
}
else disprect.ymax = ymaxb;
- rectx = BLI_RCT_SIZE_X(&disprect);
- recty = BLI_RCT_SIZE_Y(&disprect);
+ rectx = BLI_rcti_size_x(&disprect);
+ recty = BLI_rcti_size_y(&disprect);
/* so, now can we add this part? */
if (rectx > 0 && recty > 0) {
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 599d91333e6..1ce66dd9ae0 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -437,8 +437,8 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
re->winy = winy;
if (disprect) {
re->disprect = *disprect;
- re->rectx = BLI_RCT_SIZE_X(disprect);
- re->recty = BLI_RCT_SIZE_Y(disprect);
+ re->rectx = BLI_rcti_size_x(disprect);
+ re->recty = BLI_rcti_size_y(disprect);
}
else {
re->disprect.xmin = re->disprect.ymin = 0;
@@ -670,15 +670,15 @@ static void *do_part_thread(void *pa_v)
float panorama_pixel_rot(Render *re)
{
float psize, phi, xfac;
- float borderfac = (float)BLI_RCT_SIZE_X(&re->disprect) / (float)re->winx;
+ float borderfac = (float)BLI_rcti_size_x(&re->disprect) / (float)re->winx;
/* size of 1 pixel mapped to viewplane coords */
- psize = BLI_RCT_SIZE_X(&re->viewplane) / (float)re->winx;
+ psize = BLI_rctf_size_x(&re->viewplane) / (float)re->winx;
/* angle of a pixel */
phi = atan(psize / re->clipsta);
/* correction factor for viewplane shifting, first calculate how much the viewplane angle is */
- xfac = borderfac * BLI_RCT_SIZE_X(&re->viewplane) / (float)re->xparts;
+ xfac = borderfac * BLI_rctf_size_x(&re->viewplane) / (float)re->xparts;
xfac = atan(0.5f * xfac / re->clipsta);
/* and how much the same viewplane angle is wrapped */
psize = 0.5f * phi * ((float)re->partx);
@@ -711,7 +711,7 @@ static RenderPart *find_next_pano_slice(Render *re, int *minx, rctf *viewplane)
float phi = panorama_pixel_rot(re);
R.panodxp = (re->winx - (best->disprect.xmin + best->disprect.xmax) ) / 2;
- R.panodxv = (BLI_RCT_SIZE_X(viewplane) * R.panodxp) / (float)(re->winx);
+ R.panodxv = (BLI_rctf_size_x(viewplane) * R.panodxp) / (float)(re->winx);
/* shift viewplane */
R.viewplane.xmin = viewplane->xmin + R.panodxv;
@@ -738,8 +738,8 @@ static RenderPart *find_next_part(Render *re, int minx)
/* find center of rendered parts, image center counts for 1 too */
for (pa = re->parts.first; pa; pa = pa->next) {
if (pa->ready) {
- centx += BLI_RCT_CENTER_X(&pa->disprect);
- centy += BLI_RCT_CENTER_Y(&pa->disprect);
+ centx += BLI_rcti_cent_x(&pa->disprect);
+ centy += BLI_rcti_cent_y(&pa->disprect);
tot++;
}
}
@@ -749,8 +749,8 @@ static RenderPart *find_next_part(Render *re, int minx)
/* closest of the non-rendering parts */
for (pa = re->parts.first; pa; pa = pa->next) {
if (pa->ready == 0 && pa->nr == 0) {
- long long int distx = centx - BLI_RCT_CENTER_X(&pa->disprect);
- long long int disty = centy - BLI_RCT_CENTER_Y(&pa->disprect);
+ long long int distx = centx - BLI_rcti_cent_x(&pa->disprect);
+ long long int disty = centy - BLI_rcti_cent_y(&pa->disprect);
distx = (long long int)sqrt(distx * distx + disty * disty);
if (distx < mindist) {
if (re->r.mode & R_PANORAMA) {
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index f11f84c9d3b..2d680bf2e81 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -422,8 +422,8 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
SceneRenderLayer *srl;
int rectx, recty, nr;
- rectx = BLI_RCT_SIZE_X(partrct);
- recty = BLI_RCT_SIZE_Y(partrct);
+ rectx = BLI_rcti_size_x(partrct);
+ recty = BLI_rcti_size_y(partrct);
if (rectx <= 0 || recty <= 0)
return NULL;
@@ -569,8 +569,8 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
}
/* border render; calculate offset for use in compositor. compo is centralized coords */
- rr->xof = re->disprect.xmin + BLI_RCT_CENTER_X(&re->disprect) - (re->winx / 2);
- rr->yof = re->disprect.ymin + BLI_RCT_CENTER_Y(&re->disprect) - (re->winy / 2);
+ rr->xof = re->disprect.xmin + BLI_rcti_cent_x(&re->disprect) - (re->winx / 2);
+ rr->yof = re->disprect.ymin + BLI_rcti_cent_y(&re->disprect) - (re->winy / 2);
return rr;
}
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 97a05e6a4c9..2161449c2d1 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -109,10 +109,10 @@ void calc_view_vector(float *view, float x, float y)
/* move x and y to real viewplane coords */
x = (x / (float)R.winx);
- view[0] = R.viewplane.xmin + x * BLI_RCT_SIZE_X(&R.viewplane);
+ view[0] = R.viewplane.xmin + x * BLI_rctf_size_x(&R.viewplane);
y = (y / (float)R.winy);
- view[1] = R.viewplane.ymin + y * BLI_RCT_SIZE_Y(&R.viewplane);
+ view[1] = R.viewplane.ymin + y * BLI_rctf_size_y(&R.viewplane);
// if (R.flag & R_SEC_FIELD) {
// if (R.r.mode & R_ODDFIELD) view[1]= (y+R.ystart)*R.ycor;
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 2d7a64bad04..bed3fb5f754 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -72,6 +72,9 @@
# define ACOMP 3
#endif
+#define RCT_SIZE_X(rct) ((rct)->xmax - (rct)->xmin)
+#define RCT_SIZE_Y(rct) ((rct)->ymax - (rct)->ymin)
+
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* defined in pipeline.c, is hardcopy of active dynamic allocated Render */
/* only to be used here in this file, it's for speed */
@@ -1506,7 +1509,7 @@ static void isb_bsp_split_init(ISBBranch *root, MemArena *mem, int level)
root->divider[1]= 0.5f*(root->box.ymin+root->box.ymax);
/* find best splitpoint */
- if (BLI_RCT_SIZE_X(&root->box) > BLI_RCT_SIZE_Y(&root->box))
+ if (RCT_SIZE_X(&root->box) > RCT_SIZE_Y(&root->box))
i = root->index = 0;
else
i = root->index = 1;
@@ -1551,7 +1554,7 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
root->divider[1]/= BSPMAX_SAMPLE;
/* find best splitpoint */
- if (BLI_RCT_SIZE_X(&root->box) > BLI_RCT_SIZE_Y(&root->box))
+ if (RCT_SIZE_X(&root->box) > RCT_SIZE_Y(&root->box))
i = root->index = 0;
else
i = root->index = 1;