Cleanup: Use canonical variable name

All `ARegion` variables should be called `region` unless there is
a good reason not to, since that is the convention.
This commit is contained in:
Hans Goudey 2021-11-19 16:10:37 -05:00
parent 217d0a1524
commit cfbc9df60e
4 changed files with 14 additions and 11 deletions

View File

@ -65,7 +65,7 @@ struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc,
float *angle);
bool ED_space_clip_get_position(struct SpaceClip *sc,
struct ARegion *ar,
struct ARegion *region,
int mval[2],
float fpos[2]);
bool ED_space_clip_color_sample(struct SpaceClip *sc,

View File

@ -268,28 +268,28 @@ static bool eyedropper_cryptomatte_sample_fl(
return false;
}
ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
if (!ar) {
ARegion *region = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
if (!region) {
return false;
}
int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
float fpos[2] = {-1.0f, -1.0};
switch (sa->spacetype) {
case SPACE_IMAGE: {
SpaceImage *sima = sa->spacedata.first;
ED_space_image_get_position(sima, ar, mval, fpos);
ED_space_image_get_position(sima, region, mval, fpos);
break;
}
case SPACE_NODE: {
Main *bmain = CTX_data_main(C);
SpaceNode *snode = sa->spacedata.first;
ED_space_node_get_position(bmain, snode, ar, mval, fpos);
ED_space_node_get_position(bmain, snode, region, mval, fpos);
break;
}
case SPACE_CLIP: {
SpaceClip *sc = sa->spacedata.first;
ED_space_clip_get_position(sc, ar, mval, fpos);
ED_space_clip_get_position(sc, region, mval, fpos);
break;
}
default: {

View File

@ -272,7 +272,7 @@ ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale
}
bool ED_space_clip_get_position(struct SpaceClip *sc,
struct ARegion *ar,
struct ARegion *region,
int mval[2],
float fpos[2])
{
@ -282,7 +282,7 @@ bool ED_space_clip_get_position(struct SpaceClip *sc,
}
/* map the mouse coords to the backdrop image space */
ED_clip_mouse_pos(sc, ar, mval, fpos);
ED_clip_mouse_pos(sc, region, mval, fpos);
IMB_freeImBuf(ibuf);
return true;

View File

@ -3191,7 +3191,10 @@ void IMAGE_OT_unpack(wmOperatorType *ot)
* \{ */
/* Returns mouse position in image space. */
bool ED_space_image_get_position(SpaceImage *sima, struct ARegion *ar, int mval[2], float fpos[2])
bool ED_space_image_get_position(SpaceImage *sima,
struct ARegion *region,
int mval[2],
float fpos[2])
{
void *lock;
ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
@ -3201,7 +3204,7 @@ bool ED_space_image_get_position(SpaceImage *sima, struct ARegion *ar, int mval[
return false;
}
UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &fpos[0], &fpos[1]);
UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &fpos[0], &fpos[1]);
ED_space_image_release_buffer(sima, ibuf, lock);
return true;