mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Tighten C++ linting rules
Bump benchmark dependencies Update leak test suppressions Update future branch details
This commit is contained in:
parent
24fb0c33c2
commit
c66495b66c
@ -41,9 +41,9 @@ Any change that modifies the existing public API should be added to the relevant
|
|||||||
|
|
||||||
| Release | WIP branch |
|
| Release | WIP branch |
|
||||||
| ------: | :--------- |
|
| ------: | :--------- |
|
||||||
| v0.14.0 | needle |
|
|
||||||
| v0.15.0 | outfit |
|
| v0.15.0 | outfit |
|
||||||
| v0.16.0 | pencil |
|
| v0.16.0 | pencil |
|
||||||
|
| v0.17.0 | quill |
|
||||||
|
|
||||||
Please squash your changes into a single commit using a command like `git rebase -i upstream/<wip-branch>`.
|
Please squash your changes into a single commit using a command like `git rebase -i upstream/<wip-branch>`.
|
||||||
|
|
||||||
|
@ -8,16 +8,16 @@
|
|||||||
// Verify platform and compiler compatibility
|
// Verify platform and compiler compatibility
|
||||||
|
|
||||||
#if (VIPS_MAJOR_VERSION < 8 || (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 2))
|
#if (VIPS_MAJOR_VERSION < 8 || (VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 2))
|
||||||
#error libvips version 8.2.0+ required - see http://sharp.dimens.io/page/install
|
#error libvips version 8.2.0+ required - see sharp.dimens.io/page/install
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
|
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
|
||||||
#error GCC version 4.6+ is required for C++11 features - see http://sharp.dimens.io/page/install#prerequisites
|
#error GCC version 4.6+ is required for C++11 features - see sharp.dimens.io/page/install#prerequisites
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__clang__) && defined(__has_feature))
|
#if (defined(__clang__) && defined(__has_feature))
|
||||||
#if (!__has_feature(cxx_range_for))
|
#if (!__has_feature(cxx_range_for))
|
||||||
#error clang version 3.0+ is required for C++11 features - see http://sharp.dimens.io/page/install#prerequisites
|
#error clang version 3.0+ is required for C++11 features - see sharp.dimens.io/page/install#prerequisites
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -219,35 +219,44 @@ namespace sharp {
|
|||||||
int left = 0;
|
int left = 0;
|
||||||
int top = 0;
|
int top = 0;
|
||||||
switch (gravity) {
|
switch (gravity) {
|
||||||
case 1: // North
|
case 1:
|
||||||
|
// North
|
||||||
left = (inWidth - outWidth + 1) / 2;
|
left = (inWidth - outWidth + 1) / 2;
|
||||||
break;
|
break;
|
||||||
case 2: // East
|
case 2:
|
||||||
|
// East
|
||||||
left = inWidth - outWidth;
|
left = inWidth - outWidth;
|
||||||
top = (inHeight - outHeight + 1) / 2;
|
top = (inHeight - outHeight + 1) / 2;
|
||||||
break;
|
break;
|
||||||
case 3: // South
|
case 3:
|
||||||
|
// South
|
||||||
left = (inWidth - outWidth + 1) / 2;
|
left = (inWidth - outWidth + 1) / 2;
|
||||||
top = inHeight - outHeight;
|
top = inHeight - outHeight;
|
||||||
break;
|
break;
|
||||||
case 4: // West
|
case 4:
|
||||||
|
// West
|
||||||
top = (inHeight - outHeight + 1) / 2;
|
top = (inHeight - outHeight + 1) / 2;
|
||||||
break;
|
break;
|
||||||
case 5: // Northeast
|
case 5:
|
||||||
|
// Northeast
|
||||||
left = inWidth - outWidth;
|
left = inWidth - outWidth;
|
||||||
break;
|
break;
|
||||||
case 6: // Southeast
|
case 6:
|
||||||
|
// Southeast
|
||||||
left = inWidth - outWidth;
|
left = inWidth - outWidth;
|
||||||
top = inHeight - outHeight;
|
top = inHeight - outHeight;
|
||||||
case 7: // Southwest
|
case 7:
|
||||||
|
// Southwest
|
||||||
top = inHeight - outHeight;
|
top = inHeight - outHeight;
|
||||||
case 8: // Northwest
|
case 8:
|
||||||
|
// Northwest
|
||||||
break;
|
break;
|
||||||
default: // Centre
|
default:
|
||||||
|
// Centre
|
||||||
left = (inWidth - outWidth + 1) / 2;
|
left = (inWidth - outWidth + 1) / 2;
|
||||||
top = (inHeight - outHeight + 1) / 2;
|
top = (inHeight - outHeight + 1) / 2;
|
||||||
}
|
}
|
||||||
return std::make_tuple(left, top);
|
return std::make_tuple(left, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sharp
|
} // namespace sharp
|
||||||
|
@ -73,7 +73,6 @@ struct MetadataBaton {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class MetadataWorker : public AsyncWorker {
|
class MetadataWorker : public AsyncWorker {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MetadataWorker(Callback *callback, MetadataBaton *baton, const Local<Object> &bufferIn) :
|
MetadataWorker(Callback *callback, MetadataBaton *baton, const Local<Object> &bufferIn) :
|
||||||
AsyncWorker(callback), baton(baton) {
|
AsyncWorker(callback), baton(baton) {
|
||||||
|
@ -71,7 +71,6 @@ using sharp::counterProcess;
|
|||||||
using sharp::counterQueue;
|
using sharp::counterQueue;
|
||||||
|
|
||||||
class PipelineWorker : public AsyncWorker {
|
class PipelineWorker : public AsyncWorker {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PipelineWorker(Callback *callback, PipelineBaton *baton, Callback *queueListener,
|
PipelineWorker(Callback *callback, PipelineBaton *baton, Callback *queueListener,
|
||||||
const Local<Object> &bufferIn, const Local<Object> &overlayBufferIn) :
|
const Local<Object> &bufferIn, const Local<Object> &overlayBufferIn) :
|
||||||
@ -89,7 +88,6 @@ class PipelineWorker : public AsyncWorker {
|
|||||||
libuv worker
|
libuv worker
|
||||||
*/
|
*/
|
||||||
void Execute() {
|
void Execute() {
|
||||||
|
|
||||||
// Decrement queued task counter
|
// Decrement queued task counter
|
||||||
g_atomic_int_dec_and_test(&counterQueue);
|
g_atomic_int_dec_and_test(&counterQueue);
|
||||||
// Increment processing task counter
|
// Increment processing task counter
|
||||||
@ -685,7 +683,8 @@ class PipelineWorker : public AsyncWorker {
|
|||||||
->set("strip", !baton->withMetadata)
|
->set("strip", !baton->withMetadata)
|
||||||
->set("compression", baton->compressionLevel)
|
->set("compression", baton->compressionLevel)
|
||||||
->set("interlace", baton->progressive)
|
->set("interlace", baton->progressive)
|
||||||
->set("filter", baton->withoutAdaptiveFiltering ? VIPS_FOREIGN_PNG_FILTER_NONE : VIPS_FOREIGN_PNG_FILTER_ALL)
|
->set("filter", baton->withoutAdaptiveFiltering ?
|
||||||
|
VIPS_FOREIGN_PNG_FILTER_NONE : VIPS_FOREIGN_PNG_FILTER_ALL)
|
||||||
));
|
));
|
||||||
baton->bufferOut = static_cast<char*>(area->data);
|
baton->bufferOut = static_cast<char*>(area->data);
|
||||||
baton->bufferOutLength = area->length;
|
baton->bufferOutLength = area->length;
|
||||||
@ -758,7 +757,8 @@ class PipelineWorker : public AsyncWorker {
|
|||||||
->set("strip", !baton->withMetadata)
|
->set("strip", !baton->withMetadata)
|
||||||
->set("compression", baton->compressionLevel)
|
->set("compression", baton->compressionLevel)
|
||||||
->set("interlace", baton->progressive)
|
->set("interlace", baton->progressive)
|
||||||
->set("filter", baton->withoutAdaptiveFiltering ? VIPS_FOREIGN_PNG_FILTER_NONE : VIPS_FOREIGN_PNG_FILTER_ALL)
|
->set("filter", baton->withoutAdaptiveFiltering ?
|
||||||
|
VIPS_FOREIGN_PNG_FILTER_NONE : VIPS_FOREIGN_PNG_FILTER_ALL)
|
||||||
);
|
);
|
||||||
baton->formatOut = "png";
|
baton->formatOut = "png";
|
||||||
} else if (baton->formatOut == "webp" || isWebp || (matchInput && inputImageType == ImageType::WEBP)) {
|
} else if (baton->formatOut == "webp" || isWebp || (matchInput && inputImageType == ImageType::WEBP)) {
|
||||||
@ -882,10 +882,10 @@ class PipelineWorker : public AsyncWorker {
|
|||||||
case 6: rotate = VIPS_ANGLE_D90; break;
|
case 6: rotate = VIPS_ANGLE_D90; break;
|
||||||
case 3: rotate = VIPS_ANGLE_D180; break;
|
case 3: rotate = VIPS_ANGLE_D180; break;
|
||||||
case 8: rotate = VIPS_ANGLE_D270; break;
|
case 8: rotate = VIPS_ANGLE_D270; break;
|
||||||
case 2: flop = TRUE; break; // flop 1
|
case 2: flop = TRUE; break; // flop 1
|
||||||
case 7: flip = TRUE; rotate = VIPS_ANGLE_D90; break; // flip 6
|
case 7: flip = TRUE; rotate = VIPS_ANGLE_D90; break; // flip 6
|
||||||
case 4: flop = TRUE; rotate = VIPS_ANGLE_D180; break; // flop 3
|
case 4: flop = TRUE; rotate = VIPS_ANGLE_D180; break; // flop 3
|
||||||
case 5: flip = TRUE; rotate = VIPS_ANGLE_D270; break; // flip 8
|
case 5: flip = TRUE; rotate = VIPS_ANGLE_D270; break; // flip 8
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (angle == 90) {
|
if (angle == 90) {
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"async": "^1.5.2",
|
"async": "^1.5.2",
|
||||||
"benchmark": "^2.0.0",
|
"benchmark": "^2.1.0",
|
||||||
"gm": "^1.21.0",
|
"gm": "^1.21.0",
|
||||||
"imagemagick": "^0.1.3",
|
"imagemagick": "^0.1.3",
|
||||||
"imagemagick-native": "elad/node-imagemagick-native",
|
"imagemagick-native": "^1.9.2",
|
||||||
"jimp": "^0.2.20",
|
"jimp": "^0.2.20",
|
||||||
"lwip": "^0.0.8",
|
"lwip": "^0.0.8",
|
||||||
"semver": "^5.1.0"
|
"semver": "^5.1.0"
|
||||||
|
@ -306,26 +306,15 @@
|
|||||||
...
|
...
|
||||||
fun:vips__magick_read_header
|
fun:vips__magick_read_header
|
||||||
}
|
}
|
||||||
{
|
|
||||||
cond_magick_is_palette_image_get_bands
|
|
||||||
Memcheck:Cond
|
|
||||||
fun:IsPaletteImage
|
|
||||||
...
|
|
||||||
fun:get_bands
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
value_magick_is_palette_image
|
value_magick_is_palette_image
|
||||||
Memcheck:Value8
|
Memcheck:Value8
|
||||||
fun:IsPaletteImage
|
fun:IsPaletteImage
|
||||||
...
|
|
||||||
fun:get_bands
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
cond_magick_is_palette_image_parse_header
|
cond_magick_is_palette_image
|
||||||
Memcheck:Cond
|
Memcheck:Cond
|
||||||
fun:IsPaletteImage
|
fun:IsPaletteImage
|
||||||
...
|
|
||||||
fun:parse_header
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# glib g_file_read_link
|
# glib g_file_read_link
|
||||||
|
@ -19,18 +19,15 @@ describe('cpplint', function() {
|
|||||||
// Lint each source file
|
// Lint each source file
|
||||||
cpplint({
|
cpplint({
|
||||||
files: [file],
|
files: [file],
|
||||||
linelength: 140,
|
linelength: 120,
|
||||||
filters: {
|
filters: {
|
||||||
legal: {
|
legal: {
|
||||||
copyright: false
|
copyright: false
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
include: false,
|
include: false
|
||||||
include_order: false
|
|
||||||
},
|
},
|
||||||
whitespace: {
|
whitespace: {
|
||||||
blank_line: false,
|
|
||||||
comments: false,
|
|
||||||
parens: false
|
parens: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user