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

Unified Diff: fpdfsdk/src/pdfwindow/PWL_Wnd.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/pdfwindow/PWL_Utils.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
index d0aaa78ea48fca4be139e731480b0ceaf44099e4..28bd0e04edd52695da3b57d81110b45d1d333745 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
@@ -273,9 +273,11 @@ void CPWL_Wnd::Destroy() {
m_pVScrollBar = NULL;
}
-void CPWL_Wnd::Move(const CPDF_Rect& rcNew, FX_BOOL bReset, FX_BOOL bRefresh) {
+void CPWL_Wnd::Move(const CFX_FloatRect& rcNew,
+ FX_BOOL bReset,
+ FX_BOOL bRefresh) {
if (IsValid()) {
- CPDF_Rect rcOld = GetWindowRect();
+ CFX_FloatRect rcOld = GetWindowRect();
m_rcWindow = rcNew;
m_rcWindow.Normalize();
@@ -294,9 +296,9 @@ void CPWL_Wnd::Move(const CPDF_Rect& rcNew, FX_BOOL bReset, FX_BOOL bRefresh) {
}
}
-void CPWL_Wnd::InvalidateRectMove(const CPDF_Rect& rcOld,
- const CPDF_Rect& rcNew) {
- CPDF_Rect rcUnion = rcOld;
+void CPWL_Wnd::InvalidateRectMove(const CFX_FloatRect& rcOld,
+ const CFX_FloatRect& rcNew) {
+ CFX_FloatRect rcUnion = rcOld;
rcUnion.Union(rcNew);
InvalidateRect(&rcUnion);
@@ -311,7 +313,7 @@ void CPWL_Wnd::GetAppearanceStream(CFX_ByteTextBuf& sAppStream) {
// if don't set,Get default apperance stream
void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
- CPDF_Rect rectWnd = GetWindowRect();
+ CFX_FloatRect rectWnd = GetWindowRect();
if (!rectWnd.IsEmpty()) {
CFX_ByteTextBuf sThis;
@@ -348,10 +350,10 @@ void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice,
void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device) {
- CPDF_Rect rectWnd = GetWindowRect();
+ CFX_FloatRect rectWnd = GetWindowRect();
if (!rectWnd.IsEmpty()) {
if (HasFlag(PWS_BACKGROUND)) {
- CPDF_Rect rcClient = CPWL_Utils::DeflateRect(
+ CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(
rectWnd, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient,
GetBackgroundColor(), GetTransparency());
@@ -381,12 +383,12 @@ void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice,
}
}
-void CPWL_Wnd::InvalidateRect(CPDF_Rect* pRect) {
+void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) {
if (IsValid()) {
- CPDF_Rect rcRefresh = pRect ? *pRect : GetWindowRect();
+ CFX_FloatRect rcRefresh = pRect ? *pRect : GetWindowRect();
if (!HasFlag(PWS_NOREFRESHCLIP)) {
- CPDF_Rect rcClip = GetClipRect();
+ CFX_FloatRect rcClip = GetClipRect();
if (!rcClip.IsEmpty()) {
rcRefresh.Intersect(rcClip);
}
@@ -423,7 +425,7 @@ void CPWL_Wnd::InvalidateRect(CPDF_Rect* pRect) {
}
#define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \
- FX_BOOL CPWL_Wnd::mouse_method_name(const CPDF_Point& point, \
+ FX_BOOL CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \
FX_DWORD nFlag) { \
if (IsValid() && IsVisible() && IsEnabled()) { \
if (IsWndCaptureMouse(this)) { \
@@ -467,7 +469,7 @@ PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp)
PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove)
FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta,
- const CPDF_Point& point,
+ const CFX_FloatPoint& point,
FX_DWORD nFlag) {
if (IsValid() && IsVisible() && IsEnabled()) {
SetCursor();
@@ -528,25 +530,25 @@ CPWL_Wnd* CPWL_Wnd::GetParentWindow() const {
return m_sPrivateParam.pParentWnd;
}
-CPDF_Rect CPWL_Wnd::GetWindowRect() const {
+CFX_FloatRect CPWL_Wnd::GetWindowRect() const {
return m_rcWindow;
}
-CPDF_Rect CPWL_Wnd::GetClientRect() const {
- CPDF_Rect rcWindow = GetWindowRect();
- CPDF_Rect rcClient = CPWL_Utils::DeflateRect(
+CFX_FloatRect CPWL_Wnd::GetClientRect() const {
+ CFX_FloatRect rcWindow = GetWindowRect();
+ CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(
rcWindow, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
if (CPWL_ScrollBar* pVSB = GetVScrollBar())
rcClient.right -= pVSB->GetScrollBarWidth();
rcClient.Normalize();
- return rcWindow.Contains(rcClient) ? rcClient : CPDF_Rect();
+ return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect();
}
-CPDF_Point CPWL_Wnd::GetCenterPoint() const {
- CPDF_Rect rcClient = GetClientRect();
- return CPDF_Point((rcClient.left + rcClient.right) * 0.5f,
- (rcClient.top + rcClient.bottom) * 0.5f);
+CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const {
+ CFX_FloatRect rcClient = GetClientRect();
+ return CFX_FloatPoint((rcClient.left + rcClient.right) * 0.5f,
+ (rcClient.top + rcClient.bottom) * 0.5f);
}
FX_BOOL CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const {
@@ -682,11 +684,11 @@ void CPWL_Wnd::OnSetFocus() {}
void CPWL_Wnd::OnKillFocus() {}
-FX_BOOL CPWL_Wnd::WndHitTest(const CPDF_Point& point) const {
+FX_BOOL CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const {
return IsValid() && IsVisible() && GetWindowRect().Contains(point.x, point.y);
}
-FX_BOOL CPWL_Wnd::ClientHitTest(const CPDF_Point& point) const {
+FX_BOOL CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const {
return IsValid() && IsVisible() && GetClientRect().Contains(point.x, point.y);
}
@@ -713,12 +715,12 @@ void CPWL_Wnd::SetVisible(FX_BOOL bVisible) {
}
}
-void CPWL_Wnd::SetClipRect(const CPDF_Rect& rect) {
+void CPWL_Wnd::SetClipRect(const CFX_FloatRect& rect) {
m_rcClip = rect;
m_rcClip.Normalize();
}
-const CPDF_Rect& CPWL_Wnd::GetClipRect() const {
+const CFX_FloatRect& CPWL_Wnd::GetClipRect() const {
return m_rcClip;
}
@@ -727,14 +729,14 @@ FX_BOOL CPWL_Wnd::IsReadOnly() const {
}
void CPWL_Wnd::RePosChildWnd() {
- CPDF_Rect rcContent = CPWL_Utils::DeflateRect(
+ CFX_FloatRect rcContent = CPWL_Utils::DeflateRect(
GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
CPWL_ScrollBar* pVSB = GetVScrollBar();
- CPDF_Rect rcVScroll =
- CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH, rcContent.bottom,
- rcContent.right - 1.0f, rcContent.top);
+ CFX_FloatRect rcVScroll =
+ CFX_FloatRect(rcContent.right - PWL_SCROLLBAR_WIDTH, rcContent.bottom,
+ rcContent.right - 1.0f, rcContent.top);
if (pVSB)
pVSB->Move(rcVScroll, TRUE, FALSE);
@@ -791,7 +793,7 @@ FX_BOOL CPWL_Wnd::IsFocused() const {
return FALSE;
}
-CPDF_Rect CPWL_Wnd::GetFocusRect() const {
+CFX_FloatRect CPWL_Wnd::GetFocusRect() const {
return CPWL_Utils::InflateRect(GetWindowRect(), 1);
}
@@ -886,16 +888,18 @@ CFX_Matrix CPWL_Wnd::GetWindowMatrix() const {
return mt;
}
-void CPWL_Wnd::PWLtoWnd(const CPDF_Point& point, int32_t& x, int32_t& y) const {
+void CPWL_Wnd::PWLtoWnd(const CFX_FloatPoint& point,
+ int32_t& x,
+ int32_t& y) const {
CFX_Matrix mt = GetWindowMatrix();
- CPDF_Point pt = point;
+ CFX_FloatPoint pt = point;
mt.Transform(pt.x, pt.y);
x = (int32_t)(pt.x + 0.5);
y = (int32_t)(pt.y + 0.5);
}
-FX_RECT CPWL_Wnd::PWLtoWnd(const CPDF_Rect& rect) const {
- CPDF_Rect rcTemp = rect;
+FX_RECT CPWL_Wnd::PWLtoWnd(const CFX_FloatRect& rect) const {
+ CFX_FloatRect rcTemp = rect;
CFX_Matrix mt = GetWindowMatrix();
mt.TransformRect(rcTemp);
return FX_RECT((int32_t)(rcTemp.left + 0.5), (int32_t)(rcTemp.bottom + 0.5),
@@ -906,44 +910,44 @@ FX_HWND CPWL_Wnd::GetAttachedHWnd() const {
return m_sPrivateParam.hAttachedWnd;
}
-CPDF_Point CPWL_Wnd::ChildToParent(const CPDF_Point& point) const {
+CFX_FloatPoint CPWL_Wnd::ChildToParent(const CFX_FloatPoint& point) const {
CFX_Matrix mt = GetChildMatrix();
if (mt.IsIdentity())
return point;
- CPDF_Point pt = point;
+ CFX_FloatPoint pt = point;
mt.Transform(pt.x, pt.y);
return pt;
}
-CPDF_Rect CPWL_Wnd::ChildToParent(const CPDF_Rect& rect) const {
+CFX_FloatRect CPWL_Wnd::ChildToParent(const CFX_FloatRect& rect) const {
CFX_Matrix mt = GetChildMatrix();
if (mt.IsIdentity())
return rect;
- CPDF_Rect rc = rect;
+ CFX_FloatRect rc = rect;
mt.TransformRect(rc);
return rc;
}
-CPDF_Point CPWL_Wnd::ParentToChild(const CPDF_Point& point) const {
+CFX_FloatPoint CPWL_Wnd::ParentToChild(const CFX_FloatPoint& point) const {
CFX_Matrix mt = GetChildMatrix();
if (mt.IsIdentity())
return point;
mt.SetReverse(mt);
- CPDF_Point pt = point;
+ CFX_FloatPoint pt = point;
mt.Transform(pt.x, pt.y);
return pt;
}
-CPDF_Rect CPWL_Wnd::ParentToChild(const CPDF_Rect& rect) const {
+CFX_FloatRect CPWL_Wnd::ParentToChild(const CFX_FloatRect& rect) const {
CFX_Matrix mt = GetChildMatrix();
if (mt.IsIdentity())
return rect;
mt.SetReverse(mt);
- CPDF_Rect rc = rect;
+ CFX_FloatRect rc = rect;
mt.TransformRect(rc);
return rc;
}
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_Utils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698