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-08-22 00:34:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-22 00:34:05 +0400
commitc92ab5c3ef2d8339650eb95cd2ebba8c6956b62d (patch)
tree960acc2f94886377a44a7adc03d6afc9239ec640 /source/blender/render
parentabd031bb4eb2d2e8a1820da5a3338aa79266f6ef (diff)
code cleanup: use rect size macros
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/source/convertblender.c10
-rw-r--r--source/blender/render/intern/source/imagetexture.c16
-rw-r--r--source/blender/render/intern/source/initrender.c4
-rw-r--r--source/blender/render/intern/source/pipeline.c12
-rw-r--r--source/blender/render/intern/source/rendercore.c8
-rw-r--r--source/blender/render/intern/source/shadbuf.c12
6 files changed, 32 insertions, 30 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 6bd95e824eb..ebacdee0c97 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -5247,13 +5247,15 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con
/* precalculate amount of radians 1 pixel rotates */
if (pano) {
/* size of 1 pixel mapped to viewplane coords */
- float psize= (re->viewplane.xmax-re->viewplane.xmin)/(float)re->winx;
+ float psize;
+
+ psize = BLI_RCT_SIZE_X(&re->viewplane) / (float)re->winx;
/* x angle of a pixel */
- pixelphix= atan(psize/re->clipsta);
+ pixelphix = atan(psize / re->clipsta);
- psize= (re->viewplane.ymax-re->viewplane.ymin)/(float)re->winy;
+ psize = BLI_RCT_SIZE_Y(&re->viewplane) / (float)re->winy;
/* y angle of a pixel */
- pixelphiy= atan(psize/re->clipsta);
+ pixelphiy = atan(psize / re->clipsta);
}
zmulx= re->winx/2;
zmuly= re->winy/2;
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 0a90a55b3bc..56bf5242f36 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -396,16 +396,16 @@ static float square_rctf(rctf *rf)
{
float x, y;
- x= rf->xmax- rf->xmin;
- y= rf->ymax- rf->ymin;
- return (x*y);
+ x = BLI_RCT_SIZE_X(rf);
+ y = BLI_RCT_SIZE_Y(rf);
+ return x * y;
}
static float clipx_rctf(rctf *rf, float x1, float x2)
{
float size;
- size= rf->xmax - rf->xmin;
+ size = BLI_RCT_SIZE_X(rf);
if (rf->xmin<x1) {
rf->xmin = x1;
@@ -418,7 +418,7 @@ static float clipx_rctf(rctf *rf, float x1, float x2)
return 0.0;
}
else if (size!=0.0f) {
- return (rf->xmax - rf->xmin)/size;
+ return BLI_RCT_SIZE_X(rf) / size;
}
return 1.0;
}
@@ -427,7 +427,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
{
float size;
- size= rf->ymax - rf->ymin;
+ size = BLI_RCT_SIZE_Y(rf);
if (rf->ymin<y1) {
rf->ymin = y1;
@@ -440,8 +440,8 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
rf->ymin = rf->ymax;
return 0.0;
}
- else if (size!=0.0f) {
- return (rf->ymax - rf->ymin)/size;
+ else if (size != 0.0f) {
+ return BLI_RCT_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 cc8f6682781..7efdba77943 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)
}
else disprect.ymax = ymaxb;
- rectx = disprect.xmax - disprect.xmin;
- recty = disprect.ymax - disprect.ymin;
+ rectx = BLI_RCT_SIZE_X(&disprect);
+ recty = BLI_RCT_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 01b1f00ff98..9a524831388 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -439,8 +439,8 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
re->winy = winy;
if (disprect) {
re->disprect = *disprect;
- re->rectx = disprect->xmax - disprect->xmin;
- re->recty = disprect->ymax - disprect->ymin;
+ re->rectx = BLI_RCT_SIZE_X(disprect);
+ re->recty = BLI_RCT_SIZE_Y(disprect);
}
else {
re->disprect.xmin = re->disprect.ymin = 0;
@@ -672,15 +672,15 @@ static void *do_part_thread(void *pa_v)
float panorama_pixel_rot(Render *re)
{
float psize, phi, xfac;
- float borderfac = (float)(re->disprect.xmax - re->disprect.xmin) / (float)re->winx;
+ float borderfac = (float)BLI_RCT_SIZE_X(&re->disprect) / (float)re->winx;
/* size of 1 pixel mapped to viewplane coords */
- psize = (re->viewplane.xmax - re->viewplane.xmin) / (float)(re->winx);
+ psize = BLI_RCT_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 * ((re->viewplane.xmax - re->viewplane.xmin)) / (float)re->xparts;
+ xfac = borderfac * BLI_RCT_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);
@@ -713,7 +713,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 = ((viewplane->xmax - viewplane->xmin) * R.panodxp) / (float)(re->winx);
+ R.panodxv = (BLI_RCT_SIZE_X(viewplane) * R.panodxp) / (float)(re->winx);
/* shift viewplane */
R.viewplane.xmin = viewplane->xmin + R.panodxv;
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index a6b2c98f9d3..c009c7b7394 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -107,11 +107,11 @@ 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*(R.viewplane.xmax - R.viewplane.xmin);
+ x = (x / (float)R.winx);
+ view[0] = R.viewplane.xmin + x * BLI_RCT_SIZE_X(&R.viewplane);
- y= (y/(float)R.winy);
- view[1]= R.viewplane.ymin + y*(R.viewplane.ymax - R.viewplane.ymin);
+ y = (y / (float)R.winy);
+ view[1] = R.viewplane.ymin + y * BLI_RCT_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 44e81215c37..dce4d681ec9 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -1506,10 +1506,10 @@ 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 (root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
- i= root->index= 0;
+ if (BLI_RCT_SIZE_X(&root->box) > BLI_RCT_SIZE_Y(&root->box))
+ i = root->index = 0;
else
- i= root->index= 1;
+ i = root->index = 1;
left= root->left= BLI_memarena_alloc(mem, sizeof(ISBBranch));
right= root->right= BLI_memarena_alloc(mem, sizeof(ISBBranch));
@@ -1551,10 +1551,10 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
root->divider[1]/= BSPMAX_SAMPLE;
/* find best splitpoint */
- if (root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
- i= root->index= 0;
+ if (BLI_RCT_SIZE_X(&root->box) > BLI_RCT_SIZE_Y(&root->box))
+ i = root->index = 0;
else
- i= root->index= 1;
+ i = root->index = 1;
/* new branches */
left= root->left= BLI_memarena_alloc(mem, sizeof(ISBBranch));