From a0061afa12e0fec210727c9478adb8ac78c5d63c Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 23 Feb 2017 09:25:17 -0500 Subject: Convert TransformPoint calls to Transform calls This Cl converts remaining calls to TransformPoint to use Transform instead. Change-Id: I7a2c000492da5dda3975b4449812f281816fdab6 Reviewed-on: https://pdfium-review.googlesource.com/2822 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- core/fpdfapi/render/cpdf_renderstatus.cpp | 54 +++++++++++++++--------------- core/fpdfapi/render/cpdf_textrenderer.cpp | 10 ++---- core/fpdfapi/render/cpdf_textrenderer.h | 1 - core/fpdftext/cpdf_textpage.cpp | 6 ++-- core/fxcrt/fx_basic_coords.cpp | 12 ++----- core/fxcrt/fx_coordinates.h | 1 - core/fxge/win32/fx_win32_gdipext.cpp | 15 +++++---- fpdfsdk/cpdfsdk_widget.cpp | 10 ++++-- fpdfsdk/formfiller/cffl_formfiller.cpp | 11 ++----- fpdfsdk/fpdfview.cpp | 18 +++++----- fpdfsdk/fpdfxfa/cpdfxfa_page.cpp | 18 +++++----- fpdfsdk/fxedit/fxet_edit.cpp | 55 +++++++------------------------ fpdfsdk/fxedit/fxet_edit.h | 1 - fpdfsdk/pdfwindow/PWL_Edit.cpp | 14 ++++---- fpdfsdk/pdfwindow/PWL_ListBox.cpp | 8 ++--- fpdfsdk/pdfwindow/PWL_Wnd.cpp | 13 -------- fpdfsdk/pdfwindow/PWL_Wnd.h | 5 --- 17 files changed, 91 insertions(+), 161 deletions(-) diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index fe04174c28..1e67eaba55 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -159,10 +159,11 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap, for (int row = 0; row < height; row++) { uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { - FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; - matrix.TransformPoint(x, y); - FX_FLOAT scale = (((x - start_x) * x_span) + ((y - start_y) * y_span)) / - axis_len_square; + CFX_PointF pos = matrix.Transform(CFX_PointF( + static_cast(column), static_cast(row))); + FX_FLOAT scale = + (((pos.x - start_x) * x_span) + ((pos.y - start_y) * y_span)) / + axis_len_square; int index = (int32_t)(scale * (SHADING_STEPS - 1)); if (index < 0) { if (!bStartExtend) @@ -252,13 +253,14 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap, for (int row = 0; row < height; row++) { uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { - FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; - matrix.TransformPoint(x, y); - FX_FLOAT b = -2 * (((x - start_x) * (end_x - start_x)) + - ((y - start_y) * (end_y - start_y)) + + CFX_PointF pos = matrix.Transform(CFX_PointF( + static_cast(column), static_cast(row))); + FX_FLOAT b = -2 * (((pos.x - start_x) * (end_x - start_x)) + + ((pos.y - start_y) * (end_y - start_y)) + (start_r * (end_r - start_r))); - FX_FLOAT c = ((x - start_x) * (x - start_x)) + - ((y - start_y) * (y - start_y)) - (start_r * start_r); + FX_FLOAT c = ((pos.x - start_x) * (pos.x - start_x)) + + ((pos.y - start_y) * (pos.y - start_y)) - + (start_r * start_r); FX_FLOAT s; if (a == 0) { s = -c / b; @@ -344,15 +346,13 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap, for (int row = 0; row < height; row++) { uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { - FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; - matrix.TransformPoint(x, y); - if (x < xmin || x > xmax || y < ymin || y > ymax) { + CFX_PointF pos = matrix.Transform(CFX_PointF( + static_cast(column), static_cast(row))); + if (pos.x < xmin || pos.x > xmax || pos.y < ymin || pos.y > ymax) continue; - } - FX_FLOAT input[2]; + + FX_FLOAT input[] = {pos.x, pos.y}; int offset = 0; - input[0] = x; - input[1] = y; for (const auto& func : funcs) { if (func) { int nresults; @@ -360,7 +360,10 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap, offset += nresults; } } - FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; + + FX_FLOAT R = 0.0f; + FX_FLOAT G = 0.0f; + FX_FLOAT B = 0.0f; pCS->GetRGB(pResults, R, G, B); dib_buf[column] = FXARGB_TODIB(FXARGB_MAKE( alpha, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255))); @@ -843,10 +846,8 @@ void DrawCoonPatchMeshes( tempColors[1] = patch.patch_colors[(flag + 1) % 4]; FXSYS_memcpy(patch.patch_colors, tempColors, sizeof(Coon_Color) * 2); } - for (i = iStartPoint; i < point_count; i++) { - coords[i] = stream.ReadCoords(); - pObject2Bitmap->TransformPoint(coords[i].x, coords[i].y); - } + for (i = iStartPoint; i < point_count; i++) + coords[i] = pObject2Bitmap->Transform(stream.ReadCoords()); for (i = iStartColor; i < 4; i++) { FX_FLOAT r; @@ -2302,14 +2303,13 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, start_x = FXSYS_round(mtPattern2Device.e) + col * width - clip_box.left; start_y = FXSYS_round(mtPattern2Device.f) + row * height - clip_box.top; } else { - FX_FLOAT orig_x = col * pPattern->x_step(); - FX_FLOAT orig_y = row * pPattern->y_step(); - mtPattern2Device.TransformPoint(orig_x, orig_y); + CFX_PointF original = mtPattern2Device.Transform( + CFX_PointF(col * pPattern->x_step(), row * pPattern->y_step())); pdfium::base::CheckedNumeric safeStartX = - FXSYS_round(orig_x + left_offset); + FXSYS_round(original.x + left_offset); pdfium::base::CheckedNumeric safeStartY = - FXSYS_round(orig_y + top_offset); + FXSYS_round(original.y + top_offset); safeStartX -= clip_box.left; safeStartY -= clip_box.top; diff --git a/core/fpdfapi/render/cpdf_textrenderer.cpp b/core/fpdfapi/render/cpdf_textrenderer.cpp index 28e28f8147..95af863f7a 100644 --- a/core/fpdfapi/render/cpdf_textrenderer.cpp +++ b/core/fpdfapi/render/cpdf_textrenderer.cpp @@ -72,7 +72,6 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, const CFX_Matrix* pMatrix, const CFX_ByteString& str, FX_ARGB fill_argb, - FX_ARGB stroke_argb, const CFX_GraphStateData* pGraphState, const CPDF_RenderOptions* pOptions) { if (pFont->IsType3Font()) @@ -101,13 +100,8 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, matrix.e = origin_x; matrix.f = origin_y; - if (stroke_argb == 0) { - DrawNormalText(pDevice, codes, positions, pFont, font_size, &matrix, - fill_argb, pOptions); - } else { - DrawTextPath(pDevice, codes, positions, pFont, font_size, &matrix, nullptr, - pGraphState, fill_argb, stroke_argb, nullptr, 0); - } + DrawNormalText(pDevice, codes, positions, pFont, font_size, &matrix, + fill_argb, pOptions); } // static diff --git a/core/fpdfapi/render/cpdf_textrenderer.h b/core/fpdfapi/render/cpdf_textrenderer.h index d3acceeb96..54e9d1bd05 100644 --- a/core/fpdfapi/render/cpdf_textrenderer.h +++ b/core/fpdfapi/render/cpdf_textrenderer.h @@ -30,7 +30,6 @@ class CPDF_TextRenderer { const CFX_Matrix* matrix, const CFX_ByteString& str, FX_ARGB fill_argb, - FX_ARGB stroke_argb, const CFX_GraphStateData* pGraphState, const CPDF_RenderOptions* pOptions); diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index bd60435bb1..73a1a7e88e 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -268,8 +268,8 @@ std::vector CPDF_TextPage::GetRectArray(int start, rect.bottom = origin.y + pCurObj->GetFont()->GetTypeDescent() * pCurObj->GetFontSize() / 1000; - FX_FLOAT xPosTemp = origin.x; - matrix.TransformPoint(xPosTemp, rect.bottom); + + rect.bottom = matrix.Transform(CFX_PointF(origin.x, rect.bottom)).y; } else { rect.bottom = info_curchar.m_CharBox.bottom; } @@ -281,7 +281,7 @@ std::vector CPDF_TextPage::GetRectArray(int start, origin.x + GetCharWidth(info_curchar.m_CharCode, pCurObj->GetFont()) * pCurObj->GetFontSize() / 1000; - matrix.TransformPoint(xPosTemp, rect.top); + rect.top = matrix.Transform(CFX_PointF(xPosTemp, rect.top)).y; } else { rect.top = info_curchar.m_CharBox.top; } diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp index 3e306339f2..cb5a010427 100644 --- a/core/fxcrt/fx_basic_coords.cpp +++ b/core/fxcrt/fx_basic_coords.cpp @@ -363,17 +363,9 @@ FX_FLOAT CFX_Matrix::TransformDistance(FX_FLOAT distance) const { return distance * (GetXUnit() + GetYUnit()) / 2; } -void CFX_Matrix::TransformPoint(FX_FLOAT& x, FX_FLOAT& y) const { - FX_FLOAT fx = a * x + c * y + e; - FX_FLOAT fy = b * x + d * y + f; - x = fx; - y = fy; -} - CFX_PointF CFX_Matrix::Transform(const CFX_PointF& point) const { - CFX_PointF ret = point; - TransformPoint(ret.x, ret.y); - return ret; + return CFX_PointF(a * point.x + c * point.y + e, + b * point.x + d * point.y + f); } void CFX_Matrix::TransformRect(CFX_RectF& rect) const { diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index a900506fe7..2c84d0776c 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -646,7 +646,6 @@ class CFX_Matrix { FX_FLOAT TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const; FX_FLOAT TransformDistance(FX_FLOAT distance) const; - void TransformPoint(FX_FLOAT& x, FX_FLOAT& y) const; CFX_PointF Transform(const CFX_PointF& point) const; void TransformRect(CFX_RectF& rect) const; diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 54711ceef5..1be2a54b18 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -1080,15 +1080,16 @@ static bool IsSmallTriangle(PointF* points, for (int i = 0; i < 3; i++) { int pair1 = pairs[i * 2]; int pair2 = pairs[i * 2 + 1]; - FX_FLOAT x1 = points[pair1].X, x2 = points[pair2].X; - FX_FLOAT y1 = points[pair1].Y, y2 = points[pair2].Y; + + CFX_PointF p1(points[pair1].X, points[pair1].Y); + CFX_PointF p2(points[pair2].X, points[pair2].Y); if (pMatrix) { - pMatrix->TransformPoint(x1, y1); - pMatrix->TransformPoint(x2, y2); + p1 = pMatrix->Transform(p1); + p2 = pMatrix->Transform(p2); } - FX_FLOAT dx = x1 - x2; - FX_FLOAT dy = y1 - y2; - FX_FLOAT distance_square = (dx * dx) + (dy * dy); + + CFX_PointF diff = p1 - p2; + FX_FLOAT distance_square = (diff.x * diff.x) + (diff.y * diff.y); if (distance_square < (1.0f * 2 + 1.0f / 4)) { v1 = i; v2 = pair1; diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 8925c9a302..a4506e74a6 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -845,8 +845,14 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, pPageView->GetCurrentMatrix(page2device); CFX_FloatRect rcDevice = GetRect(); - page2device.TransformPoint(rcDevice.left, rcDevice.bottom); - page2device.TransformPoint(rcDevice.right, rcDevice.top); + CFX_PointF tmp = + page2device.Transform(CFX_PointF(rcDevice.left, rcDevice.bottom)); + rcDevice.left = tmp.x; + rcDevice.bottom = tmp.y; + + tmp = page2device.Transform(CFX_PointF(rcDevice.right, rcDevice.top)); + rcDevice.right = tmp.x; + rcDevice.top = tmp.y; rcDevice.Normalize(); FX_RECT rcDev = rcDevice.ToFxRect(); diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 44df8dd770..da6f9208e0 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -483,18 +483,11 @@ CFX_FloatRect CFFL_FormFiller::PWLtoFFL(const CFX_FloatRect& rect) { CFX_PointF CFFL_FormFiller::FFLtoPWL(const CFX_PointF& point) { CFX_Matrix mt; mt.SetReverse(GetCurMatrix()); - - CFX_PointF pt = point; - mt.TransformPoint(pt.x, pt.y); - return pt; + return mt.Transform(point); } CFX_PointF CFFL_FormFiller::PWLtoFFL(const CFX_PointF& point) { - CFX_Matrix mt = GetCurMatrix(); - - CFX_PointF pt = point; - mt.TransformPoint(pt.x, pt.y); - return pt; + return GetCurMatrix().Transform(point); } CFX_PointF CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 57d5d4d343..e1fba8df66 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -855,12 +855,11 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, CFX_Matrix device2page; device2page.SetReverse(page2device); - FX_FLOAT page_x_f = static_cast(device_x); - FX_FLOAT page_y_f = static_cast(device_y); - device2page.TransformPoint(page_x_f, page_y_f); + CFX_PointF pos = device2page.Transform(CFX_PointF( + static_cast(device_x), static_cast(device_y))); - *page_x = page_x_f; - *page_y = page_y_f; + *page_x = pos.x; + *page_y = pos.y; #endif // PDF_ENABLE_XFA } @@ -885,12 +884,11 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, #else // PDF_ENABLE_XFA CFX_Matrix page2device = pPage->GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate); - FX_FLOAT device_x_f = static_cast(page_x); - FX_FLOAT device_y_f = static_cast(page_y); - page2device.TransformPoint(device_x_f, device_y_f); + CFX_PointF pos = page2device.Transform( + CFX_PointF(static_cast(page_x), static_cast(page_y))); - *device_x = FXSYS_round(device_x_f); - *device_y = FXSYS_round(device_y_f); + *device_x = FXSYS_round(pos.x); + *device_y = FXSYS_round(pos.y); #endif // PDF_ENABLE_XFA } diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp index b708a361e5..8b5bb3d279 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp @@ -158,12 +158,11 @@ void CPDFXFA_Page::DeviceToPage(int start_x, device2page.SetReverse( GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate)); - FX_FLOAT page_x_f = static_cast(device_x); - FX_FLOAT page_y_f = static_cast(device_y); - device2page.TransformPoint(page_x_f, page_y_f); + CFX_PointF pos = device2page.Transform(CFX_PointF( + static_cast(device_x), static_cast(device_y))); - *page_x = page_x_f; - *page_y = page_y_f; + *page_x = pos.x; + *page_y = pos.y; } void CPDFXFA_Page::PageToDevice(int start_x, @@ -181,12 +180,11 @@ void CPDFXFA_Page::PageToDevice(int start_x, CFX_Matrix page2device = GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate); - FX_FLOAT device_x_f = static_cast(page_x); - FX_FLOAT device_y_f = static_cast(page_y); - page2device.TransformPoint(device_x_f, device_y_f); + CFX_PointF pos = page2device.Transform( + CFX_PointF(static_cast(page_x), static_cast(page_y))); - *device_x = FXSYS_round(device_x_f); - *device_y = FXSYS_round(device_y_f); + *device_x = FXSYS_round(pos.x); + *device_y = FXSYS_round(pos.y); } CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(int xPos, diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 5b6fd55685..1acc57795a 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -63,10 +63,8 @@ void DrawTextString(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, const CFX_ByteString& str, FX_ARGB crTextFill, - FX_ARGB crTextStroke, int32_t nHorzScale) { - FX_FLOAT x = pt.x, y = pt.y; - pUser2Device->TransformPoint(x, y); + CFX_PointF pos = pUser2Device->Transform(pt); if (pFont) { if (nHorzScale != 100) { @@ -77,44 +75,16 @@ void DrawTextString(CFX_RenderDevice* pDevice, ro.m_Flags = RENDER_CLEARTYPE; ro.m_ColorMode = RENDER_COLOR_NORMAL; - if (crTextStroke != 0) { - CFX_PointF pt1; - CFX_PointF pt2; - pUser2Device->TransformPoint(pt1.x, pt1.y); - pUser2Device->TransformPoint(pt2.x, pt2.y); - CFX_GraphStateData gsd; - gsd.m_LineWidth = - (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y)); - - CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt, - str, crTextFill, crTextStroke, &gsd, - &ro); - } else { - CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt, - str, crTextFill, 0, nullptr, &ro); - } + CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize, + &mt, str, crTextFill, nullptr, &ro); } else { CPDF_RenderOptions ro; ro.m_Flags = RENDER_CLEARTYPE; ro.m_ColorMode = RENDER_COLOR_NORMAL; - if (crTextStroke != 0) { - CFX_PointF pt1; - CFX_PointF pt2; - pUser2Device->TransformPoint(pt1.x, pt1.y); - pUser2Device->TransformPoint(pt2.x, pt2.y); - CFX_GraphStateData gsd; - gsd.m_LineWidth = - (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y)); - - CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, - pUser2Device, str, crTextFill, - crTextStroke, &gsd, &ro); - } else { - CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, - pUser2Device, str, crTextFill, 0, - nullptr, &ro); - } + CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize, + pUser2Device, str, crTextFill, nullptr, + &ro); } } } @@ -748,7 +718,6 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, CFX_Edit* pEdit, FX_COLORREF crTextFill, - FX_COLORREF crTextStroke, const CFX_FloatRect& rcClip, const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, @@ -830,7 +799,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, DrawTextString( pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, - sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); + sTextBuf.MakeString(), crOldFill, nHorzScale); sTextBuf.Clear(); } @@ -848,17 +817,17 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, word.ptWord.y + ptOffset.y), pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device, GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord), - crCurFill, crTextStroke, nHorzScale); + crCurFill, nHorzScale); } oldplace = place; } } if (sTextBuf.GetLength() > 0) { - DrawTextString( - pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), - pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, - sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); + DrawTextString(pDevice, + CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, + sTextBuf.MakeString(), crOldFill, nHorzScale); } } diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h index c8caeb9844..ab83af2e3b 100644 --- a/fpdfsdk/fxedit/fxet_edit.h +++ b/fpdfsdk/fxedit/fxet_edit.h @@ -324,7 +324,6 @@ class CFX_Edit { CFX_Matrix* pUser2Device, CFX_Edit* pEdit, FX_COLORREF crTextFill, - FX_COLORREF crTextStroke, const CFX_FloatRect& rcClip, const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index 4aa3d927d7..f96455e22d 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -266,7 +266,8 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { m_pEdit->GetPasswordChar()); if (sEditBefore.GetLength() > 0) - sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() + sText << "BT\n" + << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() << sEditBefore.AsStringC() << "ET\n"; wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelect); @@ -286,7 +287,8 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { m_pEdit->GetPasswordChar()); if (sEditAfter.GetLength() > 0) - sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() + sText << "BT\n" + << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() << sEditAfter.AsStringC() << "ET\n"; if (sText.GetLength() > 0) { @@ -394,9 +396,8 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_SystemHandler* pSysHandler = GetSystemHandler(); CFX_Edit::DrawEdit( pDevice, pUser2Device, m_pEdit.get(), - CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), - rcClip, CFX_PointF(), pRange, pSysHandler, m_pFormFiller); + CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), rcClip, + CFX_PointF(), pRange, pSysHandler, m_pFormFiller); } bool CPWL_Edit::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { @@ -491,7 +492,8 @@ CFX_ByteString CPWL_Edit::GetTextAppearanceStream( CFX_ByteTextBuf sRet; CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit.get(), ptOffset); if (sEdit.GetLength() > 0) { - sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() + sRet << "BT\n" + << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() << sEdit.AsStringC() << "ET\n"; } return sRet.MakeString(); diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp index 3f5dfef142..c7e8c9e97c 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp @@ -172,7 +172,6 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, if (pSysHandler && pSysHandler->IsSelectionImplemented()) { CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), CPWL_Utils::PWLColorToFXColor(GetTextColor()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), rcList, ptOffset, nullptr, pSysHandler, m_pFormFiller); pSysHandler->OutputSelectedRect(m_pFormFiller, rcItem); @@ -180,15 +179,14 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem, ArgbEncode(255, 0, 51, 113)); CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), - ArgbEncode(255, 255, 255, 255), 0, rcList, ptOffset, + ArgbEncode(255, 255, 255, 255), rcList, ptOffset, nullptr, pSysHandler, m_pFormFiller); } } else { CFX_SystemHandler* pSysHandler = GetSystemHandler(); CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), - CPWL_Utils::PWLColorToFXColor(GetTextColor()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), - rcList, ptOffset, nullptr, pSysHandler, nullptr); + CPWL_Utils::PWLColorToFXColor(GetTextColor()), rcList, + ptOffset, nullptr, pSysHandler, nullptr); } } } diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp index f5d97adc19..1f13e2ab6c 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -32,7 +32,6 @@ PWL_CREATEPARAM::PWL_CREATEPARAM() dwBorderWidth(1), sBorderColor(), sTextColor(), - sTextStrokeColor(), nTransparency(255), fFontSize(PWL_DEFAULT_FONTSIZE), sDash(3, 0, 0), @@ -559,22 +558,10 @@ void CPWL_Wnd::SetBackgroundColor(const CPWL_Color& color) { m_sPrivateParam.sBackgroundColor = color; } -void CPWL_Wnd::SetTextColor(const CPWL_Color& color) { - m_sPrivateParam.sTextColor = color; -} - -void CPWL_Wnd::SetTextStrokeColor(const CPWL_Color& color) { - m_sPrivateParam.sTextStrokeColor = color; -} - CPWL_Color CPWL_Wnd::GetTextColor() const { return m_sPrivateParam.sTextColor; } -CPWL_Color CPWL_Wnd::GetTextStrokeColor() const { - return m_sPrivateParam.sTextStrokeColor; -} - BorderStyle CPWL_Wnd::GetBorderStyle() const { return m_sPrivateParam.nBorderStyle; } diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index 92c099f9cd..9c378f06c5 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -181,7 +181,6 @@ struct PWL_CREATEPARAM { dwBorderWidth = 0; sBorderColor.Reset(); sTextColor.Reset(); - sTextStrokeColor.Reset(); nTransparency = 0; fFontSize = 0.0f; sDash.Reset(); @@ -204,7 +203,6 @@ struct PWL_CREATEPARAM { int32_t dwBorderWidth; // optional CPWL_Color sBorderColor; // optional CPWL_Color sTextColor; // optional - CPWL_Color sTextStrokeColor; // optional int32_t nTransparency; // optional FX_FLOAT fFontSize; // optional CPWL_Dash sDash; // optional @@ -286,15 +284,12 @@ class CPWL_Wnd : public CPWL_TimerHandler { uint32_t msg, intptr_t wParam = 0, intptr_t lParam = 0); - virtual void SetTextColor(const CPWL_Color& color); - virtual void SetTextStrokeColor(const CPWL_Color& color); virtual void SetVisible(bool bVisible); virtual CFX_FloatRect GetFocusRect() const; virtual CPWL_Color GetBackgroundColor() const; virtual CPWL_Color GetBorderColor() const; virtual CPWL_Color GetTextColor() const; - virtual CPWL_Color GetTextStrokeColor() const; virtual FX_FLOAT GetFontSize() const; virtual int32_t GetInnerBorderWidth() const; virtual CPWL_Color GetBorderLeftTopColor(BorderStyle nBorderStyle) const; -- cgit v1.2.3