From d24c3a60d0e6e5badef57d3baf55e5c3b6d4882e Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 29 Aug 2016 14:42:36 -0700 Subject: Revert "Add -> operators to CFX_CountRef." This reverts commit c10c23a2b1999b1cb0354fd4db9837dc63a3d833. TBR=dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2285283003 --- core/fpdfapi/fpdf_page/cpdf_allstates.cpp | 71 ++++++++--------- core/fpdfapi/fpdf_page/cpdf_clippath.cpp | 9 +-- core/fpdfapi/fpdf_page/cpdf_colorstate.cpp | 12 +-- core/fpdfapi/fpdf_page/cpdf_generalstate.cpp | 3 +- core/fpdfapi/fpdf_page/cpdf_pageobject.cpp | 6 +- core/fpdfapi/fpdf_page/cpdf_pathobject.cpp | 4 +- core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_textobject.cpp | 10 +-- core/fpdfapi/fpdf_page/cpdf_textstate.cpp | 19 ++--- core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 100 +++++++++++------------- core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 11 ++- core/fpdfapi/fpdf_page/include/cpdf_path.h | 3 +- core/fpdfapi/fpdf_render/fpdf_render.cpp | 28 +++---- core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 5 +- core/fpdftext/cpdf_textpage.cpp | 8 +- core/fxcrt/cfx_count_ref_unittest.cpp | 9 +-- core/fxcrt/include/cfx_count_ref.h | 11 ++- core/fxge/ge/cfx_cliprgn.cpp | 4 +- fpdfsdk/fpdf_transformpage.cpp | 4 +- fpdfsdk/fpdfeditimg.cpp | 4 +- fpdfsdk/fxedit/fxet_edit.cpp | 25 +++--- 21 files changed, 160 insertions(+), 188 deletions(-) diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp index fb0c2445e7..e4b6e328b9 100644 --- a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp @@ -45,16 +45,16 @@ void CPDF_AllStates::Copy(const CPDF_AllStates& src) { void CPDF_AllStates::SetLineDash(CPDF_Array* pArray, FX_FLOAT phase, FX_FLOAT scale) { - m_GraphState.MakePrivateCopy(); - m_GraphState->m_DashPhase = phase * scale; - m_GraphState->SetDashCount(static_cast(pArray->GetCount())); + CFX_GraphStateData* pData = m_GraphState.GetPrivateCopy(); + pData->m_DashPhase = phase * scale; + pData->SetDashCount(static_cast(pArray->GetCount())); for (size_t i = 0; i < pArray->GetCount(); i++) - m_GraphState->m_DashArray[i] = pArray->GetNumberAt(i) * scale; + pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale; } void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, CPDF_StreamContentParser* pParser) { - m_GeneralState.MakePrivateCopy(); + CPDF_GeneralStateData* pGeneralState = m_GeneralState.GetPrivateCopy(); for (const auto& it : *pGS) { const CFX_ByteString& key_str = it.first; CPDF_Object* pElement = it.second; @@ -65,22 +65,18 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, uint32_t key = key_str.GetID(); switch (key) { case FXBSTR_ID('L', 'W', 0, 0): - m_GraphState.MakePrivateCopy(); - m_GraphState->m_LineWidth = pObject->GetNumber(); + m_GraphState.GetPrivateCopy()->m_LineWidth = pObject->GetNumber(); break; case FXBSTR_ID('L', 'C', 0, 0): - m_GraphState.MakePrivateCopy(); - m_GraphState->m_LineCap = - static_cast(pObject->GetInteger()); + m_GraphState.GetPrivateCopy()->m_LineCap = + (CFX_GraphStateData::LineCap)pObject->GetInteger(); break; case FXBSTR_ID('L', 'J', 0, 0): - m_GraphState.MakePrivateCopy(); - m_GraphState->m_LineJoin = - static_cast(pObject->GetInteger()); + m_GraphState.GetPrivateCopy()->m_LineJoin = + (CFX_GraphStateData::LineJoin)pObject->GetInteger(); break; case FXBSTR_ID('M', 'L', 0, 0): - m_GraphState.MakePrivateCopy(); - m_GraphState->m_MiterLimit = pObject->GetNumber(); + m_GraphState.GetPrivateCopy()->m_MiterLimit = pObject->GetNumber(); break; case FXBSTR_ID('D', 0, 0, 0): { CPDF_Array* pDash = pObject->AsArray(); @@ -102,8 +98,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, if (!pFont) break; - m_TextState.MakePrivateCopy(); - m_TextState->m_FontSize = pFont->GetNumberAt(1); + m_TextState.GetPrivateCopy()->m_FontSize = pFont->GetNumberAt(1); m_TextState.SetFont(pParser->FindFont(pFont->GetStringAt(0))); break; } @@ -112,7 +107,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, continue; } case FXBSTR_ID('T', 'R', '2', 0): - m_GeneralState->m_pTR = + pGeneralState->m_pTR = (pObject && !pObject->IsName()) ? pObject : nullptr; break; case FXBSTR_ID('B', 'M', 0, 0): { @@ -120,72 +115,72 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, CFX_ByteString mode = pArray ? pArray->GetStringAt(0) : pObject->GetString(); - m_GeneralState->SetBlendMode(mode.AsStringC()); - if (m_GeneralState->m_BlendType > FXDIB_BLEND_MULTIPLY) { + pGeneralState->SetBlendMode(mode.AsStringC()); + if (pGeneralState->m_BlendType > FXDIB_BLEND_MULTIPLY) { pParser->GetPageObjectHolder()->SetBackgroundAlphaNeeded(TRUE); } break; } case FXBSTR_ID('S', 'M', 'a', 's'): if (ToDictionary(pObject)) { - m_GeneralState->m_pSoftMask = pObject; - FXSYS_memcpy(m_GeneralState->m_SMaskMatrix, + pGeneralState->m_pSoftMask = pObject; + FXSYS_memcpy(pGeneralState->m_SMaskMatrix, &pParser->GetCurStates()->m_CTM, sizeof(CFX_Matrix)); } else { - m_GeneralState->m_pSoftMask = nullptr; + pGeneralState->m_pSoftMask = nullptr; } break; case FXBSTR_ID('C', 'A', 0, 0): - m_GeneralState->m_StrokeAlpha = ClipFloat(pObject->GetNumber()); + pGeneralState->m_StrokeAlpha = ClipFloat(pObject->GetNumber()); break; case FXBSTR_ID('c', 'a', 0, 0): - m_GeneralState->m_FillAlpha = ClipFloat(pObject->GetNumber()); + pGeneralState->m_FillAlpha = ClipFloat(pObject->GetNumber()); break; case FXBSTR_ID('O', 'P', 0, 0): - m_GeneralState->m_StrokeOP = pObject->GetInteger(); + pGeneralState->m_StrokeOP = pObject->GetInteger(); if (!pGS->KeyExist("op")) { - m_GeneralState->m_FillOP = pObject->GetInteger(); + pGeneralState->m_FillOP = pObject->GetInteger(); } break; case FXBSTR_ID('o', 'p', 0, 0): - m_GeneralState->m_FillOP = pObject->GetInteger(); + pGeneralState->m_FillOP = pObject->GetInteger(); break; case FXBSTR_ID('O', 'P', 'M', 0): - m_GeneralState->m_OPMode = pObject->GetInteger(); + pGeneralState->m_OPMode = pObject->GetInteger(); break; case FXBSTR_ID('B', 'G', 0, 0): if (pGS->KeyExist("BG2")) { continue; } case FXBSTR_ID('B', 'G', '2', 0): - m_GeneralState->m_pBG = pObject; + pGeneralState->m_pBG = pObject; break; case FXBSTR_ID('U', 'C', 'R', 0): if (pGS->KeyExist("UCR2")) { continue; } case FXBSTR_ID('U', 'C', 'R', '2'): - m_GeneralState->m_pUCR = pObject; + pGeneralState->m_pUCR = pObject; break; case FXBSTR_ID('H', 'T', 0, 0): - m_GeneralState->m_pHT = pObject; + pGeneralState->m_pHT = pObject; break; case FXBSTR_ID('F', 'L', 0, 0): - m_GeneralState->m_Flatness = pObject->GetNumber(); + pGeneralState->m_Flatness = pObject->GetNumber(); break; case FXBSTR_ID('S', 'M', 0, 0): - m_GeneralState->m_Smoothness = pObject->GetNumber(); + pGeneralState->m_Smoothness = pObject->GetNumber(); break; case FXBSTR_ID('S', 'A', 0, 0): - m_GeneralState->m_StrokeAdjust = pObject->GetInteger(); + pGeneralState->m_StrokeAdjust = pObject->GetInteger(); break; case FXBSTR_ID('A', 'I', 'S', 0): - m_GeneralState->m_AlphaSource = pObject->GetInteger(); + pGeneralState->m_AlphaSource = pObject->GetInteger(); break; case FXBSTR_ID('T', 'K', 0, 0): - m_GeneralState->m_TextKnockout = pObject->GetInteger(); + pGeneralState->m_TextKnockout = pObject->GetInteger(); break; } } - m_GeneralState->m_Matrix = m_CTM; + pGeneralState->m_Matrix = m_CTM; } diff --git a/core/fpdfapi/fpdf_page/cpdf_clippath.cpp b/core/fpdfapi/fpdf_page/cpdf_clippath.cpp index 2c05df0d19..e820260131 100644 --- a/core/fpdfapi/fpdf_page/cpdf_clippath.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_clippath.cpp @@ -73,8 +73,7 @@ CFX_FloatRect CPDF_ClipPath::GetClipBox() const { } void CPDF_ClipPath::AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge) { - MakePrivateCopy(); - CPDF_ClipPathData* pData = GetObject(); + CPDF_ClipPathData* pData = GetPrivateCopy(); if (!pData->m_PathAndTypeList.empty() && bAutoMerge) { const CPDF_Path& old_path = pData->m_PathAndTypeList.back().first; if (old_path.IsRect()) { @@ -90,8 +89,7 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge) { void CPDF_ClipPath::AppendTexts( std::vector>* pTexts) { - MakePrivateCopy(); - CPDF_ClipPathData* pData = GetObject(); + CPDF_ClipPathData* pData = GetPrivateCopy(); if (pData->m_TextList.size() + pTexts->size() <= FPDF_CLIPPATH_MAX_TEXTS) { for (size_t i = 0; i < pTexts->size(); i++) pData->m_TextList.push_back(std::move((*pTexts)[i])); @@ -101,8 +99,7 @@ void CPDF_ClipPath::AppendTexts( } void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) { - MakePrivateCopy(); - CPDF_ClipPathData* pData = GetObject(); + CPDF_ClipPathData* pData = GetPrivateCopy(); for (auto& obj : pData->m_PathAndTypeList) obj.first.Transform(&matrix); for (auto& text : pData->m_TextList) { diff --git a/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp b/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp index a46dea3bb8..a2234378eb 100644 --- a/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp @@ -13,16 +13,14 @@ void CPDF_ColorState::SetFillColor(CPDF_ColorSpace* pCS, FX_FLOAT* pValue, uint32_t nValues) { - MakePrivateCopy(); - CPDF_ColorStateData* pData = GetObject(); + CPDF_ColorStateData* pData = GetPrivateCopy(); SetColor(pData->m_FillColor, pData->m_FillRGB, pCS, pValue, nValues); } void CPDF_ColorState::SetStrokeColor(CPDF_ColorSpace* pCS, FX_FLOAT* pValue, uint32_t nValues) { - MakePrivateCopy(); - CPDF_ColorStateData* pData = GetObject(); + CPDF_ColorStateData* pData = GetPrivateCopy(); SetColor(pData->m_StrokeColor, pData->m_StrokeRGB, pCS, pValue, nValues); } @@ -47,8 +45,7 @@ void CPDF_ColorState::SetColor(CPDF_Color& color, void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern, FX_FLOAT* pValue, uint32_t nValues) { - MakePrivateCopy(); - CPDF_ColorStateData* pData = GetObject(); + CPDF_ColorStateData* pData = GetPrivateCopy(); pData->m_FillColor.SetValue(pPattern, pValue, nValues); int R, G, B; FX_BOOL ret = pData->m_FillColor.GetRGB(R, G, B); @@ -64,8 +61,7 @@ void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern, void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern, FX_FLOAT* pValue, uint32_t nValues) { - MakePrivateCopy(); - CPDF_ColorStateData* pData = GetObject(); + CPDF_ColorStateData* pData = GetPrivateCopy(); pData->m_StrokeColor.SetValue(pPattern, pValue, nValues); int R, G, B; FX_BOOL ret = pData->m_StrokeColor.GetRGB(R, G, B); diff --git a/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp b/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp index ff22d4d74b..0f6cce6e29 100644 --- a/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp @@ -25,6 +25,5 @@ int RI_StringToId(const CFX_ByteString& ri) { } // namespace void CPDF_GeneralState::SetRenderIntent(const CFX_ByteString& ri) { - MakePrivateCopy(); - GetObject()->m_RenderIntent = RI_StringToId(ri); + GetPrivateCopy()->m_RenderIntent = RI_StringToId(ri); } diff --git a/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp b/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp index df777dfb92..17014c4883 100644 --- a/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_pageobject.cpp @@ -81,15 +81,15 @@ void CPDF_PageObject::CopyData(const CPDF_PageObject* pSrc) { void CPDF_PageObject::TransformClipPath(CFX_Matrix& matrix) { if (!m_ClipPath) return; - m_ClipPath.MakePrivateCopy(); + m_ClipPath.GetPrivateCopy(); m_ClipPath.Transform(matrix); } void CPDF_PageObject::TransformGeneralState(CFX_Matrix& matrix) { if (!m_GeneralState) return; - m_GeneralState.MakePrivateCopy(); - m_GeneralState->m_Matrix.Concat(matrix); + CPDF_GeneralStateData* pGS = m_GeneralState.GetPrivateCopy(); + pGS->m_Matrix.Concat(matrix); } FX_RECT CPDF_PageObject::GetBBox(const CFX_Matrix* pMatrix) const { diff --git a/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp b/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp index ceb3dd43cc..0055d6a133 100644 --- a/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp @@ -46,9 +46,9 @@ void CPDF_PathObject::CalcBoundingBox() { if (!m_Path) return; CFX_FloatRect rect; - FX_FLOAT width = m_GraphState->m_LineWidth; + FX_FLOAT width = m_GraphState.GetObject()->m_LineWidth; if (m_bStroke && width != 0) { - rect = m_Path.GetBoundingBox(width, m_GraphState->m_MiterLimit); + rect = m_Path.GetBoundingBox(width, m_GraphState.GetObject()->m_MiterLimit); } else { rect = m_Path.GetBoundingBox(); } diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp b/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp index 383fd154e5..d869bc20b3 100644 --- a/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp @@ -36,7 +36,7 @@ CPDF_PageObject::Type CPDF_ShadingObject::GetType() const { void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) { if (m_ClipPath) { - m_ClipPath.MakePrivateCopy(); + m_ClipPath.GetPrivateCopy(); m_ClipPath.Transform(matrix); } m_Matrix.Concat(matrix); diff --git a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp index a3653359de..bd17dea86e 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp @@ -133,7 +133,7 @@ CPDF_PageObject::Type CPDF_TextObject::GetType() const { } void CPDF_TextObject::Transform(const CFX_Matrix& matrix) { - m_TextState.MakePrivateCopy(); + m_TextState.GetPrivateCopy(); CFX_Matrix text_matrix; GetTextMatrix(&text_matrix); text_matrix.Concat(matrix); @@ -334,9 +334,9 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, } curpos += charwidth; if (charcode == ' ' && (!pCIDFont || pCIDFont->GetCharSize(32) == 1)) { - curpos += m_TextState->m_WordSpace; + curpos += m_TextState.GetObject()->m_WordSpace; } - curpos += m_TextState->m_CharSpace; + curpos += m_TextState.GetObject()->m_CharSpace; } if (bVertWriting) { if (pTextAdvanceX) { @@ -364,8 +364,8 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, m_Bottom = min_y; m_Top = max_y; matrix.TransformRect(m_Left, m_Right, m_Top, m_Bottom); - if (TextRenderingModeIsStrokeMode(m_TextState->m_TextMode)) { - FX_FLOAT half_width = m_GraphState->m_LineWidth / 2; + if (TextRenderingModeIsStrokeMode(m_TextState.GetObject()->m_TextMode)) { + FX_FLOAT half_width = m_GraphState.GetObject()->m_LineWidth / 2; m_Left -= half_width; m_Right += half_width; m_Top += half_width; diff --git a/core/fpdfapi/fpdf_page/cpdf_textstate.cpp b/core/fpdfapi/fpdf_page/cpdf_textstate.cpp index 47e2116836..ae75876664 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textstate.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textstate.cpp @@ -10,15 +10,16 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" void CPDF_TextState::SetFont(CPDF_Font* pFont) { - MakePrivateCopy(); - CPDF_TextStateData* pStateData = GetObject(); - CPDF_Document* pDoc = pStateData->m_pDocument; - CPDF_DocPageData* pPageData = pDoc ? pDoc->GetPageData() : nullptr; - if (pPageData && pStateData->m_pFont && !pPageData->IsForceClear()) - pPageData->ReleaseFont(pStateData->m_pFont->GetFontDict()); - - pStateData->m_pDocument = pFont ? pFont->m_pDocument : nullptr; - pStateData->m_pFont = pFont; + CPDF_TextStateData* pStateData = GetPrivateCopy(); + if (pStateData) { + CPDF_Document* pDoc = pStateData->m_pDocument; + CPDF_DocPageData* pPageData = pDoc ? pDoc->GetPageData() : nullptr; + if (pPageData && pStateData->m_pFont && !pPageData->IsForceClear()) { + pPageData->ReleaseFont(pStateData->m_pFont->GetFontDict()); + } + pStateData->m_pDocument = pFont ? pFont->m_pDocument : nullptr; + pStateData->m_pFont = pFont; + } } FX_FLOAT CPDF_TextState::GetFontSizeV() const { diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 3afcf4b7d1..f1101034ae 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -583,8 +583,7 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() { bDirect = FALSE; } if (CPDF_Dictionary* pDict = pProperty->AsDictionary()) { - m_CurContentMark.MakePrivateCopy(); - m_CurContentMark->AddMark(tag, pDict, bDirect); + m_CurContentMark.GetPrivateCopy()->AddMark(tag, pDict, bDirect); } } @@ -659,8 +658,8 @@ void CPDF_StreamContentParser::Handle_BeginImage() { } void CPDF_StreamContentParser::Handle_BeginMarkedContent() { - m_CurContentMark.MakePrivateCopy(); - m_CurContentMark->AddMark(GetString(0), nullptr, FALSE); + CFX_ByteString tag = GetString(0); + m_CurContentMark.GetPrivateCopy()->AddMark(tag, nullptr, FALSE); } void CPDF_StreamContentParser::Handle_BeginText() { @@ -687,21 +686,21 @@ void CPDF_StreamContentParser::Handle_ConcatMatrix() { } void CPDF_StreamContentParser::Handle_SetColorSpace_Fill() { - CPDF_ColorSpace* pCS = FindColorSpace(GetString(0)); - if (!pCS) + CFX_ByteString csname = GetString(0); + CPDF_ColorSpace* pCS = FindColorSpace(csname); + if (!pCS) { return; - - m_pCurStates->m_ColorState.MakePrivateCopy(); - m_pCurStates->m_ColorState->m_FillColor.SetColorSpace(pCS); + } + m_pCurStates->m_ColorState.GetPrivateCopy()->m_FillColor.SetColorSpace(pCS); } void CPDF_StreamContentParser::Handle_SetColorSpace_Stroke() { - CPDF_ColorSpace* pCS = FindColorSpace(GetString(0)); - if (!pCS) + CFX_ByteString csname = GetString(0); + CPDF_ColorSpace* pCS = FindColorSpace(csname); + if (!pCS) { return; - - m_pCurStates->m_ColorState.MakePrivateCopy(); - m_pCurStates->m_ColorState->m_StrokeColor.SetColorSpace(pCS); + } + m_pCurStates->m_ColorState.GetPrivateCopy()->m_StrokeColor.SetColorSpace(pCS); } void CPDF_StreamContentParser::Handle_SetDash() { @@ -812,22 +811,22 @@ void CPDF_StreamContentParser::Handle_EndMarkedContent() { if (!m_CurContentMark) return; - if (m_CurContentMark->CountItems() == 1) { - m_CurContentMark.Clear(); + int count = m_CurContentMark.GetObject()->CountItems(); + if (count == 1) { + m_CurContentMark.SetNull(); return; } - - m_CurContentMark.MakePrivateCopy(); - m_CurContentMark->DeleteLastMark(); + m_CurContentMark.GetPrivateCopy()->DeleteLastMark(); } void CPDF_StreamContentParser::Handle_EndText() { if (m_ClipTextList.empty()) return; - if (TextRenderingModeIsClipMode(m_pCurStates->m_TextState->m_TextMode)) + if (TextRenderingModeIsClipMode( + m_pCurStates->m_TextState.GetObject()->m_TextMode)) { m_pCurStates->m_ClipPath.AppendTexts(&m_ClipTextList); - + } m_ClipTextList.clear(); } @@ -877,22 +876,19 @@ void CPDF_StreamContentParser::Handle_ClosePath() { } void CPDF_StreamContentParser::Handle_SetFlat() { - m_pCurStates->m_GeneralState.MakePrivateCopy(); - m_pCurStates->m_GeneralState->m_Flatness = GetNumber(0); + m_pCurStates->m_GeneralState.GetPrivateCopy()->m_Flatness = GetNumber(0); } void CPDF_StreamContentParser::Handle_BeginImageData() {} void CPDF_StreamContentParser::Handle_SetLineJoin() { - m_pCurStates->m_GraphState.MakePrivateCopy(); - m_pCurStates->m_GraphState->m_LineJoin = - static_cast(GetInteger(0)); + m_pCurStates->m_GraphState.GetPrivateCopy()->m_LineJoin = + (CFX_GraphStateData::LineJoin)GetInteger(0); } void CPDF_StreamContentParser::Handle_SetLineCap() { - m_pCurStates->m_GraphState.MakePrivateCopy(); - m_pCurStates->m_GraphState->m_LineCap = - static_cast(GetInteger(0)); + m_pCurStates->m_GraphState.GetPrivateCopy()->m_LineCap = + (CFX_GraphStateData::LineCap)GetInteger(0); } void CPDF_StreamContentParser::Handle_SetCMYKColor_Fill() { @@ -935,8 +931,7 @@ void CPDF_StreamContentParser::Handle_MoveTo() { } void CPDF_StreamContentParser::Handle_SetMiterLimit() { - m_pCurStates->m_GraphState.MakePrivateCopy(); - m_pCurStates->m_GraphState->m_MiterLimit = GetNumber(0); + m_pCurStates->m_GraphState.GetPrivateCopy()->m_MiterLimit = GetNumber(0); } void CPDF_StreamContentParser::Handle_MarkPlace() {} @@ -1119,8 +1114,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill() { } void CPDF_StreamContentParser::Handle_SetCharSpace() { - m_pCurStates->m_TextState.MakePrivateCopy(); - m_pCurStates->m_TextState->m_CharSpace = GetNumber(0); + m_pCurStates->m_TextState.GetPrivateCopy()->m_CharSpace = GetNumber(0); } void CPDF_StreamContentParser::Handle_MoveTextPoint() { @@ -1137,14 +1131,14 @@ void CPDF_StreamContentParser::Handle_MoveTextPoint_SetLeading() { void CPDF_StreamContentParser::Handle_SetFont() { FX_FLOAT fs = GetNumber(0); - if (fs == 0) + if (fs == 0) { fs = m_DefFontSize; - - m_pCurStates->m_TextState.MakePrivateCopy(); - m_pCurStates->m_TextState->m_FontSize = fs; + } + m_pCurStates->m_TextState.GetPrivateCopy()->m_FontSize = fs; CPDF_Font* pFont = FindFont(GetString(1)); - if (pFont) + if (pFont) { m_pCurStates->m_TextState.SetFont(pFont); + } } CPDF_Object* CPDF_StreamContentParser::FindResourceObj( @@ -1249,14 +1243,13 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, } const TextRenderingMode text_mode = pFont->IsType3Font() ? TextRenderingMode::MODE_FILL - : m_pCurStates->m_TextState->m_TextMode; + : m_pCurStates->m_TextState.GetObject()->m_TextMode; { std::unique_ptr pText(new CPDF_TextObject); m_pLastTextObject = pText.get(); SetGraphicStates(m_pLastTextObject, TRUE, TRUE, TRUE); if (TextRenderingModeIsStrokeMode(text_mode)) { - pText->m_TextState.MakePrivateCopy(); - FX_FLOAT* pCTM = pText->m_TextState->m_CTM; + FX_FLOAT* pCTM = pText->m_TextState.GetPrivateCopy()->m_CTM; pCTM[0] = m_pCurStates->m_CTM.a; pCTM[1] = m_pCurStates->m_CTM.c; pCTM[2] = m_pCurStates->m_CTM.b; @@ -1365,8 +1358,7 @@ void CPDF_StreamContentParser::OnChangeTextMatrix() { text_matrix.Concat(m_pCurStates->m_TextMatrix); text_matrix.Concat(m_pCurStates->m_CTM); text_matrix.Concat(m_mtContentToUser); - m_pCurStates->m_TextState.MakePrivateCopy(); - FX_FLOAT* pTextMatrix = m_pCurStates->m_TextState->m_Matrix; + FX_FLOAT* pTextMatrix = m_pCurStates->m_TextState.GetPrivateCopy()->m_Matrix; pTextMatrix[0] = text_matrix.a; pTextMatrix[1] = text_matrix.c; pTextMatrix[2] = text_matrix.b; @@ -1374,9 +1366,9 @@ void CPDF_StreamContentParser::OnChangeTextMatrix() { } void CPDF_StreamContentParser::Handle_SetTextRenderMode() { - m_pCurStates->m_TextState.MakePrivateCopy(); - SetTextRenderingModeFromInt(GetInteger(0), - &m_pCurStates->m_TextState->m_TextMode); + int mode = GetInteger(0); + SetTextRenderingModeFromInt( + mode, &m_pCurStates->m_TextState.GetPrivateCopy()->m_TextMode); } void CPDF_StreamContentParser::Handle_SetTextRise() { @@ -1384,14 +1376,13 @@ void CPDF_StreamContentParser::Handle_SetTextRise() { } void CPDF_StreamContentParser::Handle_SetWordSpace() { - m_pCurStates->m_TextState.MakePrivateCopy(); - m_pCurStates->m_TextState->m_WordSpace = GetNumber(0); + m_pCurStates->m_TextState.GetPrivateCopy()->m_WordSpace = GetNumber(0); } void CPDF_StreamContentParser::Handle_SetHorzScale() { - if (m_ParamCount != 1) + if (m_ParamCount != 1) { return; - + } m_pCurStates->m_TextHorzScale = GetNumber(0) / 100; OnChangeTextMatrix(); } @@ -1409,8 +1400,8 @@ void CPDF_StreamContentParser::Handle_CurveTo_23() { } void CPDF_StreamContentParser::Handle_SetLineWidth() { - m_pCurStates->m_GraphState.MakePrivateCopy(); - m_pCurStates->m_GraphState->m_LineWidth = GetNumber(0); + FX_FLOAT width = GetNumber(0); + m_pCurStates->m_GraphState.GetPrivateCopy()->m_LineWidth = width; } void CPDF_StreamContentParser::Handle_Clip() { @@ -1433,9 +1424,8 @@ void CPDF_StreamContentParser::Handle_NextLineShowText() { } void CPDF_StreamContentParser::Handle_NextLineShowText_Space() { - m_pCurStates->m_TextState.MakePrivateCopy(); - m_pCurStates->m_TextState->m_WordSpace = GetNumber(2); - m_pCurStates->m_TextState->m_CharSpace = GetNumber(1); + m_pCurStates->m_TextState.GetPrivateCopy()->m_WordSpace = GetNumber(2); + m_pCurStates->m_TextState.GetPrivateCopy()->m_CharSpace = GetNumber(1); Handle_NextLineShowText(); } diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index 1b37862e99..6fa1df26cd 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -711,9 +711,8 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, TRUE); } if (pForm->m_Transparency & PDFTRANS_GROUP) { - m_pParser->GetCurStates()->m_GeneralState.MakePrivateCopy(); CPDF_GeneralStateData* pData = - m_pParser->GetCurStates()->m_GeneralState.GetObject(); + m_pParser->GetCurStates()->m_GeneralState.GetPrivateCopy(); pData->m_BlendType = FXDIB_BLEND_NORMAL; pData->m_StrokeAlpha = 1.0f; pData->m_FillAlpha = 1.0f; @@ -775,8 +774,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { m_pObjectHolder->m_pDocument, m_pObjectHolder->m_pPageResources, nullptr, nullptr, m_pObjectHolder, m_pObjectHolder->m_pResources, &m_pObjectHolder->m_BBox, nullptr, 0)); - m_pParser->GetCurStates()->m_ColorState.MakePrivateCopy(); - m_pParser->GetCurStates()->m_ColorState->Default(); + m_pParser->GetCurStates()->m_ColorState.GetPrivateCopy()->Default(); } if (m_CurrentOffset >= m_Size) { m_InternalStage = STAGE_CHECKCLIP; @@ -814,8 +812,9 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { ClipPath.GetPointX(2), ClipPath.GetPointY(2)); CFX_FloatRect obj_rect(pObj->m_Left, pObj->m_Bottom, pObj->m_Right, pObj->m_Top); - if (old_rect.Contains(obj_rect)) - pObj->m_ClipPath.Clear(); + if (old_rect.Contains(obj_rect)) { + pObj->m_ClipPath.SetNull(); + } } m_Status = Done; return; diff --git a/core/fpdfapi/fpdf_page/include/cpdf_path.h b/core/fpdfapi/fpdf_page/include/cpdf_path.h index 33db4d755a..98de696004 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_path.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_path.h @@ -27,8 +27,7 @@ class CPDF_Path : public CFX_CountRef { FX_BOOL IsRect() const { return GetObject()->IsRect(); } void Transform(const CFX_Matrix* pMatrix) { - MakePrivateCopy(); - GetObject()->Transform(pMatrix); + GetPrivateCopy()->Transform(pMatrix); } void Append(const CPDF_Path& other, const CFX_Matrix* pMatrix) { GetObject()->Append(other.GetObject(), pMatrix); diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index f5ab9696c7..f77e46d923 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -199,16 +199,16 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, const CPDF_ColorStateData* pParentData = pParentState->m_InitialStates.m_ColorState.GetObject(); if (!pColorData || pColorData->m_FillColor.IsNull()) { - m_InitialStates.m_ColorState.MakePrivateCopy(); - m_InitialStates.m_ColorState->m_FillRGB = pParentData->m_FillRGB; - m_InitialStates.m_ColorState->m_FillColor.Copy( - &pParentData->m_FillColor); + CPDF_ColorStateData* pData = + m_InitialStates.m_ColorState.GetPrivateCopy(); + pData->m_FillRGB = pParentData->m_FillRGB; + pData->m_FillColor.Copy(&pParentData->m_FillColor); } if (!pColorData || pColorData->m_StrokeColor.IsNull()) { - m_InitialStates.m_ColorState.MakePrivateCopy(); - m_InitialStates.m_ColorState->m_StrokeRGB = pParentData->m_FillRGB; - m_InitialStates.m_ColorState->m_StrokeColor.Copy( - &pParentData->m_StrokeColor); + CPDF_ColorStateData* pData = + m_InitialStates.m_ColorState.GetPrivateCopy(); + pData->m_StrokeRGB = pParentData->m_FillRGB; + pData->m_StrokeColor.Copy(&pParentData->m_StrokeColor); } } } else { @@ -579,7 +579,7 @@ void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, if (!ClipPath) { if (m_LastClipPath) { m_pDevice->RestoreState(true); - m_LastClipPath.Clear(); + m_LastClipPath.SetNull(); } return; } @@ -921,11 +921,11 @@ CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates( ? pSrcStates->m_ColorState.GetStrokeColor() : pSrcStates->m_ColorState.GetFillColor(); if (!pObjColor->IsNull()) { - pStates->m_ColorState.MakePrivateCopy(); - pStates->m_ColorState->m_FillRGB = - bStroke ? pSrcStates->m_ColorState->m_StrokeRGB - : pSrcStates->m_ColorState->m_FillRGB; - pStates->m_ColorState->m_StrokeRGB = pStates->m_ColorState->m_FillRGB; + CPDF_ColorStateData* pColorData = pStates->m_ColorState.GetPrivateCopy(); + pColorData->m_FillRGB = + bStroke ? pSrcStates->m_ColorState.GetObject()->m_StrokeRGB + : pSrcStates->m_ColorState.GetObject()->m_FillRGB; + pColorData->m_StrokeRGB = pColorData->m_FillRGB; } return pStates; } diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp index 4b59f1d61a..16d1235f4d 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -231,7 +231,8 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, if (textobj->m_nChars == 0) return TRUE; - const TextRenderingMode& text_render_mode = textobj->m_TextState->m_TextMode; + const TextRenderingMode& text_render_mode = + textobj->m_TextState.GetObject()->m_TextMode; if (text_render_mode == TextRenderingMode::MODE_INVISIBLE) return TRUE; @@ -307,7 +308,7 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, const CFX_Matrix* pDeviceMatrix = pObj2Device; CFX_Matrix device_matrix; if (bStroke) { - const FX_FLOAT* pCTM = textobj->m_TextState->m_CTM; + const FX_FLOAT* pCTM = textobj->m_TextState.GetObject()->m_CTM; if (pCTM[0] != 1.0f || pCTM[3] != 1.0f) { CFX_Matrix ctm(pCTM[0], pCTM[1], pCTM[2], pCTM[3], 0, 0); text_matrix.ConcatInverse(ctm); diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index ca1cbf1925..3981cfee40 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -45,10 +45,10 @@ FX_FLOAT CalculateBaseSpace(const CPDF_TextObject* pTextObj, const CFX_Matrix& matrix) { FX_FLOAT baseSpace = 0.0; const int nItems = pTextObj->CountItems(); - if (pTextObj->m_TextState->m_CharSpace && nItems >= 3) { + if (pTextObj->m_TextState.GetObject()->m_CharSpace && nItems >= 3) { bool bAllChar = true; - FX_FLOAT spacing = - matrix.TransformDistance(pTextObj->m_TextState->m_CharSpace); + FX_FLOAT spacing = matrix.TransformDistance( + pTextObj->m_TextState.GetObject()->m_CharSpace); baseSpace = spacing; for (int i = 0; i < nItems; i++) { CPDF_TextObjectItem item; @@ -1088,7 +1088,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { spacing = -fontsize_h * item.m_OriginX / 1000; continue; } - FX_FLOAT charSpace = pTextObj->m_TextState->m_CharSpace; + FX_FLOAT charSpace = pTextObj->m_TextState.GetObject()->m_CharSpace; if (charSpace > 0.001) spacing += matrix.TransformDistance(charSpace); else if (charSpace < -0.001) diff --git a/core/fxcrt/cfx_count_ref_unittest.cpp b/core/fxcrt/cfx_count_ref_unittest.cpp index 2a36292b54..7651c93f25 100644 --- a/core/fxcrt/cfx_count_ref_unittest.cpp +++ b/core/fxcrt/cfx_count_ref_unittest.cpp @@ -109,19 +109,16 @@ TEST(fxcrt, CountRefGetModify) { Observer observer; { CFX_CountRef ptr; - ptr.MakePrivateCopy(&observer, std::string("one")); - EXPECT_NE(nullptr, ptr.GetObject()); + EXPECT_NE(nullptr, ptr.GetPrivateCopy(&observer, std::string("one"))); EXPECT_EQ(1, observer.GetConstructionCount("one")); EXPECT_EQ(0, observer.GetDestructionCount("one")); - ptr.MakePrivateCopy(&observer, std::string("one")); - EXPECT_NE(nullptr, ptr.GetObject()); + EXPECT_NE(nullptr, ptr.GetPrivateCopy(&observer, std::string("one"))); EXPECT_EQ(1, observer.GetConstructionCount("one")); EXPECT_EQ(0, observer.GetDestructionCount("one")); { CFX_CountRef other(ptr); - ptr.MakePrivateCopy(&observer, std::string("one")); - EXPECT_NE(nullptr, ptr.GetObject()); + EXPECT_NE(nullptr, ptr.GetPrivateCopy(&observer, std::string("one"))); EXPECT_EQ(2, observer.GetConstructionCount("one")); EXPECT_EQ(0, observer.GetDestructionCount("one")); } diff --git a/core/fxcrt/include/cfx_count_ref.h b/core/fxcrt/include/cfx_count_ref.h index 0837894c66..817ce95add 100644 --- a/core/fxcrt/include/cfx_count_ref.h +++ b/core/fxcrt/include/cfx_count_ref.h @@ -29,16 +29,17 @@ class CFX_CountRef { return *this; } - void Clear() { m_pObject.Reset(); } + void SetNull() { m_pObject.Reset(); } ObjClass* GetObject() { return m_pObject.Get(); } const ObjClass* GetObject() const { return m_pObject.Get(); } template - void MakePrivateCopy(Args... params) { + ObjClass* GetPrivateCopy(Args... params) { if (!m_pObject) - m_pObject.Reset(new CountedObj(params...)); - else if (!m_pObject->HasOneRef()) + return New(params...); + if (!m_pObject->HasOneRef()) m_pObject.Reset(new CountedObj(*m_pObject)); + return m_pObject.Get(); } bool operator==(const CFX_CountRef& that) const { @@ -46,8 +47,6 @@ class CFX_CountRef { } bool operator!=(const CFX_CountRef& that) const { return !(*this == that); } operator bool() const { return m_pObject; } - ObjClass& operator*() const { return *m_pObject.Get(); } - ObjClass* operator->() const { return m_pObject.Get(); } private: class CountedObj : public ObjClass { diff --git a/core/fxge/ge/cfx_cliprgn.cpp b/core/fxge/ge/cfx_cliprgn.cpp index 9b20633ee2..41975e4b84 100644 --- a/core/fxge/ge/cfx_cliprgn.cpp +++ b/core/fxge/ge/cfx_cliprgn.cpp @@ -20,7 +20,7 @@ CFX_ClipRgn::~CFX_ClipRgn() {} void CFX_ClipRgn::Reset(const FX_RECT& rect) { m_Type = RectI; m_Box = rect; - m_Mask.Clear(); + m_Mask.SetNull(); } void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) { @@ -77,7 +77,7 @@ void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) { new_box.Intersect(mask_box); if (new_box.IsEmpty()) { m_Type = RectI; - m_Mask.Clear(); + m_Mask.SetNull(); m_Box = new_box; return; } diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index af8bb7de5b..712080a9de 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -220,9 +220,9 @@ DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, float right, float top) { CPDF_ClipPath* pNewClipPath = new CPDF_ClipPath(); - pNewClipPath->MakePrivateCopy(); + pNewClipPath->GetPrivateCopy(); CPDF_Path Path; - Path.MakePrivateCopy(); + Path.GetPrivateCopy(); Path.AppendRect(left, bottom, right, top); pNewClipPath->AppendPath(Path, FXFILL_ALTERNATE, FALSE); return pNewClipPath; diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp index 372e676127..1fe832b877 100644 --- a/fpdfsdk/fpdfeditimg.cpp +++ b/fpdfsdk/fpdfeditimg.cpp @@ -33,7 +33,7 @@ FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, IFX_FileRead* pFile = new CPDF_CustomAccess(fileAccess); CPDF_ImageObject* pImgObj = reinterpret_cast(image_object); - pImgObj->m_GeneralState.MakePrivateCopy(); + pImgObj->m_GeneralState.GetPrivateCopy(); for (int index = 0; index < nCount; index++) { CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); if (pPage) @@ -73,7 +73,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, return FALSE; CPDF_ImageObject* pImgObj = reinterpret_cast(image_object); - pImgObj->m_GeneralState.MakePrivateCopy(); + pImgObj->m_GeneralState.GetPrivateCopy(); for (int index = 0; index < nCount; index++) { CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); if (pPage) diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index c744958e5e..479fa970a1 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -137,9 +137,8 @@ void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder, FX_COLORREF crFill, const CFX_FloatRect& rcFill) { std::unique_ptr pPathObj(new CPDF_PathObject); - pPathObj->m_Path.MakePrivateCopy(); - pPathObj->m_Path->AppendRect(rcFill.left, rcFill.bottom, rcFill.right, - rcFill.top); + CFX_PathData* pPathData = pPathObj->m_Path.GetPrivateCopy(); + pPathData->AppendRect(rcFill.left, rcFill.bottom, rcFill.right, rcFill.top); FX_FLOAT rgb[3]; rgb[0] = FXARGB_R(crFill) / 255.0f; @@ -162,16 +161,16 @@ CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectHolder* pObjectHolder, const CFX_FloatPoint& point, const CFX_ByteString& text) { std::unique_ptr pTxtObj(new CPDF_TextObject); - pTxtObj->m_TextState.MakePrivateCopy(); - pTxtObj->m_TextState->m_pFont = pFont; - pTxtObj->m_TextState->m_FontSize = fFontSize; - pTxtObj->m_TextState->m_CharSpace = fCharSpace; - pTxtObj->m_TextState->m_WordSpace = 0; - pTxtObj->m_TextState->m_TextMode = TextRenderingMode::MODE_FILL; - pTxtObj->m_TextState->m_Matrix[0] = nHorzScale / 100.0f; - pTxtObj->m_TextState->m_Matrix[1] = 0; - pTxtObj->m_TextState->m_Matrix[2] = 0; - pTxtObj->m_TextState->m_Matrix[3] = 1; + CPDF_TextStateData* pTextStateData = pTxtObj->m_TextState.GetPrivateCopy(); + pTextStateData->m_pFont = pFont; + pTextStateData->m_FontSize = fFontSize; + pTextStateData->m_CharSpace = fCharSpace; + pTextStateData->m_WordSpace = 0; + pTextStateData->m_TextMode = TextRenderingMode::MODE_FILL; + pTextStateData->m_Matrix[0] = nHorzScale / 100.0f; + pTextStateData->m_Matrix[1] = 0; + pTextStateData->m_Matrix[2] = 0; + pTextStateData->m_Matrix[3] = 1; FX_FLOAT rgb[3]; rgb[0] = FXARGB_R(crText) / 255.0f; -- cgit v1.2.3