Cleanup: move comments wrapped with MultiLine control statements

In some cases comments at the end of control statements were wrapped
onto new lines which made it read as if they applied to the next line
instead of the (now) previous line.

Relocate comments to the previous line or in some cases the end of the
line (before the brace) to avoid confusion.

Note that in quite a few cases these blocks didn't read well
even before MultiLine was used as comments after the brace caused
wrapping across multiple lines in a way that didn't follow
formatting used everywhere else.
This commit is contained in:
2023-05-02 09:32:44 +10:00
parent 6859bb6e67
commit a0db0a5580
20 changed files with 202 additions and 199 deletions

View File

@@ -1095,8 +1095,8 @@ void MetalDevice::tex_alloc(device_texture &mem)
}
MTLStorageMode storage_mode = MTLStorageModeManaged;
if (@available(macos 10.15, *)) {
if ([mtlDevice hasUnifiedMemory] && device_vendor != METAL_GPU_INTEL)
{ /* Intel GPUs don't support MTLStorageModeShared for MTLTextures */
/* Intel GPUs don't support MTLStorageModeShared for MTLTextures. */
if ([mtlDevice hasUnifiedMemory] && device_vendor != METAL_GPU_INTEL) {
storage_mode = MTLStorageModeShared;
}
}

View File

@@ -288,12 +288,14 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
fresnel->color = rgb_to_spectrum(base_color);
/* setup bsdf */
if (distribution == CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID || roughness <= 0.075f)
{ /* use single-scatter GGX */
/* Use single-scatter GGX. */
if (distribution == CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID || roughness <= 0.075f) {
sd->flag |= bsdf_microfacet_ggx_setup(bsdf);
bsdf_microfacet_setup_fresnel_principledv1(bsdf, sd, fresnel);
}
else { /* use multi-scatter GGX */
} /* Use multi-scatter GGX. */
else {
bsdf->fresnel = fresnel;
sd->flag |= bsdf_microfacet_multi_ggx_fresnel_setup(bsdf, sd);
}
@@ -313,8 +315,9 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
Spectrum glass_weight = weight * final_transmission;
float3 cspec0 = base_color * specular_tint + make_float3(1.0f - specular_tint);
if (roughness <= 5e-2f || distribution == CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID)
{ /* use single-scatter GGX */
/* Use single-scatter GGX. */
if (roughness <= 5e-2f || distribution == CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID) {
float refl_roughness = roughness;
/* reflection */
@@ -377,8 +380,8 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
sd->flag |= bsdf_microfacet_ggx_refraction_setup(bsdf);
}
}
}
else { /* use multi-scatter GGX */
} /* Use multi-scatter GGX. */
else {
ccl_private MicrofacetBsdf *bsdf = (ccl_private MicrofacetBsdf *)bsdf_alloc(
sd, sizeof(MicrofacetBsdf), glass_weight);
ccl_private FresnelPrincipledV1 *fresnel =

View File

@@ -142,8 +142,8 @@ static void read_indices(const tinygltf::Accessor &accessor,
}
constexpr size_t component_size_bytes = sizeof(TSrcIndex);
if (buffer_view.byteStride != 0 && buffer_view.byteStride != component_size_bytes)
{ /* Index buffer must be packed per glTF spec. */
/* Index buffer must be packed per glTF spec. */
if (buffer_view.byteStride != 0 && buffer_view.byteStride != component_size_bytes) {
throw GHOST_XrException(
"glTF: Accessor for indices uses bufferview with invalid 'byteStride'.");
}

View File

@@ -33,8 +33,8 @@ static void bl_locale_global_cache()
locale_global = std::locale();
facet_global = &std::use_facet<char_message_facet>(locale_global);
}
catch (const std::bad_cast &e)
{ /* if std::has_facet<char_message_facet>(l) == false, LC_ALL = "C" case */
/* `if std::has_facet<char_message_facet>(l) == false`, LC_ALL = "C" case. */
catch (const std::bad_cast &e) {
#ifndef NDEBUG
std::cout << "bl_locale_global_cache:" << e.what() << " \n";
#endif

View File

@@ -147,9 +147,10 @@ static bool rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
priority = 1.0f;
}
/* then use that effector */
if (priority > (rule->type == eBoidRuleType_Avoid ? gabr->fear_factor : 0.0f))
{ /* with avoid, factor is "fear factor" */
/* Then use that effector. */
/* With avoid, factor is "fear factor". */
if (priority > (rule->type == eBoidRuleType_Avoid ? gabr->fear_factor : 0.0f)) {
Object *eob = eff->ob;
PartDeflect *pd = eff->pd;
float surface = (pd && pd->shape == PFIELD_SHAPE_SURFACE) ? 1.0f : 0.0f;

View File

@@ -2949,10 +2949,10 @@ void BKE_image_walk_all_users(
{
image_walk_id_all_users(&cam->id, false, customdata, callback);
}
/* Only ever 1 `wm`. */
for (wmWindowManager *wm = static_cast<wmWindowManager *>(mainp->wm.first); wm;
wm = static_cast<wmWindowManager *>(wm->id.next))
{ /* only 1 wm */
{
image_walk_id_all_users(&wm->id, false, customdata, callback);
}
}

View File

@@ -3890,8 +3890,8 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
ParticleTarget *pt = psys->targets.first;
psys_update_particle_bvhtree(psys, cfra);
for (; pt; pt = pt->next)
{ /* Updating others systems particle tree for fluid-fluid interaction */
/* Updating others systems particle tree for fluid-fluid interaction. */
for (; pt; pt = pt->next) {
if (pt->ob) {
psys_update_particle_bvhtree(BLI_findlink(&pt->ob->particlesystem, pt->psys - 1), cfra);
}

View File

@@ -2062,8 +2062,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene,
kd = sb->goalfrict * sb_fric_force_scale(ob);
add_v3_v3v3(auxvect, velgoal, bp->vec);
if (forcetime > 0.0f)
{ /* make sure friction does not become rocket motor on time reversal */
/* Make sure friction does not become rocket motor on time reversal. */
if (forcetime > 0.0f) {
bp->force[0] -= kd * (auxvect[0]);
bp->force[1] -= kd * (auxvect[1]);
bp->force[2] -= kd * (auxvect[2]);

View File

@@ -204,8 +204,8 @@ static void version_idproperty_move_data_string(IDPropertyUIDataString *ui_data,
static void version_idproperty_ui_data(IDProperty *idprop_group)
{
if (idprop_group == nullptr)
{ /* nullptr check here to reduce verbosity of calls to this function. */
/* `nullptr` check here to reduce verbosity of calls to this function. */
if (idprop_group == nullptr) {
return;
}

View File

@@ -29,10 +29,10 @@ static void do_adjacentKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
/* Upper right corner. */
x = t;
@@ -47,10 +47,10 @@ static void do_adjacentKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
/* Lower left corner. */
x = 0;
@@ -65,10 +65,10 @@ static void do_adjacentKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
/* Lower right corner. */
x = rw - 1;
@@ -83,10 +83,10 @@ static void do_adjacentKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
/* Test the TOP row of pixels in buffer, except corners */
@@ -102,10 +102,10 @@ static void do_adjacentKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
}
@@ -122,10 +122,10 @@ static void do_adjacentKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
}
/* Test the LEFT edge of pixels in buffer, except corners */
@@ -141,10 +141,10 @@ static void do_adjacentKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
}
@@ -161,10 +161,10 @@ static void do_adjacentKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
}
@@ -194,10 +194,10 @@ static void do_adjacentBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - rw] || !lomask[x + 1])
{ /* Test if outer mask is empty underneath or to the right. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty underneath or to the right. */
if (!lomask[x - rw] || !lomask[x + 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -219,10 +219,10 @@ static void do_adjacentBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - rw] || !lomask[x - 1])
{ /* Test if outer mask is empty underneath or to the left. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty underneath or to the left. */
if (!lomask[x - rw] || !lomask[x - 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -244,10 +244,10 @@ static void do_adjacentBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x + rw] || !lomask[x + 1])
{ /* Test if outer mask is empty above or to the right. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty above or to the right. */
if (!lomask[x + rw] || !lomask[x + 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -269,10 +269,10 @@ static void do_adjacentBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x + rw] || !lomask[x - 1])
{ /* Test if outer mask is empty above or to the left. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty above or to the left. */
if (!lomask[x + rw] || !lomask[x - 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -294,10 +294,10 @@ static void do_adjacentBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - 1] || !lomask[x + 1])
{ /* Test if outer mask is empty to the left or to the right. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty to the left or to the right. */
if (!lomask[x - 1] || !lomask[x + 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -321,10 +321,10 @@ static void do_adjacentBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - 1] || !lomask[x + 1])
{ /* Test if outer mask is empty to the left or to the right. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty to the left or to the right. */
if (!lomask[x - 1] || !lomask[x + 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -347,10 +347,10 @@ static void do_adjacentBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - rw] || !lomask[x + rw])
{ /* Test if outer mask is empty underneath or above. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty underneath or above. */
if (!lomask[x - rw] || !lomask[x + rw]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -374,10 +374,10 @@ static void do_adjacentBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - rw] || !lomask[x + rw])
{ /* Test if outer mask is empty underneath or above. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty underneath or above. */
if (!lomask[x - rw] || !lomask[x + rw]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -413,10 +413,10 @@ static void do_allKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
/* Upper right corner. */
x = t;
@@ -430,10 +430,10 @@ static void do_allKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
/* Lower left corner. */
x = 0;
@@ -447,10 +447,10 @@ static void do_allKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
/* Lower right corner. */
x = rw - 1;
@@ -464,10 +464,10 @@ static void do_allKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
/* Test the TOP row of pixels in buffer, except corners */
@@ -482,10 +482,10 @@ static void do_allKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
}
@@ -501,10 +501,10 @@ static void do_allKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
}
/* Test the LEFT edge of pixels in buffer, except corners */
@@ -519,10 +519,10 @@ static void do_allKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
}
@@ -538,10 +538,10 @@ static void do_allKeepBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
}
@@ -570,10 +570,10 @@ static void do_allBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - rw] || !lomask[x + 1])
{ /* Test if outer mask is empty underneath or to the right. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty underneath or to the right. */
if (!lomask[x - rw] || !lomask[x + 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -594,10 +594,10 @@ static void do_allBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - rw] || !lomask[x - 1])
{ /* Test if outer mask is empty above or to the left. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty above or to the left. */
if (!lomask[x - rw] || !lomask[x - 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -618,10 +618,10 @@ static void do_allBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x + rw] || !lomask[x + 1])
{ /* Test if outer mask is empty underneath or to the right. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty underneath or to the right. */
if (!lomask[x + rw] || !lomask[x + 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -642,10 +642,10 @@ static void do_allBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x + rw] || !lomask[x - 1])
{ /* Test if outer mask is empty underneath or to the left. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty underneath or to the left. */
if (!lomask[x + rw] || !lomask[x - 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -666,10 +666,10 @@ static void do_allBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - 1] || !lomask[x + 1])
{ /* Test if outer mask is empty to the left or to the right. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty to the left or to the right. */
if (!lomask[x - 1] || !lomask[x + 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -692,10 +692,10 @@ static void do_allBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - 1] || !lomask[x + 1])
{ /* Test if outer mask is empty to the left or to the right. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty to the left or to the right. */
if (!lomask[x - 1] || !lomask[x + 1]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -717,10 +717,10 @@ static void do_allBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - rw] || !lomask[x + rw])
{ /* Test if outer mask is empty underneath or above. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty underneath or above. */
if (!lomask[x - rw] || !lomask[x + rw]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -743,10 +743,10 @@ static void do_allBleedBorders(
else {
res[x] = 1.0f; /* Pixel is just part of inner mask, and it's not an edge. */
}
}
else if (lomask[x]) { /* Inner mask was empty, test if outer mask is filled. */
if (!lomask[x - rw] || !lomask[x + rw])
{ /* Test if outer mask is empty underneath or above. */
} /* Inner mask was empty, test if outer mask is filled. */
else if (lomask[x]) {
/* Test if outer mask is empty underneath or above. */
if (!lomask[x - rw] || !lomask[x + rw]) {
osz++; /* Increment outer edge size. */
lres[x] = 3; /* Flag pixel as outer edge. */
}
@@ -1123,8 +1123,8 @@ static void do_fillGradientBuffer(uint rw,
t = gbuf[gradient_fill_offset]; /* Calculate column of pixel indexed by `gbuf[x]`. */
fsz = gbuf[gradient_fill_offset + 1]; /* Calculate row of pixel indexed by `gbuf[x]`. */
dmin = 0xffffffff; /* Reset min distance to edge pixel. */
for (a = outer_edge_offset + osz - 1; a >= outer_edge_offset; a--)
{ /* Loop through all outer edge buffer pixels. */
/* Loop through all outer edge buffer pixels. */
for (a = outer_edge_offset + osz - 1; a >= outer_edge_offset; a--) {
ud = a << 1;
dy = t - gbuf[ud]; /* Set dx to gradient pixel column - outer edge pixel row. */
dx = fsz - gbuf[ud + 1]; /* Set dy to gradient pixel row - outer edge pixel column. */
@@ -1141,14 +1141,14 @@ static void do_fillGradientBuffer(uint rw,
odist = odist * (rsopf - (rsf * odist *
odist)); /* -- This line can be iterated for more accuracy. -- */
dmin = 0xffffffff; /* Reset min distance to edge pixel. */
for (a = inner_edge_offset + isz - 1; a >= inner_edge_offset; a--)
{ /* Loop through all inside edge pixels. */
/* Loop through all inside edge pixels. */
for (a = inner_edge_offset + isz - 1; a >= inner_edge_offset; a--) {
ud = a << 1;
dy = t - gbuf[ud]; /* Compute delta in Y from gradient pixel to inside edge pixel. */
dx = fsz - gbuf[ud + 1]; /* Compute delta in X from gradient pixel to inside edge pixel. */
ud = dx * dx + dy * dy; /* Compute sum of squares. */
if (ud < dmin)
{ /* If our new sum of squares is less than the current minimum we've found. */
/* If our new sum of squares is less than the current minimum we've found. */
if (ud < dmin) {
dmin = ud; /* Set a new minimum equal to the new lower value. */
}
}

View File

@@ -861,8 +861,8 @@ int SMAABlendingWeightCalculationOperation::search_xright(int x, int y)
x++;
sample_image_fn_(x, y, e);
if (e[1] == 0.0f || /* Is the edge not activated? */
e[0] != 0.0f)
{ /* Or is there a crossing edge that breaks the line? */
e[0] != 0.0f) /* Or is there a crossing edge that breaks the line? */
{
break;
}
sample_image_fn_(x, y - 1, e);
@@ -906,8 +906,8 @@ int SMAABlendingWeightCalculationOperation::search_ydown(int x, int y)
y++;
sample_image_fn_(x, y, e);
if (e[0] == 0.0f || /* Is the edge not activated? */
e[1] != 0.0f)
{ /* Or is there a crossing edge that breaks the line? */
e[1] != 0.0f) /* Or is there a crossing edge that breaks the line? */
{
break;
}
sample_image_fn_(x - 1, y, e);

View File

@@ -523,13 +523,15 @@ static void render_progress_update(void *rjv, float progress)
*/
static void render_image_update_pass_and_layer(RenderJob *rj, RenderResult *rr, ImageUser *iuser)
{
wmWindowManager *wm;
ScrArea *first_area = nullptr, *matched_area = nullptr;
/* image window, compo node users */
for (wm = static_cast<wmWindowManager *>(rj->main->wm.first); wm && matched_area == nullptr;
/* Only ever 1 `wm`. */
for (wmWindowManager *wm = static_cast<wmWindowManager *>(rj->main->wm.first);
wm && matched_area == nullptr;
wm = static_cast<wmWindowManager *>(wm->id.next))
{ /* only 1 wm */
{
wmWindow *win;
for (win = static_cast<wmWindow *>(wm->windows.first); win && matched_area == nullptr;
win = win->next)
@@ -693,12 +695,10 @@ static void render_startjob(void *rjv, bool *stop, bool *do_update, float *progr
static void render_image_restore_layer(RenderJob *rj)
{
wmWindowManager *wm;
/* image window, compo node users */
for (wm = static_cast<wmWindowManager *>(rj->main->wm.first); wm;
wm = static_cast<wmWindowManager *>(wm->id.next))
{ /* only 1 wm */
/* Only ever 1 `wm`. */
LISTBASE_FOREACH (wmWindowManager *, wm, &rj->main->wm) {
wmWindow *win;
for (win = static_cast<wmWindow *>(wm->windows.first); win; win = win->next) {
const bScreen *screen = WM_window_get_active_screen(win);
@@ -903,9 +903,9 @@ static void clean_viewport_memory(Main *bmain, Scene *scene)
BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true);
/* Go over all the visible objects. */
for (wmWindowManager *wm = static_cast<wmWindowManager *>(bmain->wm.first); wm;
wm = static_cast<wmWindowManager *>(wm->id.next))
{
/* Only ever 1 `wm`. */
LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
BKE_view_layer_synced_ensure(scene, view_layer);

View File

@@ -173,9 +173,8 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY |
ANIMFILTER_NODUPLIS | ANIMFILTER_FCURVESONLY);
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS)
{ /* FIXME: this should really be check for by the
* filtering code. */
/* FIXME: this should really be check for by the filtering code. */
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
filter |= ANIMFILTER_SEL;
}
mapping_flag |= ANIM_get_normalization_flags(ac);

View File

@@ -574,10 +574,9 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), co
/* escape if not our timer */
if ((reports->reporttimer == NULL) || (reports->reporttimer != event->customdata) ||
((report = BKE_reports_last_displayable(reports)) == NULL)
/* may have been deleted */
)
((report = BKE_reports_last_displayable(reports)) == NULL))
{
/* May have been deleted. */
return OPERATOR_PASS_THROUGH;
}

View File

@@ -277,8 +277,8 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
re->i.infostr = TIP_("Freestyle: Mesh loading");
re->stats_draw(re->sdh, &re->i);
re->i.infostr = nullptr;
if (controller->LoadMesh(re, view_layer, depsgraph))
{ // returns if scene cannot be loaded or if empty
if (controller->LoadMesh(re, view_layer, depsgraph)) {
/* Returns if scene cannot be loaded or if empty. */
return;
}
if (re->test_break(re->tbh)) {

View File

@@ -321,8 +321,8 @@ void FEdgeXDetector::ProcessSilhouetteEdge(WXEdge *iEdge)
WXFace *fA = (WXFace *)iEdge->GetaOEdge()->GetaFace();
WXFace *fB = (WXFace *)iEdge->GetaOEdge()->GetbFace();
if (fA->front() ^ fB->front())
{ // fA->visible XOR fB->visible (true if one is 0 and the other is 1)
/* fA->visible XOR fB->visible (true if one is 0 and the other is 1). */
if (fA->front() ^ fB->front()) {
// The only edges we want to set as silhouette edges in this way are the ones with 2 different
// normals for 1 vertex for these two faces
//--------------------

View File

@@ -477,8 +477,9 @@ FEdge *ViewEdgeXBuilder::BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer
Vec3r normal;
// Make the 2 Svertices
if (feprevious == nullptr)
{ // that means that we don't have any vertex already built for that face
/* That means that we don't have any vertex already built for that face. */
if (feprevious == nullptr) {
Vec3r A1(woea->GetaVertex()->GetVertex());
Vec3r A2(woea->GetbVertex()->GetVertex());
Vec3r A(A1 + ta * (A2 - A1));

View File

@@ -1127,8 +1127,8 @@ float SMAASearchXLeft(SMAATexture2D(edgesTex),
*/
float2 e = float2(0.0, 1.0);
while (texcoord.x > end && e.g > 0.8281 && // Is there some edge not activated?
e.r == 0.0)
{ // Or is there a crossing edge that breaks the line?
e.r == 0.0) // Or is there a crossing edge that breaks the line?
{
e = SMAASampleLevelZero(edgesTex, texcoord).rg;
texcoord = mad(-float2(2.0, 0.0), SMAA_RT_METRICS.xy, texcoord);
}
@@ -1158,8 +1158,8 @@ float SMAASearchXRight(SMAATexture2D(edgesTex),
{
float2 e = float2(0.0, 1.0);
while (texcoord.x < end && e.g > 0.8281 && // Is there some edge not activated?
e.r == 0.0)
{ // Or is there a crossing edge that breaks the line?
e.r == 0.0) // Or is there a crossing edge that breaks the line?
{
e = SMAASampleLevelZero(edgesTex, texcoord).rg;
texcoord = mad(float2(2.0, 0.0), SMAA_RT_METRICS.xy, texcoord);
}
@@ -1172,8 +1172,8 @@ float SMAASearchYUp(SMAATexture2D(edgesTex), SMAATexture2D(searchTex), float2 te
{
float2 e = float2(1.0, 0.0);
while (texcoord.y > end && e.r > 0.8281 && // Is there some edge not activated?
e.g == 0.0)
{ // Or is there a crossing edge that breaks the line?
e.g == 0.0) // Or is there a crossing edge that breaks the line?
{
e = SMAASampleLevelZero(edgesTex, texcoord).rg;
texcoord = mad(-float2(0.0, 2.0), SMAA_RT_METRICS.xy, texcoord);
}
@@ -1189,8 +1189,8 @@ float SMAASearchYDown(SMAATexture2D(edgesTex),
{
float2 e = float2(1.0, 0.0);
while (texcoord.y < end && e.r > 0.8281 && // Is there some edge not activated?
e.g == 0.0)
{ // Or is there a crossing edge that breaks the line?
e.g == 0.0) // Or is there a crossing edge that breaks the line?
{
e = SMAASampleLevelZero(edgesTex, texcoord).rg;
texcoord = mad(float2(0.0, 2.0), SMAA_RT_METRICS.xy, texcoord);
}

View File

@@ -4134,9 +4134,9 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
default_py = NULL;
}
/* items can be a list or a callable */
if (PyFunction_Check(items))
{ /* don't use PyCallable_Check because we need the function code for errors */
/* Items can be a list or a callable.
* NOTE: Don't use #PyCallable_Check because we need the function code for errors. */
if (PyFunction_Check(items)) {
PyCodeObject *f_code = (PyCodeObject *)PyFunction_GET_CODE(items);
if (f_code->co_argcount != 2) {
PyErr_Format(PyExc_ValueError,

View File

@@ -2203,8 +2203,8 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
/* Element-wise product in-place. */
mul_vn_vn(vec1->vec, vec2->vec, vec1->vec_num);
}
else if (vec1 && (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0))
{ /* VEC *= FLOAT */
else if (vec1 && (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0)) {
/* VEC *= FLOAT */
mul_vn_fl(vec1->vec, vec1->vec_num, scalar);
}
else {