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

Unified Diff: fpdfsdk/src/fxedit/fxet_list.cpp

Issue 1737593006: Re-land "Replace CPDF_Rect and CPDF_Point with CFX types." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Ooops. Created 4 years, 10 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 | « fpdfsdk/src/fxedit/fxet_edit.cpp ('k') | fpdfsdk/src/fxedit/fxet_pageobjs.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fxedit/fxet_list.cpp
diff --git a/fpdfsdk/src/fxedit/fxet_list.cpp b/fpdfsdk/src/fxedit/fxet_list.cpp
index 4e8ae0cb8e0c947b8d7cb8584b65620a6d9bc746..313cc481b3e430f765a02eba09aa7d0855e2e1e7 100644
--- a/fpdfsdk/src/fxedit/fxet_list.cpp
+++ b/fpdfsdk/src/fxedit/fxet_list.cpp
@@ -155,11 +155,11 @@ int32_t CFX_List::GetCount() const {
return m_aListItems.GetSize();
}
-CPDF_Rect CFX_List::GetPlateRect() const {
+CFX_FloatRect CFX_List::GetPlateRect() const {
return CFX_ListContainer::GetPlateRect();
}
-CPDF_Rect CFX_List::GetContentRect() const {
+CFX_FloatRect CFX_List::GetContentRect() const {
return InnerToOuter(CFX_ListContainer::GetContentRect());
}
@@ -167,8 +167,8 @@ FX_FLOAT CFX_List::GetFontSize() const {
return m_fFontSize;
}
-int32_t CFX_List::GetItemIndex(const CPDF_Point& point) const {
- CPDF_Point pt = OuterToInner(point);
+int32_t CFX_List::GetItemIndex(const CFX_FloatPoint& point) const {
+ CFX_FloatPoint pt = OuterToInner(point);
FX_BOOL bFirst = TRUE;
FX_BOOL bLast = TRUE;
@@ -250,15 +250,15 @@ int32_t CFX_List::FindNext(int32_t nIndex, FX_WCHAR nChar) const {
return nCircleIndex;
}
-CPDF_Rect CFX_List::GetItemRect(int32_t nIndex) const {
+CFX_FloatRect CFX_List::GetItemRect(int32_t nIndex) const {
if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) {
- CPDF_Rect rcItem = pListItem->GetRect();
+ CFX_FloatRect rcItem = pListItem->GetRect();
rcItem.left = 0.0f;
rcItem.right = GetPlateRect().Width();
return InnerToOuter(rcItem);
}
- return CPDF_Rect();
+ return CFX_FloatRect();
}
FX_BOOL CFX_List::IsItemSelected(int32_t nIndex) const {
@@ -423,35 +423,37 @@ void CFX_ListCtrl::SetNotify(IFX_List_Notify* pNotify) {
m_pNotify = pNotify;
}
-CPDF_Point CFX_ListCtrl::InToOut(const CPDF_Point& point) const {
- CPDF_Rect rcPlate = GetPlateRect();
+CFX_FloatPoint CFX_ListCtrl::InToOut(const CFX_FloatPoint& point) const {
+ CFX_FloatRect rcPlate = GetPlateRect();
- return CPDF_Point(point.x - (m_ptScrollPos.x - rcPlate.left),
- point.y - (m_ptScrollPos.y - rcPlate.top));
+ return CFX_FloatPoint(point.x - (m_ptScrollPos.x - rcPlate.left),
+ point.y - (m_ptScrollPos.y - rcPlate.top));
}
-CPDF_Point CFX_ListCtrl::OutToIn(const CPDF_Point& point) const {
- CPDF_Rect rcPlate = GetPlateRect();
+CFX_FloatPoint CFX_ListCtrl::OutToIn(const CFX_FloatPoint& point) const {
+ CFX_FloatRect rcPlate = GetPlateRect();
- return CPDF_Point(point.x + (m_ptScrollPos.x - rcPlate.left),
- point.y + (m_ptScrollPos.y - rcPlate.top));
+ return CFX_FloatPoint(point.x + (m_ptScrollPos.x - rcPlate.left),
+ point.y + (m_ptScrollPos.y - rcPlate.top));
}
-CPDF_Rect CFX_ListCtrl::InToOut(const CPDF_Rect& rect) const {
- CPDF_Point ptLeftBottom = InToOut(CPDF_Point(rect.left, rect.bottom));
- CPDF_Point ptRightTop = InToOut(CPDF_Point(rect.right, rect.top));
+CFX_FloatRect CFX_ListCtrl::InToOut(const CFX_FloatRect& rect) const {
+ CFX_FloatPoint ptLeftBottom = InToOut(CFX_FloatPoint(rect.left, rect.bottom));
+ CFX_FloatPoint ptRightTop = InToOut(CFX_FloatPoint(rect.right, rect.top));
- return CPDF_Rect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y);
+ return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x,
+ ptRightTop.y);
}
-CPDF_Rect CFX_ListCtrl::OutToIn(const CPDF_Rect& rect) const {
- CPDF_Point ptLeftBottom = OutToIn(CPDF_Point(rect.left, rect.bottom));
- CPDF_Point ptRightTop = OutToIn(CPDF_Point(rect.right, rect.top));
+CFX_FloatRect CFX_ListCtrl::OutToIn(const CFX_FloatRect& rect) const {
+ CFX_FloatPoint ptLeftBottom = OutToIn(CFX_FloatPoint(rect.left, rect.bottom));
+ CFX_FloatPoint ptRightTop = OutToIn(CFX_FloatPoint(rect.right, rect.top));
- return CPDF_Rect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y);
+ return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x,
+ ptRightTop.y);
}
-void CFX_ListCtrl::OnMouseDown(const CPDF_Point& point,
+void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point,
FX_BOOL bShift,
FX_BOOL bCtrl) {
int32_t nHitIndex = GetItemIndex(point);
@@ -490,7 +492,7 @@ void CFX_ListCtrl::OnMouseDown(const CPDF_Point& point,
ScrollToListItem(nHitIndex);
}
-void CFX_ListCtrl::OnMouseMove(const CPDF_Point& point,
+void CFX_ListCtrl::OnMouseMove(const CFX_FloatPoint& point,
FX_BOOL bShift,
FX_BOOL bCtrl) {
int32_t nHitIndex = GetItemIndex(point);
@@ -578,15 +580,15 @@ FX_BOOL CFX_ListCtrl::OnChar(FX_WORD nChar, FX_BOOL bShift, FX_BOOL bCtrl) {
return FALSE;
}
-void CFX_ListCtrl::SetPlateRect(const CPDF_Rect& rect) {
+void CFX_ListCtrl::SetPlateRect(const CFX_FloatRect& rect) {
CFX_ListContainer::SetPlateRect(rect);
m_ptScrollPos.x = rect.left;
- SetScrollPos(CPDF_Point(rect.left, rect.top));
+ SetScrollPos(CFX_FloatPoint(rect.left, rect.top));
ReArrange(0);
InvalidateItem(-1);
}
-CPDF_Rect CFX_ListCtrl::GetItemRect(int32_t nIndex) const {
+CFX_FloatRect CFX_ListCtrl::GetItemRect(int32_t nIndex) const {
return InToOut(CFX_List::GetItemRect(nIndex));
}
@@ -650,14 +652,14 @@ void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) {
if (nItemIndex == -1) {
if (!m_bNotifyFlag) {
m_bNotifyFlag = TRUE;
- CPDF_Rect rcRefresh = GetPlateRect();
+ CFX_FloatRect rcRefresh = GetPlateRect();
m_pNotify->IOnInvalidateRect(&rcRefresh);
m_bNotifyFlag = FALSE;
}
} else {
if (!m_bNotifyFlag) {
m_bNotifyFlag = TRUE;
- CPDF_Rect rcRefresh = GetItemRect(nItemIndex);
+ CFX_FloatRect rcRefresh = GetItemRect(nItemIndex);
rcRefresh.left -= 1.0f;
rcRefresh.right += 1.0f;
rcRefresh.bottom -= 1.0f;
@@ -701,8 +703,8 @@ void CFX_ListCtrl::Select(int32_t nItemIndex) {
}
FX_BOOL CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const {
- CPDF_Rect rcPlate = GetPlateRect();
- CPDF_Rect rcItem = GetItemRect(nItemIndex);
+ CFX_FloatRect rcPlate = GetPlateRect();
+ CFX_FloatRect rcItem = GetItemRect(nItemIndex);
return rcItem.bottom >= rcPlate.bottom && rcItem.top <= rcPlate.top;
}
@@ -711,9 +713,9 @@ void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) {
if (!IsValid(nItemIndex))
return;
- CPDF_Rect rcPlate = GetPlateRect();
- CPDF_Rect rcItem = CFX_List::GetItemRect(nItemIndex);
- CPDF_Rect rcItemCtrl = GetItemRect(nItemIndex);
+ CFX_FloatRect rcPlate = GetPlateRect();
+ CFX_FloatRect rcItem = CFX_List::GetItemRect(nItemIndex);
+ CFX_FloatRect rcItemCtrl = GetItemRect(nItemIndex);
if (FX_EDIT_IsFloatSmaller(rcItemCtrl.bottom, rcPlate.bottom)) {
if (FX_EDIT_IsFloatSmaller(rcItemCtrl.top, rcPlate.top)) {
@@ -728,8 +730,8 @@ void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) {
void CFX_ListCtrl::SetScrollInfo() {
if (m_pNotify) {
- CPDF_Rect rcPlate = GetPlateRect();
- CPDF_Rect rcContent = CFX_List::GetContentRect();
+ CFX_FloatRect rcPlate = GetPlateRect();
+ CFX_FloatRect rcContent = CFX_List::GetContentRect();
if (!m_bNotifyFlag) {
m_bNotifyFlag = TRUE;
@@ -741,14 +743,14 @@ void CFX_ListCtrl::SetScrollInfo() {
}
}
-void CFX_ListCtrl::SetScrollPos(const CPDF_Point& point) {
+void CFX_ListCtrl::SetScrollPos(const CFX_FloatPoint& point) {
SetScrollPosY(point.y);
}
void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) {
if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y, fy)) {
- CPDF_Rect rcPlate = GetPlateRect();
- CPDF_Rect rcContent = CFX_List::GetContentRect();
+ CFX_FloatRect rcPlate = GetPlateRect();
+ CFX_FloatRect rcContent = CFX_List::GetContentRect();
if (rcPlate.Height() > rcContent.Height()) {
fy = rcPlate.top;
@@ -773,7 +775,7 @@ void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) {
}
}
-CPDF_Rect CFX_ListCtrl::GetContentRect() const {
+CFX_FloatRect CFX_ListCtrl::GetContentRect() const {
return InToOut(CFX_List::GetContentRect());
}
@@ -785,7 +787,7 @@ void CFX_ListCtrl::ReArrange(int32_t nItemIndex) {
void CFX_ListCtrl::SetTopItem(int32_t nIndex) {
if (IsValid(nIndex)) {
GetPlateRect();
- CPDF_Rect rcItem = CFX_List::GetItemRect(nIndex);
+ CFX_FloatRect rcItem = CFX_List::GetItemRect(nIndex);
SetScrollPosY(rcItem.top);
}
}
@@ -808,7 +810,7 @@ void CFX_ListCtrl::Cancel() {
m_aSelItems.DeselectAll();
}
-int32_t CFX_ListCtrl::GetItemIndex(const CPDF_Point& point) const {
+int32_t CFX_ListCtrl::GetItemIndex(const CFX_FloatPoint& point) const {
return CFX_List::GetItemIndex(OutToIn(point));
}
« no previous file with comments | « fpdfsdk/src/fxedit/fxet_edit.cpp ('k') | fpdfsdk/src/fxedit/fxet_pageobjs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698