From 2b5e0d5b20654d116045484868c9e015ed698124 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 10 Jun 2015 23:33:26 -0700 Subject: Cleanup: Remove uses of "this->" in core/ R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1173223002. --- core/include/fpdfdoc/fpdf_vt.h | 50 +++++++++++++++------------- core/include/fxcrt/fx_coordinates.h | 34 +++++++++++-------- core/include/fxcrt/fx_string.h | 4 +-- core/src/fpdfdoc/doc_vt.cpp | 18 +++++----- core/src/fpdfdoc/pdf_vt.h | 46 ++++++++++++------------- core/src/fpdftext/fpdf_text_int.cpp | 2 +- core/src/fxcodec/codec/fx_codec_jpx_opj.cpp | 8 ----- core/src/fxcodec/jbig2/JBig2_Context.cpp | 2 +- core/src/fxcrt/fx_basic_coords.cpp | 33 ++++++++++-------- core/src/fxge/skia/fx_skia_blitter_new.cpp | 12 +++---- core/src/reflow/layoutprovider_taggedpdf.cpp | 2 +- core/src/reflow/reflowedpage.cpp | 4 +-- 12 files changed, 110 insertions(+), 105 deletions(-) diff --git a/core/include/fpdfdoc/fpdf_vt.h b/core/include/fpdfdoc/fpdf_vt.h index 1fec0e629a..7dbd154e89 100644 --- a/core/include/fpdfdoc/fpdf_vt.h +++ b/core/include/fpdfdoc/fpdf_vt.h @@ -26,11 +26,13 @@ struct CPVT_WordPlace { { } - CPVT_WordPlace(int32_t nSecIndex, int32_t nLineIndex, int32_t nWordIndex) + CPVT_WordPlace(int32_t other_nSecIndex, + int32_t other_nLineIndex, + int32_t other_nWordIndex) { - this->nSecIndex = nSecIndex; - this->nLineIndex = nLineIndex; - this->nWordIndex = nWordIndex; + nSecIndex = other_nSecIndex; + nLineIndex = other_nLineIndex; + nWordIndex = other_nWordIndex; } void Default() @@ -40,32 +42,32 @@ struct CPVT_WordPlace { FX_BOOL operator == (const CPVT_WordPlace & wp) const { - return wp.nSecIndex == this->nSecIndex && wp.nLineIndex == this->nLineIndex && wp.nWordIndex == this->nWordIndex; + return wp.nSecIndex == nSecIndex && wp.nLineIndex == nLineIndex && wp.nWordIndex == nWordIndex; } FX_BOOL operator != (const CPVT_WordPlace & wp) const { - return wp.nSecIndex != this->nSecIndex || wp.nLineIndex != this->nLineIndex || wp.nWordIndex != this->nWordIndex; + return wp.nSecIndex != nSecIndex || wp.nLineIndex != nLineIndex || wp.nWordIndex != nWordIndex; } inline int32_t WordCmp(const CPVT_WordPlace & wp) const { - if (this->nSecIndex > wp.nSecIndex) { + if (nSecIndex > wp.nSecIndex) { return 1; } - if (this->nSecIndex < wp.nSecIndex) { + if (nSecIndex < wp.nSecIndex) { return -1; } - if (this->nLineIndex > wp.nLineIndex) { + if (nLineIndex > wp.nLineIndex) { return 1; } - if (this->nLineIndex < wp.nLineIndex) { + if (nLineIndex < wp.nLineIndex) { return -1; } - if (this->nWordIndex > wp.nWordIndex) { + if (nWordIndex > wp.nWordIndex) { return 1; } - if (this->nWordIndex < wp.nWordIndex) { + if (nWordIndex < wp.nWordIndex) { return -1; } return 0; @@ -73,16 +75,16 @@ struct CPVT_WordPlace { inline int32_t LineCmp(const CPVT_WordPlace & wp) const { - if (this->nSecIndex > wp.nSecIndex) { + if (nSecIndex > wp.nSecIndex) { return 1; } - if (this->nSecIndex < wp.nSecIndex) { + if (nSecIndex < wp.nSecIndex) { return -1; } - if (this->nLineIndex > wp.nLineIndex) { + if (nLineIndex > wp.nLineIndex) { return 1; } - if (this->nLineIndex < wp.nLineIndex) { + if (nLineIndex < wp.nLineIndex) { return -1; } return 0; @@ -90,10 +92,10 @@ struct CPVT_WordPlace { inline int32_t SecCmp(const CPVT_WordPlace & wp) const { - if (this->nSecIndex > wp.nSecIndex) { + if (nSecIndex > wp.nSecIndex) { return 1; } - if (this->nSecIndex < wp.nSecIndex) { + if (nSecIndex < wp.nSecIndex) { return -1; } return 0; @@ -124,31 +126,31 @@ struct CPVT_WordRange { void Set(const CPVT_WordPlace & begin, const CPVT_WordPlace & end) { - this->BeginPos = begin; - this->EndPos = end; + BeginPos = begin; + EndPos = end; SwapWordPlace(); } void SetBeginPos(const CPVT_WordPlace & begin) { - this->BeginPos = begin; + BeginPos = begin; SwapWordPlace(); } void SetEndPos(const CPVT_WordPlace & end) { - this->EndPos = end; + EndPos = end; SwapWordPlace(); } FX_BOOL IsExist() const { - return this->BeginPos != this->EndPos; + return BeginPos != EndPos; } FX_BOOL operator != (const CPVT_WordRange & wr) const { - return wr.BeginPos != this->BeginPos || wr.EndPos != this->EndPos; + return wr.BeginPos != BeginPos || wr.EndPos != EndPos; } void SwapWordPlace() diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h index c98ece9e07..779f1722b2 100644 --- a/core/include/fxcrt/fx_coordinates.h +++ b/core/include/fxcrt/fx_coordinates.h @@ -694,21 +694,24 @@ public: top += y; } - void Inflate(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top) + void Inflate(FX_FLOAT other_left, + FX_FLOAT other_bottom, + FX_FLOAT other_right, + FX_FLOAT other_top) { Normalize(); - this->left -= left; - this->bottom -= bottom; - this->right += right; - this->top += top; + left -= other_left; + bottom -= other_bottom; + right += other_right; + top += other_top; } - void Inflate(const CFX_FloatRect &rt) + void Inflate(const CFX_FloatRect &rt) { Inflate(rt.left, rt.bottom, rt.right, rt.top); } - void Deflate(FX_FLOAT x, FX_FLOAT y) + void Deflate(FX_FLOAT x, FX_FLOAT y) { Normalize(); left += x; @@ -717,21 +720,24 @@ public: top -= y; } - void Deflate(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top) + void Deflate(FX_FLOAT other_left, + FX_FLOAT other_bottom, + FX_FLOAT other_right, + FX_FLOAT other_top) { Normalize(); - this->left += left; - this->bottom += bottom; - this->right -= right; - this->top -= top; + left += other_left; + bottom += other_bottom; + right -= other_right; + top -= other_top; } - void Deflate(const CFX_FloatRect &rt) + void Deflate(const CFX_FloatRect &rt) { Deflate(rt.left, rt.bottom, rt.right, rt.top); } - void Translate(FX_FLOAT e, FX_FLOAT f) + void Translate(FX_FLOAT e, FX_FLOAT f) { left += e; right += e; diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index 4ce8b81937..f02cce994b 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -184,7 +184,7 @@ public: // Move constructor. inline CFX_ByteString(CFX_ByteString&& other) { - this->m_pData = other.m_pData; + m_pData = other.m_pData; other.m_pData = nullptr; } @@ -630,7 +630,7 @@ public: // Move constructor. inline CFX_WideString(CFX_WideString&& other) { - this->m_pData = other.m_pData; + m_pData = other.m_pData; other.m_pData = nullptr; } diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp index 31faf67c33..2b66ecab41 100644 --- a/core/src/fpdfdoc/doc_vt.cpp +++ b/core/src/fpdfdoc/doc_vt.cpp @@ -78,7 +78,7 @@ void CSection::ResetLinePlace() CPVT_WordPlace CSection::AddWord(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo) { CPVT_WordInfo * pWord = new CPVT_WordInfo(wordinfo); - int32_t nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, this->m_WordArray.GetSize()), 0); + int32_t nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, m_WordArray.GetSize()), 0); if (nWordIndex == m_WordArray.GetSize()) { m_WordArray.Add(pWord); } else { @@ -116,7 +116,7 @@ CPVT_WordPlace CSection::GetEndWordPlace() const if (CLine * pLine = m_LineArray.GetAt(m_LineArray.GetSize() - 1)) { return pLine->GetEndWordPlace(); } else { - return this->SecPlace; + return SecPlace; } } CPVT_WordPlace CSection::GetPrevWordPlace(const CPVT_WordPlace & place) const @@ -857,7 +857,7 @@ void CPDF_VariableText::ResetAll() CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps) { - int32_t nTotlaWords = this->GetTotalWords(); + int32_t nTotlaWords = GetTotalWords(); if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) { return place; } @@ -879,7 +879,7 @@ CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { - int32_t nTotlaWords = this->GetTotalWords(); + int32_t nTotlaWords = GetTotalWords(); if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) { return place; } @@ -1415,7 +1415,7 @@ FX_FLOAT CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo & SecInfo) } int32_t CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) { - return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->nAlignment : this->m_nAlignment; + return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->nAlignment : m_nAlignment; } FX_FLOAT CPDF_VariableText::GetCharSpace(const CPVT_WordInfo & WordInfo) { @@ -1498,13 +1498,13 @@ void CPDF_VariableText::ClearWords(const CPVT_WordRange & PlaceRange) CPVT_WordPlace CPDF_VariableText::ClearLeftWord(const CPVT_WordPlace & place) { if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { - CPVT_WordPlace leftplace = this->GetPrevWordPlace(place); + CPVT_WordPlace leftplace = GetPrevWordPlace(place); if (leftplace != place) { if (leftplace.nSecIndex != place.nSecIndex) { if (pSection->m_WordArray.GetSize() == 0) { - this->ClearEmptySection(place); + ClearEmptySection(place); } else { - this->LinkLatterSection(leftplace); + LinkLatterSection(leftplace); } } else { pSection->ClearWord(place); @@ -1517,7 +1517,7 @@ CPVT_WordPlace CPDF_VariableText::ClearLeftWord(const CPVT_WordPlace & place) CPVT_WordPlace CPDF_VariableText::ClearRightWord(const CPVT_WordPlace & place) { if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { - CPVT_WordPlace rightplace = AjustLineHeader(this->GetNextWordPlace(place), FALSE); + CPVT_WordPlace rightplace = AjustLineHeader(GetNextWordPlace(place), FALSE); if (rightplace != place) { if(rightplace.nSecIndex != place.nSecIndex) { LinkLatterSection(place); diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h index 1ab8fdb918..8091c08041 100644 --- a/core/src/fpdfdoc/pdf_vt.h +++ b/core/src/fpdfdoc/pdf_vt.h @@ -36,10 +36,10 @@ public: CPVT_Size() : x(0.0f), y(0.0f) { } - CPVT_Size(FX_FLOAT x, FX_FLOAT y) + CPVT_Size(FX_FLOAT other_x, FX_FLOAT other_y) { - this->x = x; - this->y = y; + x = other_x; + y = other_y; } FX_FLOAT x, y; }; @@ -50,20 +50,22 @@ public: { left = top = right = bottom = 0.0f; } - CPVT_FloatRect(FX_FLOAT left, FX_FLOAT top, - FX_FLOAT right, FX_FLOAT bottom) + CPVT_FloatRect(FX_FLOAT other_left, + FX_FLOAT other_top, + FX_FLOAT other_right, + FX_FLOAT other_bottom) { - this->left = left; - this->top = top; - this->right = right; - this->bottom = bottom; + left = other_left; + top = other_top; + right = other_right; + bottom = other_bottom; } CPVT_FloatRect(const CPDF_Rect & rect) { - this->left = rect.left; - this->top = rect.top; - this->right = rect.right; - this->bottom = rect.bottom; + left = rect.left; + top = rect.top; + right = rect.right; + bottom = rect.bottom; } void Default() { @@ -71,11 +73,9 @@ public: } FX_FLOAT Height() const { - if(this->top > this->bottom) { - return this->top - this->bottom; - } else { - return this->bottom - this->top; - } + if (top > bottom) + return top - bottom; + return bottom - top; } }; struct CPVT_SectionInfo { @@ -100,8 +100,8 @@ struct CPVT_SectionInfo { if (this == &other) { return; } - this->rcSection = other.rcSection; - this->nTotalLine = other.nTotalLine; + rcSection = other.rcSection; + nTotalLine = other.nTotalLine; if (other.pSecProps) { if (pSecProps) { *pSecProps = *other.pSecProps; @@ -162,9 +162,9 @@ struct CPVT_WordInfo { if (this == &word) { return; } - this->Word = word.Word; - this->nCharset = word.nCharset; - this->nFontIndex = word.nFontIndex; + Word = word.Word; + nCharset = word.nCharset; + nFontIndex = word.nFontIndex; if (word.pWordProps) { if (pWordProps) { *pWordProps = *word.pWordProps; diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index 16421ed5b6..b100394a8f 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -1276,7 +1276,7 @@ void CPDF_TextPage::CloseTempLine() if(nR2L > 0 && nR2L >= nL2R) { bR2L = TRUE; } - if(this->m_parserflag == FPDFTEXT_RLTB || bR2L) { + if (m_parserflag == FPDFTEXT_RLTB || bR2L) { int count = order.GetSize(); for(int i = count - 1; i > 0; i -= 3) { int ret = order.GetAt(i); diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 312ce78759..8895024338 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -649,13 +649,6 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, int src_size) image = NULL; return FALSE; } -/* - if(this->m_useColorSpace) { - image->useColorSpace = 1; - } else { - image->useColorSpace = 0; - } -*/ if (!parameters.nb_tile_to_decode) { if (!opj_set_decode_area(l_codec, image, parameters.DA_x0, parameters.DA_y0, parameters.DA_x1, parameters.DA_y1)) { @@ -685,7 +678,6 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, int src_size) if(image->color_space == OPJ_CLRSPC_SYCC) { color_sycc_to_rgb(image); } - //if(image->icc_profile_buf && !image->useColorSpace) { if(image->icc_profile_buf) { FX_Free(image->icc_profile_buf); image->icc_profile_buf = NULL; diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp index 1c7592778d..f58b7f36f5 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -1621,7 +1621,7 @@ FX_BOOL CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment *pSegment) pSeg = NULL; if(pSegment->m_nReferred_to_segment_count > 0) { for(i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { - pSeg = this->findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[0]); + pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[0]); if(pSeg == NULL) { m_pModule->JBig2_Error("generic refinement region segment : can't find refered to segments"); nRet = JBIG2_ERROR_FETAL; diff --git a/core/src/fxcrt/fx_basic_coords.cpp b/core/src/fxcrt/fx_basic_coords.cpp index 496b1443d1..652f62c71c 100644 --- a/core/src/fxcrt/fx_basic_coords.cpp +++ b/core/src/fxcrt/fx_basic_coords.cpp @@ -249,23 +249,28 @@ CFX_FloatRect CFX_FloatRect::GetBBox(const CFX_FloatPoint* pPoints, int nPoints) } return CFX_FloatRect(min_x, min_y, max_x, max_y); } -void CFX_Matrix::Set(FX_FLOAT a, FX_FLOAT b, FX_FLOAT c, FX_FLOAT d, FX_FLOAT e, FX_FLOAT f) -{ - this->a = a; - this->b = b; - this->c = c; - this->d = d; - this->e = e; - this->f = f; +void CFX_Matrix::Set(FX_FLOAT other_a, + FX_FLOAT other_b, + FX_FLOAT other_c, + FX_FLOAT other_d, + FX_FLOAT other_e, + FX_FLOAT other_f) +{ + a = other_a; + b = other_b; + c = other_c; + d = other_d; + e = other_e; + f = other_f; } void CFX_Matrix::Set(const FX_FLOAT n[6]) { - this->a = n[0]; - this->b = n[1]; - this->c = n[2]; - this->d = n[3]; - this->e = n[4]; - this->f = n[5]; + a = n[0]; + b = n[1]; + c = n[2]; + d = n[3]; + e = n[4]; + f = n[5]; } void CFX_Matrix::SetReverse(const CFX_Matrix &m) { diff --git a/core/src/fxge/skia/fx_skia_blitter_new.cpp b/core/src/fxge/skia/fx_skia_blitter_new.cpp index 362e8bf59f..bcb50b9e95 100644 --- a/core/src/fxge/skia/fx_skia_blitter_new.cpp +++ b/core/src/fxge/skia/fx_skia_blitter_new.cpp @@ -22,7 +22,7 @@ return; unsigned aa = antialias[0]; if (aa) - (this->*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, aa, m_ClipBox.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pDestExtraAlphaScan); + (*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, aa, m_ClipBox.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pDestExtraAlphaScan); runs += width; antialias += width; x += width; @@ -33,14 +33,14 @@ { FXSYS_assert(m_Alpha && width); if (y < m_ClipBox.top || y >= m_ClipBox.bottom) return; - (this->*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, 255, m_ClipBox.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pDestExtraAlphaScan); + (*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, 255, m_ClipBox.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pDestExtraAlphaScan); } void CFX_SkiaRenderer::blitV(int x, int y, int height, SkAlpha alpha) { FXSYS_assert(m_Alpha && alpha); if (alpha == 255) { - this->blitRect(x, y, 1, height); + blitRect(x, y, 1, height); } else { int16_t runs[2]; runs[0] = 1; @@ -48,7 +48,7 @@ while (--height >= 0) { if (y >= m_ClipBox.bottom) return; - this->blitAntiH(x, y ++, &alpha, runs); + blitAntiH(x, y ++, &alpha, runs); } } } @@ -1563,7 +1563,7 @@ { FXSYS_assert(alpha); if (alpha == 255) { - this->blitRect(x, y, 1, height); + blitRect(x, y, 1, height); } else { int16_t runs[2]; runs[0] = 1; @@ -1571,7 +1571,7 @@ while (--height >= 0) { if (y >= m_dstHeight) return; - this->blitAntiH(x, y ++, &alpha, runs); + blitAntiH(x, y ++, &alpha, runs); } } } diff --git a/core/src/reflow/layoutprovider_taggedpdf.cpp b/core/src/reflow/layoutprovider_taggedpdf.cpp index 57ce4303e2..37eb2ad3cc 100644 --- a/core/src/reflow/layoutprovider_taggedpdf.cpp +++ b/core/src/reflow/layoutprovider_taggedpdf.cpp @@ -450,7 +450,7 @@ LayoutType CPDF_LayoutElement::GetType() return LayoutUnknown; } CFX_ByteString name = m_pTaggedElement->GetType(); - return this->ConvertLayoutType(name); + return ConvertLayoutType(name); } int CPDF_LayoutElement::CountAttrValues(LayoutAttr attr_type) { diff --git a/core/src/reflow/reflowedpage.cpp b/core/src/reflow/reflowedpage.cpp index 1c78e75cbc..41a80b7a06 100644 --- a/core/src/reflow/reflowedpage.cpp +++ b/core/src/reflow/reflowedpage.cpp @@ -223,7 +223,7 @@ void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, int32_t x, i if(FXSYS_fabs(tempdy - dy) < 1) { continue; } - CFX_FloatRect rect (0, pData->m_PosY + pData->m_Height, this->m_PageWidth, pData->m_PosY); + CFX_FloatRect rect (0, pData->m_PosY + pData->m_Height, m_PageWidth, pData->m_PosY); if(rect.Contains(x1, y1)) { pos = i; dx = 0; @@ -318,7 +318,7 @@ void CPDF_ProgressiveReflowPageParser::Continue(IFX_Pause* pPause) } void CPDF_ProgressiveReflowPageParser::Clear() { - this->Init(); + Init(); return; } FX_BOOL IPDF_ProgressiveReflowPageParser::IsTaggedPage(CPDF_PageObjects*pPage) -- cgit v1.2.3