Re-implement gradient selections

Uncomments and makes available selection.gradient in Lua. (The backend C
code for this still existed, it just wasn't used.)

The only valid way to specify a gradient is with a table. I considered
adding non-table versions, but decided that there are too many
independent variables that can be optional. A non-table version, without
named parameters, would be confusing to read, especially since most of
the arguments are ints.

Also adds an impossible in the (possibly unreachable) case that
selection_do_gradient gets called with a bad gradient type.
This commit is contained in:
copperwater
2020-02-29 11:06:30 -05:00
committed by Pasi Kallinen
parent 407f65aa8a
commit 0befdbfd02
3 changed files with 70 additions and 4 deletions

View File

@@ -4683,6 +4683,8 @@ long x, y, x2, y2, gtyp, mind, maxd, limit;
switch (gtyp) {
default:
impossible("Unrecognized gradient type! Defaulting to radial...");
/* FALLTHRU */
case SEL_GRADIENT_RADIAL: {
for (dx = 0; dx < COLNO; dx++)
for (dy = 0; dy < ROWNO; dy++) {