This commit is contained in:
Svetlana Kulikova
2025-09-26 18:50:41 +03:00
parent a873787fd7
commit e1157b8507
4 changed files with 11 additions and 6 deletions

View File

@ -1232,12 +1232,12 @@ CRedact::~CRedact()
const std::vector<CRedact::SRedact*>& CRedact::GetRedact() { return m_arrRedact; } const std::vector<CRedact::SRedact*>& CRedact::GetRedact() { return m_arrRedact; }
bool CRedact::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector) bool CRedact::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
{ {
int n = pReader->ReadInt(); int n = 1; //pReader->ReadInt();
m_arrRedact.reserve(n); m_arrRedact.reserve(n);
for (int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)
{ {
SRedact* pRedact = new SRedact(); SRedact* pRedact = new SRedact();
pRedact->sID = pReader->ReadString(); //pRedact->sID = pReader->ReadString();
int m = pReader->ReadInt(); int m = pReader->ReadInt();
pRedact->arrQuadPoints.reserve(m * 4); pRedact->arrQuadPoints.reserve(m * 4);
for (int j = 0; j < m; ++j) for (int j = 0; j < m; ++j)

View File

@ -3298,7 +3298,7 @@ bool CPdfEditor::EditWidgets(IAdvancedCommand* pCommand)
if (m_nMode == Mode::Unknown && !IncrementalUpdates()) if (m_nMode == Mode::Unknown && !IncrementalUpdates())
return false; return false;
WriteRedact({}); //WriteRedact({});
m_pWriter->AddRedact({}); m_pWriter->AddRedact({});
m_arrRedact.clear(); m_arrRedact.clear();

View File

@ -2101,6 +2101,8 @@ HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotF
BYTE* pRender = oInfo.GetRender(nLen); BYTE* pRender = oInfo.GetRender(nLen);
DrawAP(pAnnot, pRender, nLen); DrawAP(pAnnot, pRender, nLen);
} }
else
pLineAnnot->SetAP();
} }
else if (oInfo.IsTextMarkup()) else if (oInfo.IsTextMarkup())
{ {

View File

@ -36,8 +36,8 @@
#include "../lib/xpdf/GfxFont.h" #include "../lib/xpdf/GfxFont.h"
#include "../lib/xpdf/XRef.h" #include "../lib/xpdf/XRef.h"
#include "../lib/pathkit/include/core/SkPath.h" // Skia PathOps #include "../lib/pathkit/include/core/SkPath.h"
#include "../lib/pathkit/include/pathops/SkPathOps.h" // Skia PathOps #include "../lib/pathkit/include/pathops/SkPathOps.h"
#include "../../DesktopEditor/graphics/GraphicsPath.h" #include "../../DesktopEditor/graphics/GraphicsPath.h"
@ -738,6 +738,7 @@ void RedactOutputDev::clearSoftMask(GfxState *pGState)
} }
/* Skia PathOps
// Конвертирует conic в массив квадратичных Безье (минимум 1 сегмент) // Конвертирует conic в массив квадратичных Безье (минимум 1 сегмент)
void ConvertConicToQuads(const pk::SkPoint& p0, const pk::SkPoint& p1, const pk::SkPoint& p2, pk::SkScalar w, pk::SkPoint pts[], int pow2) { void ConvertConicToQuads(const pk::SkPoint& p0, const pk::SkPoint& p1, const pk::SkPoint& p2, pk::SkScalar w, pk::SkPoint pts[], int pow2) {
const pk::SkScalar k = 0.5f; // Фактор дробления (можно адаптировать) const pk::SkScalar k = 0.5f; // Фактор дробления (можно адаптировать)
@ -770,6 +771,7 @@ void ConvertConicToQuads(const pk::SkPoint& p0, const pk::SkPoint& p1, const pk:
std::copy(left, left + 3, pts); std::copy(left, left + 3, pts);
std::copy(right + 1, right + 3, pts + 3); std::copy(right + 1, right + 3, pts + 3);
} }
*/
bool SkipPath(const std::vector<CSegment>& arrForStroke, const CPoint& P1, const CPoint& P2) bool SkipPath(const std::vector<CSegment>& arrForStroke, const CPoint& P1, const CPoint& P2)
{ {
for (int i = 0; i < arrForStroke.size(); ++i) for (int i = 0; i < arrForStroke.size(); ++i)
@ -890,7 +892,6 @@ void RedactOutputDev::DoPathRedact(GfxState* pGState, GfxPath* pPath, double* pC
oPathRedact.Reset(); oPathRedact.Reset();
oPath = oPathResult; oPath = oPathResult;
} }
//oPathResult = Aggplus::CalcBooleanOperation(oPath, oPathRedact, Aggplus::BooleanOpType::Subtraction);
size_t length = oPathResult.GetPointCount(), compound = oPathResult.GetCloseCount(); size_t length = oPathResult.GetPointCount(), compound = oPathResult.GetCloseCount();
std::vector<Aggplus::PointD> points = oPathResult.GetPoints(0, length + compound); std::vector<Aggplus::PointD> points = oPathResult.GetPoints(0, length + compound);
@ -990,6 +991,7 @@ void RedactOutputDev::DoPathRedact(GfxState* pGState, GfxPath* pPath, double* pC
return; return;
/* Skia PathOps
pk::SkPath skPath, skPathRedact, skPathRes; pk::SkPath skPath, skPathRedact, skPathRes;
if (bEoFill) if (bEoFill)
skPath.setFillType(pk::SkPathFillType::kEvenOdd); skPath.setFillType(pk::SkPathFillType::kEvenOdd);
@ -1231,6 +1233,7 @@ void RedactOutputDev::DoPathRedact(GfxState* pGState, GfxPath* pPath, double* pC
break; break;
} }
} }
*/
} }
void RedactOutputDev::DoPath(GfxState* pGState, GfxPath* pPath, double* pCTM) void RedactOutputDev::DoPath(GfxState* pGState, GfxPath* pPath, double* pCTM)
{ {