From bba2a7cf30da9e84bcc14ef32dbb0bb944229219 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 7 Feb 2017 16:36:39 -0500 Subject: Update to use CFX_Rect{F} and CFX_Matrix constructors. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl updates the code to use the constructors instead of creating an empty object and calling Set(). It also removes the various memsets of the CFX_Rect{F} classes. Change-Id: I6e20cec00866a38372858dcba5a30d31103172e4 Reviewed-on: https://pdfium-review.googlesource.com/2550 Commit-Queue: dsinclair Reviewed-by: Nicolás Peña Reviewed-by: Tom Sepez --- core/fxge/agg/fx_agg_driver.cpp | 8 +++++--- core/fxge/apple/fx_apple_platform.cpp | 2 +- core/fxge/ge/cfx_renderdevice.cpp | 5 +++-- core/fxge/skia/fx_skia_device_unittest.cpp | 4 +++- core/fxge/win32/cfx_psrenderer.cpp | 9 ++++++--- 5 files changed, 18 insertions(+), 10 deletions(-) (limited to 'core/fxge') diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index fa361547a9..71d6dbaf86 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -1501,14 +1501,16 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, matrix1.a = std::max(FXSYS_fabs(pObject2Device->a), FXSYS_fabs(pObject2Device->b)); matrix1.d = matrix1.a; - matrix2.Set(pObject2Device->a / matrix1.a, pObject2Device->b / matrix1.a, - pObject2Device->c / matrix1.d, pObject2Device->d / matrix1.d, 0, - 0); + matrix2 = CFX_Matrix( + pObject2Device->a / matrix1.a, pObject2Device->b / matrix1.a, + pObject2Device->c / matrix1.d, pObject2Device->d / matrix1.d, 0, 0); + CFX_Matrix mtRervese; mtRervese.SetReverse(matrix2); matrix1 = *pObject2Device; matrix1.Concat(mtRervese); } + CAgg_PathData path_data; path_data.BuildPath(pPathData, &matrix1); agg::rasterizer_scanline_aa rasterizer; diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp index 7fc12fd362..6d7fb2e06a 100644 --- a/core/fxge/apple/fx_apple_platform.cpp +++ b/core/fxge/apple/fx_apple_platform.cpp @@ -35,12 +35,12 @@ bool CGDrawGlyphRun(CGContextRef pContext, if (nChars == 0) return true; - CFX_Matrix new_matrix; bool bNegSize = font_size < 0; if (bNegSize) font_size = -font_size; FX_FLOAT ori_x = pCharPos[0].m_OriginX, ori_y = pCharPos[0].m_OriginY; + CFX_Matrix new_matrix; new_matrix.Transform(ori_x, ori_y); if (pObject2Device) new_matrix.Concat(*pObject2Device); diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp index 4353e0a414..2f3d1bb60e 100644 --- a/core/fxge/ge/cfx_renderdevice.cpp +++ b/core/fxge/ge/cfx_renderdevice.cpp @@ -1060,8 +1060,9 @@ bool CFX_RenderDevice::DrawTextPath(int nChars, const FXTEXT_CHARPOS& charpos = pCharPos[iChar]; CFX_Matrix matrix; if (charpos.m_bGlyphAdjust) { - matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], - charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); + matrix = CFX_Matrix(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], + charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], + 0, 0); } matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, charpos.m_OriginY); diff --git a/core/fxge/skia/fx_skia_device_unittest.cpp b/core/fxge/skia/fx_skia_device_unittest.cpp index c77c8f88e6..693cf1b616 100644 --- a/core/fxge/skia/fx_skia_device_unittest.cpp +++ b/core/fxge/skia/fx_skia_device_unittest.cpp @@ -46,7 +46,9 @@ void CommonTest(CFX_SkiaDeviceDriver* driver, const State& state) { driver->SaveState(); CFX_PathData path1; path1.AppendRect(0, 0, 1, 2); - CFX_Matrix matrix, matrix2; + + CFX_Matrix matrix; + CFX_Matrix matrix2; matrix2.Translate(1, 0); CFX_GraphStateData graphState; if (state.m_save == State::Save::kYes) diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index c01c4c0060..9970e21254 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -581,10 +581,13 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, pPSFont->m_Glyphs[glyphindex].m_AdjustMatrix[3] = charpos.m_AdjustMatrix[3]; } pPSFont->m_nGlyphs++; + CFX_Matrix matrix; - if (charpos.m_bGlyphAdjust) - matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], - charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); + if (charpos.m_bGlyphAdjust) { + matrix = + CFX_Matrix(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], + charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); + } matrix.Concat(1.0f, 0, 0, 1.0f, 0, 0); const CFX_PathData* pPathData = pFaceCache->LoadGlyphPath( pFont, charpos.m_GlyphIndex, charpos.m_FontCharWidth); -- cgit v1.2.3