diff --git a/DesktopEditor/graphics/pro/js/wasm/src/drawingfile_test.cpp b/DesktopEditor/graphics/pro/js/wasm/src/drawingfile_test.cpp index 52fd076e69..bd21fdbdf7 100644 --- a/DesktopEditor/graphics/pro/js/wasm/src/drawingfile_test.cpp +++ b/DesktopEditor/graphics/pro/js/wasm/src/drawingfile_test.cpp @@ -1135,6 +1135,15 @@ int main(int argc, char* argv[]) } } + BYTE* pColor = new BYTE[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + // REDACT + if (true) + { + int pRect[4] = { 307499, 217499, 1799999, 1124999 }; + if (!RedactPage(pGrFile, nTestPage, pRect, 1, pColor, 12)) + std::cout << "Redact false" << std::endl; + } + int i = nTestPage; //for (int i = 0; i < nPagesCount; ++i) { @@ -1162,7 +1171,6 @@ int main(int argc, char* argv[]) RELEASEARRAYOBJECTS(res); } } - free(pInfo); // LINKS diff --git a/PdfFile/PdfReader.cpp b/PdfFile/PdfReader.cpp index 294c8c3a05..d8c87592a4 100644 --- a/PdfFile/PdfReader.cpp +++ b/PdfFile/PdfReader.cpp @@ -812,6 +812,7 @@ void CPdfReader::DrawPageOnRenderer(IRenderer* pRenderer, int _nPageIndex, bool* ((GlobalParamsAdaptor*)globalParams)->ClearRedact(); + pRenderer->SetTransform(1, 0, 0, 1, 0, 0); for (int i = 0 ; i < m_vRedact.size(); ++i) { if (m_vRedact[i]->m_nPageIndex == _nPageIndex) @@ -827,12 +828,13 @@ void CPdfReader::DrawPageOnRenderer(IRenderer* pRenderer, int _nPageIndex, bool* ret = *((int*)pMemory); double B = ret / 100000.0; LONG lColor = (LONG)(((LONG)(R * 255)) | ((LONG)(G * 255) << 8) | ((LONG)(B * 255) << 16) | ((LONG)255 << 24)); - pRenderer->PathCommandClose(); + + pRenderer->PathCommandEnd(); pRenderer->put_BrushColor1(lColor); - pRenderer->PathCommandMoveTo(m_vRedact[i]->m_arrRedactBox[0], m_vRedact[i]->m_arrRedactBox[1]); - pRenderer->PathCommandLineTo(m_vRedact[i]->m_arrRedactBox[0], m_vRedact[i]->m_arrRedactBox[3]); - pRenderer->PathCommandLineTo(m_vRedact[i]->m_arrRedactBox[2], m_vRedact[i]->m_arrRedactBox[3]); - pRenderer->PathCommandLineTo(m_vRedact[i]->m_arrRedactBox[2], m_vRedact[i]->m_arrRedactBox[1]); + pRenderer->PathCommandMoveTo(PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[0]), PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[1])); + pRenderer->PathCommandLineTo(PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[0]), PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[3])); + pRenderer->PathCommandLineTo(PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[2]), PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[3])); + pRenderer->PathCommandLineTo(PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[2]), PdfReader::PDFCoordsToMM(m_vRedact[i]->m_arrRedactBox[1])); pRenderer->PathCommandClose(); pRenderer->DrawPath(c_nWindingFillMode); pRenderer->PathCommandEnd();