mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Fix erroneous top/left clipping in composite #2571
Fixes bug where certain input values for top/left parameters in composite can conflict with clipping logic, resulting in inaccurate alignment in output.
This commit is contained in:
@@ -602,8 +602,13 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
int top;
|
||||
if (composite->hasOffset) {
|
||||
// Composite image at given offsets
|
||||
std::tie(left, top) = sharp::CalculateCrop(image.width(), image.height(),
|
||||
compositeImage.width(), compositeImage.height(), composite->left, composite->top);
|
||||
if (composite->tile) {
|
||||
std::tie(left, top) = sharp::CalculateCrop(image.width(), image.height(),
|
||||
compositeImage.width(), compositeImage.height(), composite->left, composite->top);
|
||||
} else {
|
||||
left = composite->left;
|
||||
top = composite->top;
|
||||
}
|
||||
} else {
|
||||
// Composite image with given gravity
|
||||
std::tie(left, top) = sharp::CalculateCrop(image.width(), image.height(),
|
||||
|
||||
Reference in New Issue
Block a user