From affe4b09575b297747e66bd0b807d2b1b04822fe Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 23 Feb 2016 16:04:59 -0500 Subject: Remove FXSYS_Div. This is just a wrapper for (a) / (b). Inline the divide. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1727793002 . --- core/src/fxge/agg/src/fx_agg_driver.cpp | 4 ++-- core/src/fxge/dib/fx_dib_engine.cpp | 10 +++++----- core/src/fxge/ge/fx_ge_path.cpp | 6 +++--- core/src/fxge/win32/fx_win32_gdipext.cpp | 5 ++--- core/src/fxge/win32/fx_win32_print.cpp | 3 +-- 5 files changed, 13 insertions(+), 15 deletions(-) (limited to 'core/src/fxge') diff --git a/core/src/fxge/agg/src/fx_agg_driver.cpp b/core/src/fxge/agg/src/fx_agg_driver.cpp index 50062541b1..8b0e3f94f4 100644 --- a/core/src/fxge/agg/src/fx_agg_driver.cpp +++ b/core/src/fxge/agg/src/fx_agg_driver.cpp @@ -144,8 +144,8 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, FX_FLOAT width = pGraphState->m_LineWidth * scale; FX_FLOAT unit = 1.f; if (pObject2Device) { - unit = FXSYS_Div( - 1.0f, (pObject2Device->GetXUnit() + pObject2Device->GetYUnit()) / 2); + unit = + 1.0f / ((pObject2Device->GetXUnit() + pObject2Device->GetYUnit()) / 2); } if (width < unit) { width = unit; diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index 47fca79846..322040539e 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -20,7 +20,7 @@ void CWeightTable::Calc(int dest_len, FX_Free(m_pWeightTables); m_pWeightTables = NULL; double scale, base; - scale = FXSYS_Div((FX_FLOAT)(src_len), (FX_FLOAT)(dest_len)); + scale = (FX_FLOAT)src_len / (FX_FLOAT)dest_len; if (dest_len < 0) { base = (FX_FLOAT)(src_len); } else { @@ -188,8 +188,8 @@ void CWeightTable::Calc(int dest_len, pixel_weights.m_SrcStart = start_i; pixel_weights.m_SrcEnd = end_i; for (int j = start_i; j <= end_i; j++) { - double dest_start = FXSYS_Div((FX_FLOAT)(j)-base, scale); - double dest_end = FXSYS_Div((FX_FLOAT)(j + 1) - base, scale); + double dest_start = ((FX_FLOAT)j - base) / scale; + double dest_end = ((FX_FLOAT)(j + 1) - base) / scale; if (dest_start > dest_end) { double temp = dest_start; dest_start = dest_end; @@ -270,8 +270,8 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, m_Flags |= FXDIB_DOWNSAMPLE; } } - double scale_x = FXSYS_Div((FX_FLOAT)(m_SrcWidth), (FX_FLOAT)(m_DestWidth)); - double scale_y = FXSYS_Div((FX_FLOAT)(m_SrcHeight), (FX_FLOAT)(m_DestHeight)); + double scale_x = (FX_FLOAT)m_SrcWidth / (FX_FLOAT)m_DestWidth; + double scale_y = (FX_FLOAT)m_SrcHeight / (FX_FLOAT)m_DestHeight; double base_x = m_DestWidth > 0 ? 0.0f : (FX_FLOAT)(m_DestWidth); double base_y = m_DestHeight > 0 ? 0.0f : (FX_FLOAT)(m_DestHeight); double src_left = scale_x * ((FX_FLOAT)(clip_rect.left) + base_x); diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp index 0084f092d1..0c24c0ff64 100644 --- a/core/src/fxge/ge/fx_ge_path.cpp +++ b/core/src/fxge/ge/fx_ge_path.cpp @@ -263,14 +263,14 @@ static void _UpdateLineJoinPoints(CFX_FloatRect& rect, return; } if (!bStartVert) { - start_k = FXSYS_Div(middle_y - start_y, middle_x - start_x); + start_k = (middle_y - start_y) / (middle_x - start_x); start_c = middle_y - (start_k * middle_x); start_len = FXSYS_sqrt2(start_x - middle_x, start_y - middle_y); start_dc = (FX_FLOAT)FXSYS_fabs( FXSYS_MulDiv(half_width, start_len, start_x - middle_x)); } if (!bEndVert) { - end_k = FXSYS_Div(end_y - middle_y, end_x - middle_x); + end_k = (end_y - middle_y) / (end_x - middle_x); end_c = middle_y - (end_k * middle_x); end_len = FXSYS_sqrt2(end_x - middle_x, end_y - middle_y); end_dc = (FX_FLOAT)FXSYS_fabs( @@ -331,7 +331,7 @@ static void _UpdateLineJoinPoints(CFX_FloatRect& rect, } else { end_outside_c -= end_dc; } - FX_FLOAT join_x = FXSYS_Div(end_outside_c - start_outside_c, start_k - end_k); + FX_FLOAT join_x = (end_outside_c - start_outside_c) / (start_k - end_k); FX_FLOAT join_y = (start_k * join_x) + start_outside_c; rect.UpdateRect(join_x, join_y); } diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index ce280948d7..e71d94d310 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -973,9 +973,8 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, FX_FLOAT width = pGraphState ? pGraphState->m_LineWidth : 1.0f; if (!bTextMode) { FX_FLOAT unit = - pMatrix - ? FXSYS_Div(1.0f, (pMatrix->GetXUnit() + pMatrix->GetYUnit()) / 2) - : 1.0f; + pMatrix ? 1.0f / ((pMatrix->GetXUnit() + pMatrix->GetYUnit()) / 2) + : 1.0f; if (width < unit) { width = unit; } diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp index 4816c03e2c..6c262d83dc 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -149,8 +149,7 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, uint8_t* src_buf = pSrcBitmap->GetBuffer(); FX_DWORD src_pitch = pSrcBitmap->GetPitch(); FX_FLOAT dest_area = pDestMatrix->GetUnitArea(); - FX_FLOAT area_scale = - FXSYS_Div((FX_FLOAT)(src_width * src_height), dest_area); + FX_FLOAT area_scale = ((FX_FLOAT)(src_width * src_height)) / dest_area; FX_FLOAT size_scale = FXSYS_sqrt(area_scale); CFX_Matrix adjusted_matrix(*pDestMatrix); adjusted_matrix.Scale(size_scale, size_scale); -- cgit v1.2.3