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>2018-06-20 16:58:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-20 16:58:46 +0300
commitd312dbea2d9f0ca08149d0467eb103d9f3cbf151 (patch)
treeece26506902db954c0f8bc5b718015088a19c93d /source/blender/editors/screen
parent372754c164793e8e1b0d8a7f1f0dbe9fd432fdf3 (diff)
Cleanup: naming (make it clear vars are squared)
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/screen_edit.c9
-rw-r--r--source/blender/editors/screen/screen_ops.c25
2 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 3306003f18c..82552c35786 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1104,10 +1104,13 @@ void ED_screen_set_subwinactive(bContext *C, const wmEvent *event)
int oldswin = scr->subwinactive;
for (sa = scr->areabase.first; sa; sa = sa->next) {
- if (event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
- if (event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
- if (NULL == ED_area_actionzone_refresh_xy(sa, &event->x))
+ if (event->x > sa->totrct.xmin && event->x < sa->totrct.xmax) {
+ if (event->y > sa->totrct.ymin && event->y < sa->totrct.ymax) {
+ if (NULL == ED_area_actionzone_refresh_xy(sa, &event->x)) {
break;
+ }
+ }
+ }
}
if (sa) {
/* make overlap active when mouse over */
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index a77307af192..1f5b51d211c 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -673,10 +673,10 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
if (BLI_rcti_isect_pt_v(&az->rect, xy)) {
if (az->type == AZONE_AREA) {
/* no triangle intersect but a hotspot circle based on corner */
- int radius = (xy[0] - az->x1) * (xy[0] - az->x1) + (xy[1] - az->y1) * (xy[1] - az->y1);
-
- if (radius <= AZONESPOT * AZONESPOT)
+ int radius_sq = SQUARE(xy[0] - az->x1) + SQUARE(xy[1] - az->y1);
+ if (radius_sq <= SQUARE(AZONESPOT)) {
break;
+ }
}
else if (az->type == AZONE_REGION) {
break;
@@ -692,26 +692,23 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
}
}
else {
- int mouse_radius, spot_radius, fadein_radius, fadeout_radius;
-
- fullscreen_click_rcti_init(&click_rect, az->x1, az->y1, az->x2, az->y2);
if (click_isect) {
az->alpha = 1.0f;
}
else {
- mouse_radius = (xy[0] - az->x2) * (xy[0] - az->x2) + (xy[1] - az->y2) * (xy[1] - az->y2);
- spot_radius = AZONESPOT * AZONESPOT;
- fadein_radius = AZONEFADEIN * AZONEFADEIN;
- fadeout_radius = AZONEFADEOUT * AZONEFADEOUT;
+ const int mouse_sq = SQUARE(xy[0] - az->x2) + SQUARE(xy[1] - az->y2);
+ const int spot_sq = SQUARE(AZONESPOT);
+ const int fadein_sq = SQUARE(AZONEFADEIN);
+ const int fadeout_sq = SQUARE(AZONEFADEOUT);
- if (mouse_radius < spot_radius) {
+ if (mouse_sq < spot_sq) {
az->alpha = 1.0f;
}
- else if (mouse_radius < fadein_radius) {
+ else if (mouse_sq < fadein_sq) {
az->alpha = 1.0f;
}
- else if (mouse_radius < fadeout_radius) {
- az->alpha = 1.0f - ((float)(mouse_radius - fadein_radius)) / ((float)(fadeout_radius - fadein_radius));
+ else if (mouse_sq < fadeout_sq) {
+ az->alpha = 1.0f - ((float)(mouse_sq - fadein_sq)) / ((float)(fadeout_sq - fadein_sq));
}
else {
az->alpha = 0.0f;