diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-20 17:01:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-20 17:01:30 +0300 |
commit | 3414a16705c1334d9685f3ab2ba5b04e2824a4dc (patch) | |
tree | ceefe773cbdf5093f29f7eb70f7d958063ae14c5 | |
parent | e6609deba2b601bbd22d17c246eab2265ccd20a1 (diff) | |
parent | d312dbea2d9f0ca08149d0467eb103d9f3cbf151 (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 6ca037bfb5c..3b896d0f6ed 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -677,10 +677,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; @@ -700,20 +700,19 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo az->alpha = 1.0f; } else { - int mouse_radius, spot_radius, fadein_radius, fadeout_radius; - 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; |