Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/fpdfapi/fpdf_page/pageint.h" | 7 #include "core/fpdfapi/fpdf_page/pageint.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 806 | 806 |
| 807 int count = m_CurContentMark.GetObject()->CountItems(); | 807 int count = m_CurContentMark.GetObject()->CountItems(); |
| 808 if (count == 1) { | 808 if (count == 1) { |
| 809 m_CurContentMark.SetNull(); | 809 m_CurContentMark.SetNull(); |
| 810 return; | 810 return; |
| 811 } | 811 } |
| 812 m_CurContentMark.GetModify()->DeleteLastMark(); | 812 m_CurContentMark.GetModify()->DeleteLastMark(); |
| 813 } | 813 } |
| 814 | 814 |
| 815 void CPDF_StreamContentParser::Handle_EndText() { | 815 void CPDF_StreamContentParser::Handle_EndText() { |
| 816 int count = m_ClipTextList.GetSize(); | 816 if (m_ClipTextList.empty()) |
| 817 if (count == 0) { | |
| 818 return; | 817 return; |
| 819 } | 818 |
| 820 if (m_pCurStates->m_TextState.GetObject()->m_TextMode < 4) { | 819 if (m_pCurStates->m_TextState.GetObject()->m_TextMode >= 4) |
| 821 for (int i = 0; i < count; i++) { | 820 m_pCurStates->m_ClipPath.AppendTexts(&m_ClipTextList); |
| 822 delete m_ClipTextList.GetAt(i); | 821 m_ClipTextList.clear(); |
| 823 } | |
| 824 } else { | |
| 825 m_pCurStates->m_ClipPath.AppendTexts(m_ClipTextList.GetData(), count); | |
| 826 } | |
| 827 m_ClipTextList.RemoveAll(); | |
| 828 } | 822 } |
| 829 | 823 |
| 830 void CPDF_StreamContentParser::Handle_FillPath() { | 824 void CPDF_StreamContentParser::Handle_FillPath() { |
| 831 AddPathObject(FXFILL_WINDING, FALSE); | 825 AddPathObject(FXFILL_WINDING, FALSE); |
| 832 } | 826 } |
| 833 | 827 |
| 834 void CPDF_StreamContentParser::Handle_FillPathOld() { | 828 void CPDF_StreamContentParser::Handle_FillPathOld() { |
| 835 AddPathObject(FXFILL_WINDING, FALSE); | 829 AddPathObject(FXFILL_WINDING, FALSE); |
| 836 } | 830 } |
| 837 | 831 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1277 pText->SetSegments(pStrs, pKerning, nsegs); | 1271 pText->SetSegments(pStrs, pKerning, nsegs); |
| 1278 pText->m_PosX = m_pCurStates->m_TextX; | 1272 pText->m_PosX = m_pCurStates->m_TextX; |
| 1279 pText->m_PosY = m_pCurStates->m_TextY + m_pCurStates->m_TextRise; | 1273 pText->m_PosY = m_pCurStates->m_TextY + m_pCurStates->m_TextRise; |
| 1280 ConvertTextSpace(pText->m_PosX, pText->m_PosY); | 1274 ConvertTextSpace(pText->m_PosX, pText->m_PosY); |
| 1281 FX_FLOAT x_advance; | 1275 FX_FLOAT x_advance; |
| 1282 FX_FLOAT y_advance; | 1276 FX_FLOAT y_advance; |
| 1283 pText->CalcPositionData(&x_advance, &y_advance, | 1277 pText->CalcPositionData(&x_advance, &y_advance, |
| 1284 m_pCurStates->m_TextHorzScale, m_Level); | 1278 m_pCurStates->m_TextHorzScale, m_Level); |
| 1285 m_pCurStates->m_TextX += x_advance; | 1279 m_pCurStates->m_TextX += x_advance; |
| 1286 m_pCurStates->m_TextY += y_advance; | 1280 m_pCurStates->m_TextY += y_advance; |
| 1287 if (textmode > 3) | 1281 if (textmode > 3) { |
| 1288 m_ClipTextList.Add(pText->Clone()); | 1282 m_ClipTextList.push_back( |
|
Lei Zhang
2016/05/19 17:28:46
CPDF_StreamContentParser::Handle_EndText() above s
Tom Sepez
2016/05/19 18:32:03
I'm being dense and not seeing it. Looks like eit
Lei Zhang
2016/05/19 20:44:26
Oh, I read it wrong. Looking again, it's due to Ha
| |
| 1283 std::unique_ptr<CPDF_TextObject>(pText->Clone())); | |
| 1284 } | |
| 1289 m_pObjectHolder->GetPageObjectList()->push_back(std::move(pText)); | 1285 m_pObjectHolder->GetPageObjectList()->push_back(std::move(pText)); |
| 1290 } | 1286 } |
| 1291 if (pKerning && pKerning[nsegs - 1] != 0) { | 1287 if (pKerning && pKerning[nsegs - 1] != 0) { |
| 1292 if (!pFont->IsVertWriting()) { | 1288 if (!pFont->IsVertWriting()) { |
| 1293 m_pCurStates->m_TextX -= | 1289 m_pCurStates->m_TextX -= |
| 1294 (pKerning[nsegs - 1] * m_pCurStates->m_TextState.GetFontSize()) / | 1290 (pKerning[nsegs - 1] * m_pCurStates->m_TextState.GetFontSize()) / |
| 1295 1000; | 1291 1000; |
| 1296 } else { | 1292 } else { |
| 1297 m_pCurStates->m_TextY -= | 1293 m_pCurStates->m_TextY -= |
| 1298 (pKerning[nsegs - 1] * m_pCurStates->m_TextState.GetFontSize()) / | 1294 (pKerning[nsegs - 1] * m_pCurStates->m_TextState.GetFontSize()) / |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1476 } | 1472 } |
| 1477 m_pPathPoints = pNewPoints; | 1473 m_pPathPoints = pNewPoints; |
| 1478 m_PathAllocSize = newsize; | 1474 m_PathAllocSize = newsize; |
| 1479 } | 1475 } |
| 1480 m_pPathPoints[m_PathPointCount - 1].m_Flag = flag; | 1476 m_pPathPoints[m_PathPointCount - 1].m_Flag = flag; |
| 1481 m_pPathPoints[m_PathPointCount - 1].m_PointX = x; | 1477 m_pPathPoints[m_PathPointCount - 1].m_PointX = x; |
| 1482 m_pPathPoints[m_PathPointCount - 1].m_PointY = y; | 1478 m_pPathPoints[m_PathPointCount - 1].m_PointY = y; |
| 1483 } | 1479 } |
| 1484 | 1480 |
| 1485 void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke) { | 1481 void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke) { |
| 1486 int PathPointCount = m_PathPointCount, PathClipType = m_PathClipType; | 1482 int PathPointCount = m_PathPointCount; |
| 1483 uint8_t PathClipType = m_PathClipType; | |
| 1487 m_PathPointCount = 0; | 1484 m_PathPointCount = 0; |
| 1488 m_PathClipType = 0; | 1485 m_PathClipType = 0; |
| 1489 if (PathPointCount <= 1) { | 1486 if (PathPointCount <= 1) { |
| 1490 if (PathPointCount && PathClipType) { | 1487 if (PathPointCount && PathClipType) { |
| 1491 CPDF_Path path; | 1488 CPDF_Path path; |
| 1492 path.New()->AppendRect(0, 0, 0, 0); | 1489 path.New()->AppendRect(0, 0, 0, 0); |
| 1493 m_pCurStates->m_ClipPath.AppendPath(path, FXFILL_WINDING, TRUE); | 1490 m_pCurStates->m_ClipPath.AppendPath(path, FXFILL_WINDING, TRUE); |
| 1494 } | 1491 } |
| 1495 return; | 1492 return; |
| 1496 } | 1493 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1704 } else { | 1701 } else { |
| 1705 PDF_ReplaceAbbr(pElement); | 1702 PDF_ReplaceAbbr(pElement); |
| 1706 } | 1703 } |
| 1707 } | 1704 } |
| 1708 break; | 1705 break; |
| 1709 } | 1706 } |
| 1710 default: | 1707 default: |
| 1711 break; | 1708 break; |
| 1712 } | 1709 } |
| 1713 } | 1710 } |
| OLD | NEW |