Skip to content

Commit 2a18b9a

Browse files
committed
Remove centreSampling option, update some expected test fixtures
See https://github.com/jcupitt/libvips/issues/705
1 parent 6aa2141 commit 2a18b9a

19 files changed

Lines changed: 7 additions & 55 deletions

docs/api-resize.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ Possible kernels are:
2929
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?**
3030
- `options.kernel` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the kernel to use for image reduction. (optional, default `'lanczos3'`)
3131
- `options.fastShrinkOnLoad` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** take greater advantage of the JPEG and WebP shrink-on-load feature, which can lead to a slight moiré pattern on some images. (optional, default `true`)
32-
- `options.centreSampling` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** use \*magick centre sampling convention instead of corner sampling. (optional, default `false`)
33-
- `options.centerSampling` **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** alternative spelling of centreSampling. (optional, default `false`)
3432

3533
**Examples**
3634

docs/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Requires libvips v8.6.0.
1818
[#976](https://github.com/lovell/sharp/pull/976)
1919
[@mceachen](https://github.com/mceachen)
2020

21-
* Resize: switch to libvips' implementation, make fastShrinkOnLoad optional, remove interpolators.
21+
* Resize: switch to libvips' implementation, make fastShrinkOnLoad optional, remove interpolator and centreSampling options.
2222
[#977](https://github.com/lovell/sharp/pull/977)
2323
[@jardakotesovec](https://github.com/jardakotesovec)
2424

lib/constructor.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ const Sharp = function (input, options) {
147147
extendRight: 0,
148148
withoutEnlargement: false,
149149
kernel: 'lanczos3',
150-
interpolator: 'bicubic',
151-
centreSampling: false,
152150
fastShrinkOnLoad: true,
153151
// operations
154152
background: [0, 0, 0, 255],

lib/resize.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ const kernel = {
7171
* @param {Object} [options]
7272
* @param {String} [options.kernel='lanczos3'] - the kernel to use for image reduction.
7373
* @param {Boolean} [options.fastShrinkOnLoad=true] - take greater advantage of the JPEG and WebP shrink-on-load feature, which can lead to a slight moiré pattern on some images.
74-
* @param {Boolean} [options.centreSampling=false] - use *magick centre sampling convention instead of corner sampling.
75-
* @param {Boolean} [options.centerSampling=false] - alternative spelling of centreSampling.
7674
* @returns {Sharp}
7775
* @throws {Error} Invalid parameters
7876
*/
@@ -104,11 +102,6 @@ function resize (width, height, options) {
104102
throw is.invalidParameterError('kernel', 'valid kernel name', options.kernel);
105103
}
106104
}
107-
// Centre sampling
108-
options.centreSampling = is.bool(options.centerSampling) ? options.centerSampling : options.centreSampling;
109-
if (is.defined(options.centreSampling)) {
110-
this._setBooleanOption('centreSampling', options.centreSampling);
111-
}
112105
// Shrink on load
113106
if (is.defined(options.fastShrinkOnLoad)) {
114107
this._setBooleanOption('fastShrinkOnLoad', options.fastShrinkOnLoad);

src/pipeline.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ class PipelineWorker : public Nan::AsyncWorker {
381381

382382
image = image.resize(1.0 / xfactor, VImage::option()
383383
->set("vscale", 1.0 / yfactor)
384-
->set("kernel", kernel)
385-
->set("centre", baton->centreSampling));
384+
->set("kernel", kernel));
386385
}
387386

388387
// Rotate
@@ -1143,7 +1142,6 @@ NAN_METHOD(pipeline) {
11431142
baton->withoutEnlargement = AttrTo<bool>(options, "withoutEnlargement");
11441143
baton->crop = AttrTo<int32_t>(options, "crop");
11451144
baton->kernel = AttrAsStr(options, "kernel");
1146-
baton->centreSampling = AttrTo<bool>(options, "centreSampling");
11471145
baton->fastShrinkOnLoad = AttrTo<bool>(options, "fastShrinkOnLoad");
11481146
// Join Channel Options
11491147
if (HasAttr(options, "joinChannelIn")) {

src/pipeline.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ struct PipelineBaton {
6767
int cropOffsetTop;
6868
bool premultiplied;
6969
std::string kernel;
70-
bool centreSampling;
7170
bool fastShrinkOnLoad;
7271
double background[4];
7372
bool flatten;
@@ -150,7 +149,6 @@ struct PipelineBaton {
150149
cropOffsetLeft(0),
151150
cropOffsetTop(0),
152151
premultiplied(false),
153-
centreSampling(false),
154152
flatten(false),
155153
negate(false),
156154
blurSigma(0.0),
-21.7 KB
Loading
86 Bytes
Loading
24.8 KB
Loading
4.58 KB
Loading

0 commit comments

Comments
 (0)