From 5500da04e3acfa98baf9befb5d91fb787d599341 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 20 Nov 2015 10:13:18 -0800 Subject: Merge to XFA: Remove CFX_Matrix::Reset() Original Review URL: https://codereview.chromium.org/1459243002 . (cherry picked from commit 6fc00fafcbac1fd5edd767fe2d4a8e4a9ef52806) R=thestig@chromium.org Review URL: https://codereview.chromium.org/1461703008 . --- core/include/fxcrt/fx_coordinates.h | 8 +------- xfa/include/fwl/core/fwl_theme.h | 2 +- xfa/include/fwl/core/fwl_widget.h | 2 +- xfa/include/fwl/lightwidget/widget.h | 2 +- xfa/src/fdp/src/fde/fde_gedevice.cpp | 2 +- xfa/src/fdp/src/fde/fde_object.h | 16 ++++++++-------- xfa/src/fdp/src/fde/fde_render.cpp | 4 ++-- xfa/src/fdp/src/tto/fde_textout.cpp | 2 +- xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp | 4 ++-- xfa/src/fwl/src/core/fwl_widgetimp.cpp | 4 ++-- xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp | 2 +- xfa/src/fwl/src/lightwidget/picturebox.cpp | 2 +- xfa/src/fwl/src/theme/checkboxtp.cpp | 2 +- xfa/src/fwl/src/theme/widgettp.cpp | 2 +- xfa/src/fxfa/src/app/xfa_rendercontext.cpp | 2 +- xfa/src/fxgraphics/src/fx_graphics.cpp | 4 ++-- 16 files changed, 27 insertions(+), 33 deletions(-) diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h index ddd0f572c8..e7fbe8549b 100644 --- a/core/include/fxcrt/fx_coordinates.h +++ b/core/include/fxcrt/fx_coordinates.h @@ -607,10 +607,7 @@ class CFX_FloatRect { }; class CFX_Matrix { public: - CFX_Matrix() { - a = d = 1; - b = c = e = f = 0; - } + CFX_Matrix() { SetIdentity(); } CFX_Matrix(FX_FLOAT a1, FX_FLOAT b1, @@ -648,11 +645,8 @@ class CFX_Matrix { FX_FLOAT e, FX_FLOAT f, FX_BOOL bPrepended = FALSE); - void Concat(const CFX_Matrix& m, FX_BOOL bPrepended = FALSE); - void ConcatInverse(const CFX_Matrix& m, FX_BOOL bPrepended = FALSE); - void Reset() { SetIdentity(); } void Copy(const CFX_Matrix& m) { *this = m; } diff --git a/xfa/include/fwl/core/fwl_theme.h b/xfa/include/fwl/core/fwl_theme.h index 3dfe7c74e1..d3704c89d1 100644 --- a/xfa/include/fwl/core/fwl_theme.h +++ b/xfa/include/fwl/core/fwl_theme.h @@ -31,7 +31,7 @@ class CFWL_ThemePart { CFWL_ThemePart() : m_pWidget(NULL), m_iPart(0), m_dwStates(0), m_dwData(0), m_pData(NULL) { m_rtPart.Reset(); - m_matrix.Reset(); + m_matrix.SetIdentity(); } CFX_Matrix m_matrix; CFX_RectF m_rtPart; diff --git a/xfa/include/fwl/core/fwl_widget.h b/xfa/include/fwl/core/fwl_widget.h index f7ddb5cebd..acada467b4 100644 --- a/xfa/include/fwl/core/fwl_widget.h +++ b/xfa/include/fwl/core/fwl_widget.h @@ -70,7 +70,7 @@ class IFWL_WidgetDelegate { class CFWL_WidgetImpProperties { public: CFWL_WidgetImpProperties() { - m_ctmOnParent.Reset(); + m_ctmOnParent.SetIdentity(); m_rtWidget.Set(0, 0, 0, 0); m_dwStyles = FWL_WGTSTYLE_Child; m_dwStyleExes = 0; diff --git a/xfa/include/fwl/lightwidget/widget.h b/xfa/include/fwl/lightwidget/widget.h index c6a7e4b80e..c597194336 100644 --- a/xfa/include/fwl/lightwidget/widget.h +++ b/xfa/include/fwl/lightwidget/widget.h @@ -16,7 +16,7 @@ class CFWL_WidgetDelegate; class CFWL_WidgetProperties { public: CFWL_WidgetProperties() { - m_ctmOnParent.Reset(); + m_ctmOnParent.SetIdentity(); m_rtWidget.Set(0, 0, 0, 0); m_dwStyles = FWL_WGTSTYLE_Child; m_dwStyleExes = 0; diff --git a/xfa/src/fdp/src/fde/fde_gedevice.cpp b/xfa/src/fdp/src/fde/fde_gedevice.cpp index f357f50ce5..3910e65cc3 100644 --- a/xfa/src/fdp/src/fde/fde_gedevice.cpp +++ b/xfa/src/fdp/src/fde/fde_gedevice.cpp @@ -114,7 +114,7 @@ FX_BOOL CFDE_FxgeDevice::DrawImage(CFX_DIBSource* pDib, if (pImgMatrix) { dib2fxdev = *pImgMatrix; } else { - dib2fxdev.Reset(); + dib2fxdev.SetIdentity(); } dib2fxdev.a = dstRect.width; dib2fxdev.d = -dstRect.height; diff --git a/xfa/src/fdp/src/fde/fde_object.h b/xfa/src/fdp/src/fde/fde_object.h index 620fe4f149..dd56b014af 100644 --- a/xfa/src/fdp/src/fde/fde_object.h +++ b/xfa/src/fdp/src/fde/fde_object.h @@ -84,12 +84,12 @@ class CFDE_Pen : public IFDE_Pen, public CFX_Target { }; class CFDE_SolidBrush : public IFDE_SolidBrush, public CFX_Target { public: - CFDE_SolidBrush() : m_Color(0xFF000000) { m_Matrix.Reset(); } + CFDE_SolidBrush() : m_Color(0xFF000000) { m_Matrix.SetIdentity(); } virtual void Release() { delete this; } virtual int32_t GetType() const { return FDE_BRUSHTYPE_Solid; } virtual const CFX_Matrix& GetMatrix() const { return m_Matrix; } - virtual void ResetMatrix() { m_Matrix.Reset(); } + virtual void ResetMatrix() { m_Matrix.SetIdentity(); } virtual void TranslateMatrix(FX_FLOAT dx, FX_FLOAT dy) { m_Matrix.Translate(dx, dy); } @@ -108,13 +108,13 @@ class CFDE_SolidBrush : public IFDE_SolidBrush, public CFX_Target { class CFDE_HatchBrush : public IFDE_HatchBrush, public CFX_Target { public: CFDE_HatchBrush() : m_iStyle(-1), m_BackColor(0), m_ForeColor(0) { - m_Matrix.Reset(); + m_Matrix.SetIdentity(); } virtual void Release() { delete this; } virtual int32_t GetType() const { return FDE_BRUSHTYPE_Hatch; } virtual const CFX_Matrix& GetMatrix() const { return m_Matrix; } - virtual void ResetMatrix() { m_Matrix.Reset(); } + virtual void ResetMatrix() { m_Matrix.SetIdentity(); } virtual void TranslateMatrix(FX_FLOAT dx, FX_FLOAT dy) { m_Matrix.Translate(dx, dy); } @@ -148,13 +148,13 @@ class CFDE_HatchBrush : public IFDE_HatchBrush, public CFX_Target { class CFDE_TextureBrush : public IFDE_TextureBrush, public CFX_Target { public: CFDE_TextureBrush() : m_iWrap(0), m_pImage(NULL), m_bAutoRelease(FALSE) { - m_Matrix.Reset(); + m_Matrix.SetIdentity(); } virtual void Release() { delete this; } virtual int32_t GetType() const { return FDE_BRUSHTYPE_Texture; } virtual const CFX_Matrix& GetMatrix() const { return m_Matrix; } - virtual void ResetMatrix() { m_Matrix.Reset(); } + virtual void ResetMatrix() { m_Matrix.SetIdentity(); } virtual void TranslateMatrix(FX_FLOAT dx, FX_FLOAT dy) { m_Matrix.Translate(dx, dy); } @@ -180,13 +180,13 @@ class CFDE_LinearBrush : public IFDE_LinearGradientBrush, public CFX_Target { public: CFDE_LinearBrush() : m_EndColor(0), m_StartColor(0), m_iWrapMode(0) { m_StartPoint.x = m_StartPoint.y = m_EndPoint.x = m_EndPoint.y = 0; - m_Matrix.Reset(); + m_Matrix.SetIdentity(); } virtual void Release() { delete this; } virtual int32_t GetType() const { return FDE_BRUSHTYPE_LinearGradient; } virtual const CFX_Matrix& GetMatrix() const { return m_Matrix; } - virtual void ResetMatrix() { m_Matrix.Reset(); } + virtual void ResetMatrix() { m_Matrix.SetIdentity(); } virtual void TranslateMatrix(FX_FLOAT dx, FX_FLOAT dy) { m_Matrix.Translate(dx, dy); } diff --git a/xfa/src/fdp/src/fde/fde_render.cpp b/xfa/src/fdp/src/fde/fde_render.cpp index f30d2748f2..af5b0e848d 100644 --- a/xfa/src/fdp/src/fde/fde_render.cpp +++ b/xfa/src/fdp/src/fde/fde_render.cpp @@ -66,7 +66,7 @@ CFDE_RenderContext::CFDE_RenderContext() m_pCharPos(NULL), m_iCharPosCount(0), m_pIterator(NULL) { - m_Transform.Reset(); + m_Transform.SetIdentity(); } CFDE_RenderContext::~CFDE_RenderContext() { StopRender(); @@ -159,7 +159,7 @@ void CFDE_RenderContext::StopRender() { Lock(); m_eStatus = FDE_RENDERSTATUS_Reset; m_pRenderDevice = NULL; - m_Transform.Reset(); + m_Transform.SetIdentity(); if (m_pIterator != NULL) { m_pIterator->Release(); m_pIterator = NULL; diff --git a/xfa/src/fdp/src/tto/fde_textout.cpp b/xfa/src/fdp/src/tto/fde_textout.cpp index 7612cb52f5..a1ef69ac42 100644 --- a/xfa/src/fdp/src/tto/fde_textout.cpp +++ b/xfa/src/fdp/src/tto/fde_textout.cpp @@ -36,7 +36,7 @@ CFDE_TextOut::CFDE_TextOut() m_pRenderDevice(NULL) { m_pTxtBreak = IFX_TxtBreak::Create(FX_TXTBREAKPOLICY_None); FXSYS_assert(m_pTxtBreak != NULL); - m_Matrix.Reset(); + m_Matrix.SetIdentity(); m_rtClip.Reset(); m_rtLogicClip.Reset(); } diff --git a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp index c3d3192361..0eaeaa41c2 100644 --- a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp @@ -29,7 +29,7 @@ CFWL_PictureBoxImp::CFWL_PictureBoxImp(IFWL_Widget* pOuter) m_bButton(FALSE) { m_rtClient.Reset(); m_rtImage.Reset(); - m_matrix.Reset(); + m_matrix.SetIdentity(); } CFWL_PictureBoxImp::CFWL_PictureBoxImp( const CFWL_WidgetImpProperties& properties, @@ -40,7 +40,7 @@ CFWL_PictureBoxImp::CFWL_PictureBoxImp( m_bButton(FALSE) { m_rtClient.Reset(); m_rtImage.Reset(); - m_matrix.Reset(); + m_matrix.SetIdentity(); } CFWL_PictureBoxImp::~CFWL_PictureBoxImp() {} FWL_ERR CFWL_PictureBoxImp::GetClassName(CFX_WideString& wsClass) const { diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp index 5a5fcab173..18a23012aa 100644 --- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp +++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp @@ -401,7 +401,7 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, if (parent) { pWidget->GetMatrix(m, TRUE); CFX_Matrix m1; - m1.Reset(); + m1.SetIdentity(); m1.SetReverse(m); m1.TransformPoint(fx, fy); pWidget->GetWidgetRect(r); @@ -422,7 +422,7 @@ FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { parents.Add(parent); parent = parent->GetParent(); } - matrix.Reset(); + matrix.SetIdentity(); CFX_Matrix ctmOnParent; CFX_RectF rect; int32_t count = parents.GetSize(); diff --git a/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp b/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp index 00bebaed90..7fe82b3428 100644 --- a/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp +++ b/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp @@ -463,7 +463,7 @@ IFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(IFWL_Widget* parent, CFX_Matrix matrixOnParent; child->GetMatrix(matrixOnParent); CFX_Matrix m; - m.Reset(); + m.SetIdentity(); m.SetReverse(matrixOnParent); m.TransformPoint(x1, y1); CFX_RectF bounds; diff --git a/xfa/src/fwl/src/lightwidget/picturebox.cpp b/xfa/src/fwl/src/lightwidget/picturebox.cpp index bb339a82aa..d4971306ca 100644 --- a/xfa/src/fwl/src/lightwidget/picturebox.cpp +++ b/xfa/src/fwl/src/lightwidget/picturebox.cpp @@ -112,7 +112,7 @@ FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget, pWidget->GetClientRect(rect); FX_FLOAT fLen = rect.width / 2; FX_FLOAT fWid = rect.height / 2; - matrix.Reset(); + matrix.SetIdentity(); matrix.Translate(-fLen, -fWid); matrix.Rotate(m_fRotation); matrix.Translate(fLen, fWid); diff --git a/xfa/src/fwl/src/theme/checkboxtp.cpp b/xfa/src/fwl/src/theme/checkboxtp.cpp index e488918ee3..c1856a9f80 100644 --- a/xfa/src/fwl/src/theme/checkboxtp.cpp +++ b/xfa/src/fwl/src/theme/checkboxtp.cpp @@ -247,7 +247,7 @@ void CFWL_CheckBoxTP::DrawSignCheck(CFX_Graphics* pGraphics, initCheckPath(pRtSign->width); } CFX_Matrix mt; - mt.Reset(); + mt.SetIdentity(); mt.Translate(pRtSign->left, pRtSign->top); mt.Concat(*pMatrix); CFX_Color crFill(argbFill); diff --git a/xfa/src/fwl/src/theme/widgettp.cpp b/xfa/src/fwl/src/theme/widgettp.cpp index b6052484d3..fb1803f85b 100644 --- a/xfa/src/fwl/src/theme/widgettp.cpp +++ b/xfa/src/fwl/src/theme/widgettp.cpp @@ -144,7 +144,7 @@ FX_BOOL CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { } FWL_ERR CFWL_WidgetTP::Initialize() { m_dwThemeID = 0; - _ctm.Reset(); + _ctm.SetIdentity(); return FWL_ERR_Succeeded; } FWL_ERR CFWL_WidgetTP::Finalize() { diff --git a/xfa/src/fxfa/src/app/xfa_rendercontext.cpp b/xfa/src/fxfa/src/app/xfa_rendercontext.cpp index b79402d1a4..0ebda0ccc8 100644 --- a/xfa/src/fxfa/src/app/xfa_rendercontext.cpp +++ b/xfa/src/fxfa/src/app/xfa_rendercontext.cpp @@ -18,7 +18,7 @@ CXFA_RenderContext::CXFA_RenderContext() { m_pPageView = NULL; m_pGS = NULL; m_dwStatus = 0; - m_matrix.Reset(); + m_matrix.SetIdentity(); m_rtClipRect.Reset(); } CXFA_RenderContext::~CXFA_RenderContext() { diff --git a/xfa/src/fxgraphics/src/fx_graphics.cpp b/xfa/src/fxgraphics/src/fx_graphics.cpp index 655c87085b..990e7f47e8 100644 --- a/xfa/src/fxgraphics/src/fx_graphics.cpp +++ b/xfa/src/fxgraphics/src/fx_graphics.cpp @@ -25,7 +25,7 @@ CFX_Graphics::CFX_Graphics() { _info._graphState.SetDashCount(0); _info._isAntialiasing = TRUE; _info._strokeAlignment = FX_STROKEALIGNMENT_Center; - _info._CTM.Reset(); + _info._CTM.SetIdentity(); _info._isActOnDash = FALSE; _info._strokeColor = NULL; _info._fillColor = NULL; @@ -1343,7 +1343,7 @@ FX_ERR CFX_Color::Set(CFX_Shading* shading) { } CFX_Pattern::CFX_Pattern() { _type = FX_PATTERN_None; - _matrix.Reset(); + _matrix.SetIdentity(); } FX_ERR CFX_Pattern::Create(CFX_DIBitmap* bitmap, const FX_FLOAT xStep, -- cgit v1.2.3