Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong index for PCS compositions objects in crop functionality #14

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ int main(int32_t argc, char** argv)
t_PCS pcs = {};
t_PDS pds = {};

size_t offesetCurrPCS = 0;
size_t offsetCurrPCS = 0;
bool fixPCS = false;

std::vector<t_compositionNumberToSaveInfo> cutMerge_compositionNumberToSave = {};
Expand Down Expand Up @@ -803,7 +803,7 @@ int main(int32_t argc, char** argv)
//std::printf("PCS\r\n");
if (doCrop || cmd.addZero || cmd.cutMerge.doCutMerge) {
pcs = ReadPCS(&buffer[start + HEADER_SIZE]);
offesetCurrPCS = start;
offsetCurrPCS = start;

if (doCrop) {
screenRect.x = 0 + cmd.crop.left;
Expand Down Expand Up @@ -970,18 +970,18 @@ int main(int32_t argc, char** argv)
wds.windows[i].WindowsVerPos -= (cmd.crop.top + corrVer);
}

if (corrVer != 0) {
pcs.compositionObject[i].objectVerPos -= corrVer;
fixPCS = true;
}
if (corrHor != 0) {
pcs.compositionObject[i].objectHorPos -= corrHor;
if (corrVer != 0 || corrHor != 0) {
for (int j = 0; j < pcs.numCompositionObject; j++) {
if (pcs.compositionObject[j].windowID != wds.windows[i].windowID) continue;
pcs.compositionObject[j].objectVerPos -= corrVer;
pcs.compositionObject[j].objectHorPos -= corrHor;
}
fixPCS = true;
}
}

if (fixPCS) {
WritePCS(pcs, &buffer[offesetCurrPCS + HEADER_SIZE]);
WritePCS(pcs, &buffer[offsetCurrPCS + HEADER_SIZE]);
}
WriteWDS(wds, &buffer[start + HEADER_SIZE]);

Expand Down
Loading