Fix RedactOutputDev

This commit is contained in:
Svetlana Kulikova
2025-10-12 17:09:38 +03:00
parent 2a3f90ab93
commit cabd994f5f
3 changed files with 22 additions and 101 deletions

View File

@ -1,4 +1,4 @@
/*
/*
* (c) Copyright Ascensio System SIA 2010-2023
*
* This program is a free software product. You can redistribute it and/or
@ -142,11 +142,6 @@ void RedactOutputDev::updateAll(GfxState *pGState)
updateFont(pGState);
m_bUpdateAll = false;
}
void RedactOutputDev::updateCTM(GfxState *pGState, double dMatrix11, double dMatrix12, double dMatrix21, double dMatrix22, double dMatrix31, double dMatrix32)
{
// TODO применять только непосредственно при записи
//m_pPage->Concat(dMatrix11, dMatrix12, dMatrix21, dMatrix22, dMatrix31, dMatrix32);
}
void RedactOutputDev::updateLineDash(GfxState *pGState)
{
double* pDash = NULL;
@ -203,14 +198,6 @@ void RedactOutputDev::updateLineWidth(GfxState *pGState)
m_pRenderer->m_oPen.SetSize(pGState->getLineWidth());
if (!m_bUpdateAll && !m_sStates.empty())
m_sStates.back().m_arrOp.push_back(std::make_pair(std::to_string(pGState->getLineWidth()), "w"));
}
void RedactOutputDev::updateFillColorSpace(GfxState *pGState)
{
}
void RedactOutputDev::updateStrokeColorSpace(GfxState *pGState)
{
}
void RedactOutputDev::updateFillColor(GfxState *pGState)
{
@ -317,12 +304,6 @@ void RedactOutputDev::updateFont(GfxState *pGState)
else
m_pRenderer->put_FontName(L"");
}
void RedactOutputDev::updateTextMat(GfxState *pGState)
{
//double* dTM = pGState->getTextMat();
// TODO
//m_pPage->SetTextMatrix(dTM[0], dTM[1], dTM[2], dTM[3], dTM[4], dTM[5]);
}
void RedactOutputDev::updateCharSpace(GfxState *pGState)
{
m_pRenderer->m_oFont.SetCharSpace(pGState->getCharSpace());
@ -344,14 +325,6 @@ void RedactOutputDev::updateHorizScaling(GfxState *pGState)
{
m_pRenderer->m_oFont.SetHorizontalScaling(pGState->getHorizScaling() * 100);
}
void RedactOutputDev::updateTextPos(GfxState *pGState)
{
// TODO Это Td, но опять таки нужно смещать к реальному тексту который не попадает под Redact
}
void RedactOutputDev::updateTextShift(GfxState *pGState, double shift)
{
// TODO Смещение между строками в TJ, т.е. ~ TL межстрочный интервал
}
//----- path painting
void RedactOutputDev::stroke(GfxState *pGState)
{
@ -371,12 +344,6 @@ void RedactOutputDev::eoFill(GfxState *pGState)
void RedactOutputDev::tilingPatternFill(GfxState *pGState, Gfx *gfx, Object *pStream, int nPaintType, int nTilingType, Dict *pResourcesDict,
double *pMatrix, double *pBBox, int nX0, int nY0, int nX1, int nY1, double dXStep, double dYStep)
{
// TODO Нужно как-то пересечь области заливки паттерном
}
GBool RedactOutputDev::shadedFill(GfxState* pGState, GfxShading* shading)
{
// TODO Нужно как-то пересечь области градиентой заливки
return gFalse;
}
//----- path clipping
void RedactOutputDev::clip(GfxState *pGState)
@ -417,18 +384,6 @@ void RedactOutputDev::beginStringOp(GfxState *pGState)
{
m_pRenderer->m_oCommandManager.Flush();
DoStateOp();
}
void RedactOutputDev::endStringOp(GfxState *pGState)
{
}
void RedactOutputDev::beginString(GfxState *pGState, GString *s)
{
}
void RedactOutputDev::endString(GfxState *pGState)
{
}
void RedactOutputDev::drawChar(GfxState *pGState, double dX, double dY, double dDx, double dDy, double dOriginX, double dOriginY,
CharCode nCode, int nBytesCount, Unicode *pUnicode, int nUnicodeLen)
@ -532,40 +487,8 @@ void RedactOutputDev::drawChar(GfxState *pGState, double dX, double dY, double d
pText->SetWidth(dDx);
m_pRenderer->put_FontSize(dOldSize);
}
GBool RedactOutputDev::beginType3Char(GfxState *pGState, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen)
{
return gFalse;
}
void RedactOutputDev::endType3Char(GfxState *pGState)
{
}
void RedactOutputDev::endTextObject(GfxState *pGState)
{
}
void RedactOutputDev::beginActualText(GfxState *state, Unicode *u, int uLen)
{
}
void RedactOutputDev::endActualText(GfxState *state)
{
}
//----- additional
GBool RedactOutputDev::beginMarkedContent(GfxState *pGState, GString *s)
{
return gFalse;
}
GBool RedactOutputDev::beginMCOShapes(GfxState *pGState, GString *s, Object *ref)
{
return gFalse;
}
void RedactOutputDev::endMarkedContent(GfxState *pGState)
{
}
GBool RedactOutputDev::useNameOp()
{
return gTrue;

View File

@ -95,7 +95,7 @@ namespace PdfWriter
virtual void restoreState(GfxState *pGState) override;
//----- update graphics state
virtual void updateAll(GfxState *pGState) override;
virtual void updateCTM(GfxState *pGState, double dMatrix11, double dMatrix12, double dMatrix21, double dMatrix22, double dMatrix31, double dMatrix32) override;
// updateCTM -> UpdateTransform
virtual void updateLineDash(GfxState *pGState) override;
virtual void updateFlatness(GfxState *pGState) override;
virtual void updateLineJoin(GfxState *pGState) override;
@ -103,8 +103,8 @@ namespace PdfWriter
virtual void updateMiterLimit(GfxState *pGState) override;
virtual void updateLineWidth(GfxState *pGState) override;
// updateStrokeAdjust -> setExtGState
virtual void updateFillColorSpace(GfxState *pGState) override;
virtual void updateStrokeColorSpace(GfxState *pGState) override;
// updateFillColorSpace
// updateStrokeColorSpace
virtual void updateFillColor(GfxState *pGState) override;
virtual void updateStrokeColor(GfxState *pGState) override;
// updateBlendMode -> setExtGState
@ -117,14 +117,14 @@ namespace PdfWriter
// updateTransfer -> setExtGState
//----- update text state
virtual void updateFont(GfxState *pGState) override;
virtual void updateTextMat(GfxState *pGState) override;
// updateTextMat -> drawChar
virtual void updateCharSpace(GfxState *pGState) override;
virtual void updateRender(GfxState *pGState) override;
virtual void updateRise(GfxState *pGState) override;
virtual void updateWordSpace(GfxState *pGState) override;
virtual void updateHorizScaling(GfxState *pGState) override;
virtual void updateTextPos(GfxState *pGState) override;
virtual void updateTextShift(GfxState *pGState, double shift) override;
// updateTextPos -> drawChar
// updateTextShift -> drawChar
// saveTextPos
// restoreTextPos
//----- path painting
@ -132,27 +132,26 @@ namespace PdfWriter
virtual void fill(GfxState *pGState) override;
virtual void eoFill(GfxState *pGState) override;
virtual void tilingPatternFill(GfxState *pGState, Gfx *gfx, Object *pStream, int nPaintType, int nTilingType, Dict *pResourcesDict, double *pMatrix, double *pBBox, int nX0, int nY0, int nX1, int nY1, double dXStep, double dYStep) override;
virtual GBool shadedFill(GfxState* pGState, GfxShading* shading) override;
//----- path clipping
virtual void clip(GfxState *pGState) override;
virtual void eoClip(GfxState *pGState) override;
virtual void clipToStrokePath(GfxState *pGState) override;
//----- text drawing
virtual void beginStringOp(GfxState *pGState) override;
virtual void endStringOp(GfxState *pGState) override;
virtual void beginString(GfxState *pGState, GString *s) override;
virtual void endString(GfxState *pGState) override;
// endStringOp
// beginString
// endString
virtual void drawChar(GfxState *pGState, double dX, double dY, double dDx, double dDy, double dOriginX, double dOriginY, CharCode nCode, int nBytesCount, Unicode *pUnicode, int nUnicodeLen) override;
// drawString
virtual GBool beginType3Char(GfxState *pGState, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) override;
virtual void endType3Char(GfxState *pGState) override;
virtual void endTextObject(GfxState *pGState) override;
virtual void beginActualText(GfxState *state, Unicode *u, int uLen) override;
virtual void endActualText(GfxState *state) override;
// beginType3Char
// endType3Char
// endTextObject
// beginActualText
// endActualText
//----- additional
virtual GBool beginMarkedContent(GfxState *pGState, GString *s) override;
virtual GBool beginMCOShapes(GfxState *pGState, GString *s, Object *ref) override;
virtual void endMarkedContent(GfxState *pGState) override;
// beginMarkedContent
// beginMCOShapes
// endMarkedContent
virtual GBool useNameOp() override;
virtual void setExtGState(const char* name) override;
virtual void setFillColorSpace(const char* name) override;

View File

@ -2385,17 +2385,16 @@ void Gfx::opShFill(Object args[], int numArgs) {
return;
}
if (!(shading = res->lookupShading(args[0].getName()
))) {
return;
}
if (out->useNameOp())
{
out->setShading(state, args[0].getName());
return;
}
if (!(shading = res->lookupShading(args[0].getName()
))) {
return;
}
// save current graphics state
savedState = saveStateStack();