Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: core/fpdfapi/fpdf_page/fpdf_page_parser.cpp

Issue 2285283003: Revert "Add -> operators to CFX_CountRef." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_textstate.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 3afcf4b7d1fd8ccf6317f6203cfef8a52ceede44..f1101034ae2c3ce7388829ae933fe111033dd0de 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<CFX_GraphStateData::LineJoin>(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<CFX_GraphStateData::LineCap>(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<CPDF_TextObject> 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();
}
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_textstate.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698