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

Unified Diff: core/src/fpdftext/fpdf_text_int.cpp

Issue 1197643002: Cleanup IFX_BidiChar (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments, similarity 20 Created 5 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/src/fpdftext/fpdf_text.cpp ('k') | core/src/fpdftext/text_int.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdftext/fpdf_text_int.cpp
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index ce673447a4f620eb9f5057d30f4dfc6c2d4d664b..462f1369dd1aab7be7df83a912b479b6d151e51d 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -13,7 +13,7 @@
#include "../../include/fpdfapi/fpdf_pageobj.h"
#include "../../include/fpdfapi/fpdf_resource.h"
#include "../../include/fpdftext/fpdf_text.h"
-#include "../../include/fxcrt/fx_arb.h"
+#include "../../include/fxcrt/fx_bidi.h"
#include "../../include/fxcrt/fx_ucd.h"
#include "text_int.h"
@@ -1020,10 +1020,10 @@ int CPDF_TextPage::GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const {
}
return w;
}
-void CPDF_TextPage::OnPiece(IFX_BidiChar* pBidi, CFX_WideString& str) {
+void CPDF_TextPage::OnPiece(CFX_BidiChar* pBidi, CFX_WideString& str) {
int32_t start, count;
- int32_t ret = pBidi->GetBidiInfo(start, count);
- if (ret == 2) {
+ CFX_BidiChar::Direction ret = pBidi->GetBidiInfo(&start, &count);
+ if (ret == CFX_BidiChar::RIGHT) {
for (int i = start + count - 1; i >= start; i--) {
m_TextBuf.AppendChar(str.GetAt(i));
m_charList.Add(*(PAGECHAR_INFO*)m_TempCharList.GetAt(i));
@@ -1104,7 +1104,7 @@ void CPDF_TextPage::CloseTempLine() {
if (count1 <= 0) {
return;
}
- nonstd::unique_ptr<IFX_BidiChar> pBidiChar(IFX_BidiChar::Create());
+ nonstd::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar);
CFX_WideString str = m_TempTextBuf.GetWideString();
CFX_WordArray order;
FX_BOOL bR2L = FALSE;
@@ -1126,28 +1126,28 @@ void CPDF_TextPage::CloseTempLine() {
bPrevSpace = FALSE;
}
if (pBidiChar->AppendChar(str.GetAt(i))) {
- int32_t ret = pBidiChar->GetBidiInfo(start, count);
+ CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count);
order.Add(start);
order.Add(count);
order.Add(ret);
if (!bR2L) {
- if (ret == 2) {
+ if (ret == CFX_BidiChar::RIGHT) {
nR2L++;
- } else if (ret == 1) {
+ } else if (ret == CFX_BidiChar::LEFT) {
nL2R++;
}
}
}
}
if (pBidiChar->EndChar()) {
- int32_t ret = pBidiChar->GetBidiInfo(start, count);
+ CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count);
order.Add(start);
order.Add(count);
order.Add(ret);
if (!bR2L) {
- if (ret == 2) {
+ if (ret == CFX_BidiChar::RIGHT) {
nR2L++;
- } else if (ret == 1) {
+ } else if (ret == CFX_BidiChar::LEFT) {
nL2R++;
}
}
@@ -1762,7 +1762,7 @@ void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend,
FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
const CPDF_Font* pFont,
int nItems) const {
- nonstd::unique_ptr<IFX_BidiChar> pBidiChar(IFX_BidiChar::Create());
+ nonstd::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar);
int32_t nR2L = 0;
int32_t nL2R = 0;
int32_t start = 0, count = 0;
@@ -1781,19 +1781,19 @@ FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
continue;
}
if (pBidiChar->AppendChar(wChar)) {
- int32_t ret = pBidiChar->GetBidiInfo(start, count);
- if (ret == 2) {
+ CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count);
+ if (ret == CFX_BidiChar::RIGHT) {
nR2L++;
- } else if (ret == 1) {
+ } else if (ret == CFX_BidiChar::LEFT) {
nL2R++;
}
}
}
if (pBidiChar->EndChar()) {
- int32_t ret = pBidiChar->GetBidiInfo(start, count);
- if (ret == 2) {
+ CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count);
+ if (ret == CFX_BidiChar::RIGHT) {
nR2L++;
- } else if (ret == 1) {
+ } else if (ret == CFX_BidiChar::LEFT) {
nL2R++;
}
}
« no previous file with comments | « core/src/fpdftext/fpdf_text.cpp ('k') | core/src/fpdftext/text_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698