summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-09 13:07:43 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-09 19:02:55 +0000
commitafb44560a21298b3588b36cbaf45e2be50f2e75b (patch)
tree21f3ececad017e6be64a19c4370cfe9fd7f9c29c
parent67e4faaf8be0aebc67ebfb96d33933d9f9119d20 (diff)
downloadpdfium-afb44560a21298b3588b36cbaf45e2be50f2e75b.tar.xz
Remove Transform in favour of TransformPoint
This CL removes the two Transform() overrides from CFX_Matrix and calls the TransformPoint methods directly. In the case of the 4 param version the values were assigned to the out values before calling. Change-Id: Id633826caec75b848774dcda6cfdcef2dbf5a7db Reviewed-on: https://pdfium-review.googlesource.com/2573 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--core/fpdfapi/page/cpdf_meshstream.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp6
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp12
-rw-r--r--core/fpdftext/cpdf_textpage.cpp36
-rw-r--r--core/fxcrt/fx_basic_coords.cpp44
-rw-r--r--core/fxcrt/fx_coordinates.h6
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp8
-rw-r--r--core/fxge/apple/fx_apple_platform.cpp2
-rw-r--r--core/fxge/ge/cfx_pathdata.cpp31
-rw-r--r--core/fxge/ge/cfx_renderdevice.cpp19
-rw-r--r--core/fxge/win32/cfx_psrenderer.cpp10
-rw-r--r--core/fxge/win32/fx_win32_device.cpp22
-rw-r--r--core/fxge/win32/fx_win32_gdipext.cpp29
-rw-r--r--fpdfsdk/cfx_systemhandler.cpp15
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp20
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp6
-rw-r--r--fpdfsdk/fpdfview.cpp16
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.cpp17
-rw-r--r--fpdfsdk/fxedit/fxet_edit.cpp10
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.cpp4
-rw-r--r--fpdfsdk/pdfwindow/PWL_Wnd.cpp6
-rw-r--r--third_party/agg23/agg_rasterizer_scanline_aa.h7
22 files changed, 150 insertions, 180 deletions
diff --git a/core/fpdfapi/page/cpdf_meshstream.cpp b/core/fpdfapi/page/cpdf_meshstream.cpp
index 8bc2a851cc..b852901794 100644
--- a/core/fpdfapi/page/cpdf_meshstream.cpp
+++ b/core/fpdfapi/page/cpdf_meshstream.cpp
@@ -195,7 +195,7 @@ uint32_t CPDF_MeshStream::GetVertex(CPDF_MeshVertex& vertex,
CFX_Matrix* pObject2Bitmap) {
uint32_t flag = GetFlag();
GetCoords(vertex.x, vertex.y);
- pObject2Bitmap->Transform(vertex.x, vertex.y);
+ pObject2Bitmap->TransformPoint(vertex.x, vertex.y);
GetColor(vertex.r, vertex.g, vertex.b);
m_BitStream.ByteAlign();
return flag;
@@ -209,7 +209,7 @@ bool CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex,
return false;
GetCoords(vertex[i].x, vertex[i].y);
- pObject2Bitmap->Transform(vertex[i].x, vertex[i].y);
+ pObject2Bitmap->TransformPoint(vertex[i].x, vertex[i].y);
GetColor(vertex[i].r, vertex[i].g, vertex[i].b);
m_BitStream.ByteAlign();
}
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 1fcb27a8c8..93478de174 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -1230,13 +1230,13 @@ CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name,
}
void CPDF_StreamContentParser::ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y) {
- m_pCurStates->m_TextMatrix.Transform(x, y, x, y);
+ m_pCurStates->m_TextMatrix.TransformPoint(x, y);
ConvertUserSpace(x, y);
}
void CPDF_StreamContentParser::ConvertUserSpace(FX_FLOAT& x, FX_FLOAT& y) {
- m_pCurStates->m_CTM.Transform(x, y, x, y);
- m_mtContentToUser.Transform(x, y, x, y);
+ m_pCurStates->m_CTM.TransformPoint(x, y);
+ m_mtContentToUser.TransformPoint(x, y);
}
void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 07987d616e..813ff3784c 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -160,7 +160,7 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap,
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.Transform(x, y);
+ matrix.TransformPoint(x, y);
FX_FLOAT scale = (((x - start_x) * x_span) + ((y - start_y) * y_span)) /
axis_len_square;
int index = (int32_t)(scale * (SHADING_STEPS - 1));
@@ -253,7 +253,7 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap,
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.Transform(x, y);
+ matrix.TransformPoint(x, y);
FX_FLOAT b = -2 * (((x - start_x) * (end_x - start_x)) +
((y - start_y) * (end_y - start_y)) +
(start_r * (end_r - start_r)));
@@ -345,7 +345,7 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap,
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.Transform(x, y);
+ matrix.TransformPoint(x, y);
if (x < xmin || x > xmax || y < ymin || y > ymax) {
continue;
}
@@ -844,7 +844,7 @@ void DrawCoonPatchMeshes(
}
for (i = iStartPoint; i < point_count; i++) {
stream.GetCoords(coords[i].x, coords[i].y);
- pObject2Bitmap->Transform(coords[i].x, coords[i].y);
+ pObject2Bitmap->TransformPoint(coords[i].x, coords[i].y);
}
for (i = iStartColor; i < 4; i++) {
FX_FLOAT r = 0.0f, g = 0.0f, b = 0.0f;
@@ -2233,7 +2233,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
FX_FLOAT orig_x, orig_y;
orig_x = col * pPattern->x_step();
orig_y = row * pPattern->y_step();
- mtPattern2Device.Transform(orig_x, orig_y);
+ mtPattern2Device.TransformPoint(orig_x, orig_y);
CFX_Matrix matrix = *pObj2Device;
matrix.Translate(orig_x - mtPattern2Device.e,
orig_y - mtPattern2Device.f);
@@ -2308,7 +2308,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
} else {
FX_FLOAT orig_x = col * pPattern->x_step();
FX_FLOAT orig_y = row * pPattern->y_step();
- mtPattern2Device.Transform(orig_x, orig_y);
+ mtPattern2Device.TransformPoint(orig_x, orig_y);
pdfium::base::CheckedNumeric<int> safeStartX =
FXSYS_round(orig_x + left_offset);
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index e5e00168b9..55551dcfa0 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -245,7 +245,7 @@ std::vector<CFX_FloatRect> CPDF_TextPage::GetRectArray(int start,
CFX_Matrix matrix_reverse;
matrix_reverse.SetReverse(matrix);
- matrix_reverse.Transform(orgX, orgY);
+ matrix_reverse.TransformPoint(orgX, orgY);
rect.left = info_curchar.m_CharBox.left;
rect.right = info_curchar.m_CharBox.right;
if (pCurObj->GetFont()->GetTypeDescent()) {
@@ -253,7 +253,7 @@ std::vector<CFX_FloatRect> CPDF_TextPage::GetRectArray(int start,
pCurObj->GetFont()->GetTypeDescent() *
pCurObj->GetFontSize() / 1000;
FX_FLOAT xPosTemp = orgX;
- matrix.Transform(xPosTemp, rect.bottom);
+ matrix.TransformPoint(xPosTemp, rect.bottom);
} else {
rect.bottom = info_curchar.m_CharBox.bottom;
}
@@ -265,7 +265,7 @@ std::vector<CFX_FloatRect> CPDF_TextPage::GetRectArray(int start,
orgX +
GetCharWidth(info_curchar.m_CharCode, pCurObj->GetFont()) *
pCurObj->GetFontSize() / 1000;
- matrix.Transform(xPosTemp, rect.top);
+ matrix.TransformPoint(xPosTemp, rect.top);
} else {
rect.top = info_curchar.m_CharBox.top;
}
@@ -778,11 +778,11 @@ void CPDF_TextPage::ProcessTextObject(
prev_width > this_width ? prev_width / 4 : this_width / 4;
FX_FLOAT prev_x = prev_Obj.m_pTextObj->GetPosX(),
prev_y = prev_Obj.m_pTextObj->GetPosY();
- prev_Obj.m_formMatrix.Transform(prev_x, prev_y);
- m_DisplayMatrix.Transform(prev_x, prev_y);
+ prev_Obj.m_formMatrix.TransformPoint(prev_x, prev_y);
+ m_DisplayMatrix.TransformPoint(prev_x, prev_y);
FX_FLOAT this_x = pTextObj->GetPosX(), this_y = pTextObj->GetPosY();
- formMatrix.Transform(this_x, this_y);
- m_DisplayMatrix.Transform(this_x, this_y);
+ formMatrix.TransformPoint(this_x, this_y);
+ m_DisplayMatrix.TransformPoint(this_x, this_y);
if (FXSYS_fabs(this_y - prev_y) > threshold * 2) {
for (size_t i = 0; i < count; i++)
ProcessTextObject(m_LineObj[i]);
@@ -795,8 +795,8 @@ void CPDF_TextPage::ProcessTextObject(
PDFTEXT_Obj prev_text_obj = m_LineObj[i - 1];
FX_FLOAT Prev_x = prev_text_obj.m_pTextObj->GetPosX(),
Prev_y = prev_text_obj.m_pTextObj->GetPosY();
- prev_text_obj.m_formMatrix.Transform(Prev_x, Prev_y);
- m_DisplayMatrix.Transform(Prev_x, Prev_y);
+ prev_text_obj.m_formMatrix.TransformPoint(Prev_x, Prev_y);
+ m_DisplayMatrix.TransformPoint(Prev_x, Prev_y);
if (this_x >= Prev_x) {
m_LineObj.insert(m_LineObj.begin() + i, Obj);
break;
@@ -1117,8 +1117,10 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
m_TempTextBuf.AppendChar(TEXT_SPACE_CHAR);
charinfo.m_CharCode = CPDF_Font::kInvalidCharCode;
charinfo.m_Matrix = formMatrix;
- matrix.Transform(item.m_OriginX, item.m_OriginY, charinfo.m_OriginX,
- charinfo.m_OriginY);
+
+ charinfo.m_OriginX = item.m_OriginX;
+ charinfo.m_OriginY = item.m_OriginY;
+ matrix.TransformPoint(charinfo.m_OriginX, charinfo.m_OriginY);
charinfo.m_CharBox =
CFX_FloatRect(charinfo.m_OriginX, charinfo.m_OriginY,
charinfo.m_OriginX, charinfo.m_OriginY);
@@ -1140,10 +1142,12 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
charinfo.m_Flag = FPDFTEXT_CHAR_UNUNICODE;
else
charinfo.m_Flag = FPDFTEXT_CHAR_NORMAL;
+
charinfo.m_pTextObj = pTextObj;
- charinfo.m_OriginX = 0, charinfo.m_OriginY = 0;
- matrix.Transform(item.m_OriginX, item.m_OriginY, charinfo.m_OriginX,
- charinfo.m_OriginY);
+ charinfo.m_OriginX = item.m_OriginX;
+ charinfo.m_OriginY = item.m_OriginY;
+ matrix.TransformPoint(charinfo.m_OriginX, charinfo.m_OriginY);
+
FX_RECT rect =
charinfo.m_pTextObj->GetFont()->GetCharBBox(charinfo.m_CharCode);
charinfo.m_CharBox.top =
@@ -1338,8 +1342,8 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
prev_reverse.SetReverse(prev_matrix);
FX_FLOAT x = pObj->GetPosX();
FX_FLOAT y = pObj->GetPosY();
- formMatrix.Transform(x, y);
- prev_reverse.Transform(x, y);
+ formMatrix.TransformPoint(x, y);
+ prev_reverse.TransformPoint(x, y);
if (last_width < this_width)
threshold = prev_reverse.TransformDistance(threshold);
bool bNewline = false;
diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp
index 2664b52e7e..c76e6c9060 100644
--- a/core/fxcrt/fx_basic_coords.cpp
+++ b/core/fxcrt/fx_basic_coords.cpp
@@ -6,6 +6,8 @@
#include <limits.h>
+#include <algorithm>
+
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_ext.h"
@@ -457,33 +459,19 @@ void CFX_Matrix::TransformRect(FX_FLOAT& left,
FX_FLOAT& right,
FX_FLOAT& top,
FX_FLOAT& bottom) const {
- FX_FLOAT x[4], y[4];
- x[0] = left;
- y[0] = top;
- x[1] = left;
- y[1] = bottom;
- x[2] = right;
- y[2] = top;
- x[3] = right;
- y[3] = bottom;
- int i;
- for (i = 0; i < 4; i++) {
- Transform(x[i], y[i], x[i], y[i]);
- }
- right = left = x[0];
- top = bottom = y[0];
- for (i = 1; i < 4; i++) {
- if (right < x[i]) {
- right = x[i];
- }
- if (left > x[i]) {
- left = x[i];
- }
- if (top < y[i]) {
- top = y[i];
- }
- if (bottom > y[i]) {
- bottom = y[i];
- }
+ FX_FLOAT x[4] = {left, left, right, right};
+ FX_FLOAT y[4] = {top, bottom, top, bottom};
+ for (int i = 0; i < 4; i++)
+ TransformPoint(x[i], y[i]);
+
+ right = x[0];
+ left = x[0];
+ top = y[0];
+ bottom = y[0];
+ for (int i = 1; i < 4; i++) {
+ right = std::max(right, x[i]);
+ left = std::min(left, x[i]);
+ top = std::max(top, y[i]);
+ bottom = std::min(bottom, y[i]);
}
}
diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h
index 4551a4a5c8..a1638fdbb5 100644
--- a/core/fxcrt/fx_coordinates.h
+++ b/core/fxcrt/fx_coordinates.h
@@ -675,12 +675,6 @@ class CFX_Matrix {
void TransformPoint(FX_FLOAT& x, FX_FLOAT& y) const;
void TransformPoint(int32_t& x, int32_t& y) const;
- void Transform(FX_FLOAT& x, FX_FLOAT& y) const { TransformPoint(x, y); }
- void Transform(FX_FLOAT x, FX_FLOAT y, FX_FLOAT& x1, FX_FLOAT& y1) const {
- x1 = x, y1 = y;
- TransformPoint(x1, y1);
- }
-
void TransformVector(CFX_VectorF& v) const;
void TransformVector(CFX_Vector& v) const;
void TransformRect(CFX_RectF& rect) const;
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 71d6dbaf86..3ae2c37150 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -278,7 +278,7 @@ void CAgg_PathData::BuildPath(const CFX_PathData* pPathData,
for (int i = 0; i < nPoints; i++) {
FX_FLOAT x = pPoints[i].m_PointX, y = pPoints[i].m_PointY;
if (pObject2Device) {
- pObject2Device->Transform(x, y);
+ pObject2Device->TransformPoint(x, y);
}
HardClip(x, y);
FXPT_TYPE point_type = pPoints[i].m_Type;
@@ -298,9 +298,9 @@ void CAgg_PathData::BuildPath(const CFX_PathData* pPathData,
FX_FLOAT x2 = pPoints[i + 1].m_PointX, y2 = pPoints[i + 1].m_PointY;
FX_FLOAT x3 = pPoints[i + 2].m_PointX, y3 = pPoints[i + 2].m_PointY;
if (pObject2Device) {
- pObject2Device->Transform(x0, y0);
- pObject2Device->Transform(x2, y2);
- pObject2Device->Transform(x3, y3);
+ pObject2Device->TransformPoint(x0, y0);
+ pObject2Device->TransformPoint(x2, y2);
+ pObject2Device->TransformPoint(x3, y3);
}
HardClip(x0, y0);
HardClip(x2, y2);
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index 6d7fb2e06a..d6867384e6 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -41,7 +41,7 @@ bool CGDrawGlyphRun(CGContextRef pContext,
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);
+ new_matrix.TransformPoint(ori_x, ori_y);
if (pObject2Device)
new_matrix.Concat(*pObject2Device);
diff --git a/core/fxge/ge/cfx_pathdata.cpp b/core/fxge/ge/cfx_pathdata.cpp
index d1391850c0..14eabb990a 100644
--- a/core/fxge/ge/cfx_pathdata.cpp
+++ b/core/fxge/ge/cfx_pathdata.cpp
@@ -65,8 +65,8 @@ void CFX_PathData::Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix) {
pSrc->m_PointCount * sizeof(FX_PATHPOINT));
if (pMatrix) {
for (int i = 0; i < pSrc->m_PointCount; i++) {
- pMatrix->Transform(m_pPoints[old_count + i].m_PointX,
- m_pPoints[old_count + i].m_PointY);
+ pMatrix->TransformPoint(m_pPoints[old_count + i].m_PointX,
+ m_pPoints[old_count + i].m_PointY);
}
}
}
@@ -316,7 +316,7 @@ void CFX_PathData::Transform(const CFX_Matrix* pMatrix) {
return;
}
for (int i = 0; i < m_PointCount; i++) {
- pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY);
+ pMatrix->TransformPoint(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY);
}
}
@@ -497,9 +497,9 @@ bool CFX_PathData::IsRect() const {
bool CFX_PathData::IsRect(const CFX_Matrix* pMatrix,
CFX_FloatRect* pRect) const {
if (!pMatrix) {
- if (!IsRect()) {
+ if (!IsRect())
return false;
- }
+
if (pRect) {
pRect->left = m_pPoints[0].m_PointX;
pRect->right = m_pPoints[2].m_PointX;
@@ -509,9 +509,10 @@ bool CFX_PathData::IsRect(const CFX_Matrix* pMatrix,
}
return true;
}
- if (m_PointCount != 5 && m_PointCount != 4) {
+
+ if (m_PointCount != 5 && m_PointCount != 4)
return false;
- }
+
if ((m_PointCount == 5 && (m_pPoints[0].m_PointX != m_pPoints[4].m_PointX ||
m_pPoints[0].m_PointY != m_pPoints[4].m_PointY)) ||
(m_pPoints[1].m_PointX == m_pPoints[3].m_PointX &&
@@ -522,19 +523,21 @@ bool CFX_PathData::IsRect(const CFX_Matrix* pMatrix,
m_pPoints[0].m_PointY != m_pPoints[3].m_PointY) {
return false;
}
- FX_FLOAT x[5], y[5];
+
+ FX_FLOAT x[5];
+ FX_FLOAT y[5];
for (int i = 0; i < m_PointCount; i++) {
- pMatrix->Transform(m_pPoints[i].m_PointX, m_pPoints[i].m_PointY, x[i],
- y[i]);
+ x[i] = m_pPoints[i].m_PointX;
+ y[i] = m_pPoints[i].m_PointY;
+ pMatrix->TransformPoint(x[i], y[i]);
if (i) {
- if (m_pPoints[i].m_Type != FXPT_TYPE::LineTo) {
+ if (m_pPoints[i].m_Type != FXPT_TYPE::LineTo)
return false;
- }
- if (x[i] != x[i - 1] && y[i] != y[i - 1]) {
+ if (x[i] != x[i - 1] && y[i] != y[i - 1])
return false;
- }
}
}
+
if (pRect) {
pRect->left = x[0];
pRect->right = x[2];
diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp
index 52ed8c37c0..0c73c7a66a 100644
--- a/core/fxge/ge/cfx_renderdevice.cpp
+++ b/core/fxge/ge/cfx_renderdevice.cpp
@@ -475,21 +475,18 @@ bool CFX_RenderDevice::DrawPathWithBlend(const CFX_PathData* pPathData,
uint8_t fill_alpha = (fill_mode & 3) ? FXARGB_A(fill_color) : 0;
if (stroke_alpha == 0 && pPathData->GetPointCount() == 2) {
FX_PATHPOINT* pPoints = pPathData->GetPoints();
- FX_FLOAT x1, x2, y1, y2;
+ FX_FLOAT x1 = pPoints[0].m_PointX;
+ FX_FLOAT y1 = pPoints[0].m_PointY;
+ FX_FLOAT x2 = pPoints[1].m_PointX;
+ FX_FLOAT y2 = pPoints[1].m_PointY;
if (pObject2Device) {
- pObject2Device->Transform(pPoints[0].m_PointX, pPoints[0].m_PointY, x1,
- y1);
- pObject2Device->Transform(pPoints[1].m_PointX, pPoints[1].m_PointY, x2,
- y2);
- } else {
- x1 = pPoints[0].m_PointX;
- y1 = pPoints[0].m_PointY;
- x2 = pPoints[1].m_PointX;
- y2 = pPoints[1].m_PointY;
+ pObject2Device->TransformPoint(x1, y1);
+ pObject2Device->TransformPoint(x2, y2);
}
DrawCosmeticLine(x1, y1, x2, y2, fill_color, fill_mode, blend_type);
return true;
}
+
if ((pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) &&
stroke_alpha == 0) {
CFX_FloatRect rect_f;
@@ -913,7 +910,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars,
const FXTEXT_CHARPOS& charpos = pCharPos[i];
glyph.m_fOriginX = charpos.m_OriginX;
glyph.m_fOriginY = charpos.m_OriginY;
- text2Device.Transform(glyph.m_fOriginX, glyph.m_fOriginY);
+ text2Device.TransformPoint(glyph.m_fOriginX, glyph.m_fOriginY);
if (anti_alias < FXFT_RENDER_MODE_LCD)
glyph.m_OriginX = FXSYS_round(glyph.m_fOriginX);
else
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index 2e4519c46f..7fc47b9a46 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -117,9 +117,9 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData,
bool closing = pPathData->IsClosingFigure(i);
FX_FLOAT x = pPathData->GetPointX(i);
FX_FLOAT y = pPathData->GetPointY(i);
- if (pObject2Device) {
- pObject2Device->Transform(x, y);
- }
+ if (pObject2Device)
+ pObject2Device->TransformPoint(x, y);
+
buf << x << " " << y;
switch (type) {
case FXPT_TYPE::MoveTo:
@@ -136,8 +136,8 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData,
FX_FLOAT y1 = pPathData->GetPointY(i + 1);
FX_FLOAT y2 = pPathData->GetPointY(i + 2);
if (pObject2Device) {
- pObject2Device->Transform(x1, y1);
- pObject2Device->Transform(x2, y2);
+ pObject2Device->TransformPoint(x1, y1);
+ pObject2Device->TransformPoint(x2, y2);
}
buf << " " << x1 << " " << y1 << " " << x2 << " " << y2 << " c";
if (closing)
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index c8ceacfc4c..3df38f1965 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -170,9 +170,9 @@ void SetPathToDC(HDC hDC,
FX_PATHPOINT* pPoints = pPathData->GetPoints();
for (int i = 0; i < nPoints; i++) {
FX_FLOAT posx = pPoints[i].m_PointX, posy = pPoints[i].m_PointY;
- if (pMatrix) {
- pMatrix->Transform(posx, posy);
- }
+ if (pMatrix)
+ pMatrix->TransformPoint(posx, posy);
+
int screen_x = FXSYS_round(posx), screen_y = FXSYS_round(posy);
FXPT_TYPE point_type = pPoints[i].m_Type;
if (point_type == FXPT_TYPE::MoveTo) {
@@ -189,16 +189,16 @@ void SetPathToDC(HDC hDC,
lppt[0].y = screen_y;
posx = pPoints[i + 1].m_PointX;
posy = pPoints[i + 1].m_PointY;
- if (pMatrix) {
- pMatrix->Transform(posx, posy);
- }
+ if (pMatrix)
+ pMatrix->TransformPoint(posx, posy);
+
lppt[1].x = FXSYS_round(posx);
lppt[1].y = FXSYS_round(posy);
posx = pPoints[i + 2].m_PointX;
posy = pPoints[i + 2].m_PointY;
- if (pMatrix) {
- pMatrix->Transform(posx, posy);
- }
+ if (pMatrix)
+ pMatrix->TransformPoint(posx, posy);
+
lppt[2].x = FXSYS_round(posx);
lppt[2].y = FXSYS_round(posy);
PolyBezierTo(hDC, lppt, 3);
@@ -1056,8 +1056,8 @@ bool CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
FX_FLOAT x2 = pPathData->GetPointX(1);
FX_FLOAT y2 = pPathData->GetPointY(1);
if (pMatrix) {
- pMatrix->Transform(x1, y1);
- pMatrix->Transform(x2, y2);
+ pMatrix->TransformPoint(x1, y1);
+ pMatrix->TransformPoint(x2, y2);
}
DrawLine(x1, y1, x2, y2);
} else {
diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp
index 65f7b3e732..c703e3e300 100644
--- a/core/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/fxge/win32/fx_win32_gdipext.cpp
@@ -1083,8 +1083,8 @@ static bool IsSmallTriangle(PointF* points,
FX_FLOAT x1 = points[pair1].X, x2 = points[pair2].X;
FX_FLOAT y1 = points[pair1].Y, y2 = points[pair2].Y;
if (pMatrix) {
- pMatrix->Transform(x1, y1);
- pMatrix->Transform(x2, y2);
+ pMatrix->TransformPoint(x1, y1);
+ pMatrix->TransformPoint(x2, y2);
}
FX_FLOAT dx = x1 - x2;
FX_FLOAT dy = y1 - y2;
@@ -1132,25 +1132,20 @@ bool CGdiplusExt::DrawPath(HDC hDC,
for (int i = 0; i < nPoints; i++) {
points[i].X = pPoints[i].m_PointX;
points[i].Y = pPoints[i].m_PointY;
- FX_FLOAT x, y;
- if (pObject2Device) {
- pObject2Device->Transform(pPoints[i].m_PointX, pPoints[i].m_PointY, x, y);
- } else {
- x = pPoints[i].m_PointX;
- y = pPoints[i].m_PointY;
- }
- if (x > 50000 * 1.0f) {
+ FX_FLOAT x = pPoints[i].m_PointX;
+ FX_FLOAT y = pPoints[i].m_PointY;
+ if (pObject2Device)
+ pObject2Device->TransformPoint(x, y);
+
+ if (x > 50000 * 1.0f)
points[i].X = 50000 * 1.0f;
- }
- if (x < -50000 * 1.0f) {
+ if (x < -50000 * 1.0f)
points[i].X = -50000 * 1.0f;
- }
- if (y > 50000 * 1.0f) {
+ if (y > 50000 * 1.0f)
points[i].Y = 50000 * 1.0f;
- }
- if (y < -50000 * 1.0f) {
+ if (y < -50000 * 1.0f)
points[i].Y = -50000 * 1.0f;
- }
+
FXPT_TYPE point_type = pPoints[i].m_Type;
if (point_type == FXPT_TYPE::MoveTo) {
types[i] = PathPointTypeStart;
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index f38be4c3e8..b897a3e0bb 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -46,14 +46,13 @@ void CFX_SystemHandler::InvalidateRect(CPDFSDK_Widget* widget, FX_RECT rect) {
CFX_Matrix device2page;
device2page.SetReverse(page2device);
- FX_FLOAT left;
- FX_FLOAT top;
- FX_FLOAT right;
- FX_FLOAT bottom;
- device2page.Transform(static_cast<FX_FLOAT>(rect.left),
- static_cast<FX_FLOAT>(rect.top), left, top);
- device2page.Transform(static_cast<FX_FLOAT>(rect.right),
- static_cast<FX_FLOAT>(rect.bottom), right, bottom);
+ FX_FLOAT left = static_cast<FX_FLOAT>(rect.left);
+ FX_FLOAT top = static_cast<FX_FLOAT>(rect.top);
+ FX_FLOAT right = static_cast<FX_FLOAT>(rect.right);
+ FX_FLOAT bottom = static_cast<FX_FLOAT>(rect.bottom);
+ device2page.TransformPoint(left, top);
+ device2page.TransformPoint(right, bottom);
+
CFX_FloatRect rcPDF(left, bottom, right, top);
rcPDF.Normalize();
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 108690665c..1af4703da0 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -841,24 +841,18 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice,
if (!m_pInterForm->IsNeedHighLight(nFieldType))
return;
- CFX_FloatRect rc = GetRect();
- FX_COLORREF color = m_pInterForm->GetHighlightColor(nFieldType);
- uint8_t alpha = m_pInterForm->GetHighlightAlpha();
-
- CFX_FloatRect rcDevice;
CFX_Matrix page2device;
pPageView->GetCurrentMatrix(page2device);
- page2device.Transform(((FX_FLOAT)rc.left), ((FX_FLOAT)rc.bottom),
- rcDevice.left, rcDevice.bottom);
- page2device.Transform(((FX_FLOAT)rc.right), ((FX_FLOAT)rc.top),
- rcDevice.right, rcDevice.top);
+ CFX_FloatRect rcDevice = GetRect();
+ page2device.TransformPoint(rcDevice.left, rcDevice.bottom);
+ page2device.TransformPoint(rcDevice.right, rcDevice.top);
rcDevice.Normalize();
- FX_ARGB argb = ArgbEncode((int)alpha, color);
- FX_RECT rcDev((int)rcDevice.left, (int)rcDevice.top, (int)rcDevice.right,
- (int)rcDevice.bottom);
- pDevice->FillRect(&rcDev, argb);
+ FX_RECT rcDev = rcDevice.ToFxRect();
+ pDevice->FillRect(
+ &rcDev, ArgbEncode(static_cast<int>(m_pInterForm->GetHighlightAlpha()),
+ m_pInterForm->GetHighlightColor(nFieldType)));
}
void CPDFSDK_Widget::ResetAppearance_PushButton() {
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 71feb54bef..9ccca2b04a 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -488,8 +488,7 @@ CFX_FloatPoint CFFL_FormFiller::FFLtoPWL(const CFX_FloatPoint& point) {
mt.SetReverse(GetCurMatrix());
CFX_FloatPoint pt = point;
- mt.Transform(pt.x, pt.y);
-
+ mt.TransformPoint(pt.x, pt.y);
return pt;
}
@@ -497,8 +496,7 @@ CFX_FloatPoint CFFL_FormFiller::PWLtoFFL(const CFX_FloatPoint& point) {
CFX_Matrix mt = GetCurMatrix();
CFX_FloatPoint pt = point;
- mt.Transform(pt.x, pt.y);
-
+ mt.TransformPoint(pt.x, pt.y);
return pt;
}
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 2c2f25ab0b..57d5d4d343 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -855,10 +855,10 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page,
CFX_Matrix device2page;
device2page.SetReverse(page2device);
- FX_FLOAT page_x_f;
- FX_FLOAT page_y_f;
- device2page.Transform(static_cast<FX_FLOAT>(device_x),
- static_cast<FX_FLOAT>(device_y), page_x_f, page_y_f);
+ FX_FLOAT page_x_f = static_cast<FX_FLOAT>(device_x);
+ FX_FLOAT page_y_f = static_cast<FX_FLOAT>(device_y);
+ device2page.TransformPoint(page_x_f, page_y_f);
+
*page_x = page_x_f;
*page_y = page_y_f;
#endif // PDF_ENABLE_XFA
@@ -885,10 +885,10 @@ 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;
- FX_FLOAT device_y_f;
- page2device.Transform(static_cast<FX_FLOAT>(page_x),
- static_cast<FX_FLOAT>(page_y), device_x_f, device_y_f);
+ FX_FLOAT device_x_f = static_cast<FX_FLOAT>(page_x);
+ FX_FLOAT device_y_f = static_cast<FX_FLOAT>(page_y);
+ page2device.TransformPoint(device_x_f, device_y_f);
+
*device_x = FXSYS_round(device_x_f);
*device_y = FXSYS_round(device_y_f);
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index f39a01078e..b708a361e5 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -154,13 +154,13 @@ void CPDFXFA_Page::DeviceToPage(int start_x,
if (!m_pPDFPage && !m_pXFAPageView)
return;
- FX_FLOAT page_x_f, page_y_f;
-
CFX_Matrix device2page;
device2page.SetReverse(
GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate));
- device2page.Transform(static_cast<FX_FLOAT>(device_x),
- static_cast<FX_FLOAT>(device_y), page_x_f, page_y_f);
+
+ FX_FLOAT page_x_f = static_cast<FX_FLOAT>(device_x);
+ FX_FLOAT page_y_f = static_cast<FX_FLOAT>(device_y);
+ device2page.TransformPoint(page_x_f, page_y_f);
*page_x = page_x_f;
*page_y = page_y_f;
@@ -178,13 +178,12 @@ void CPDFXFA_Page::PageToDevice(int start_x,
if (!m_pPDFPage && !m_pXFAPageView)
return;
- FX_FLOAT device_x_f;
- FX_FLOAT device_y_f;
-
CFX_Matrix page2device =
GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
- page2device.Transform(static_cast<FX_FLOAT>(page_x),
- static_cast<FX_FLOAT>(page_y), device_x_f, device_y_f);
+
+ FX_FLOAT device_x_f = static_cast<FX_FLOAT>(page_x);
+ FX_FLOAT device_y_f = static_cast<FX_FLOAT>(page_y);
+ page2device.TransformPoint(device_x_f, device_y_f);
*device_x = FXSYS_round(device_x_f);
*device_y = FXSYS_round(device_y_f);
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index 690f042afb..1942232553 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -66,7 +66,7 @@ void DrawTextString(CFX_RenderDevice* pDevice,
FX_ARGB crTextStroke,
int32_t nHorzScale) {
FX_FLOAT x = pt.x, y = pt.y;
- pUser2Device->Transform(x, y);
+ pUser2Device->TransformPoint(x, y);
if (pFont) {
if (nHorzScale != 100) {
@@ -80,8 +80,8 @@ void DrawTextString(CFX_RenderDevice* pDevice,
if (crTextStroke != 0) {
CFX_FloatPoint pt1;
CFX_FloatPoint pt2;
- pUser2Device->Transform(pt1.x, pt1.y);
- pUser2Device->Transform(pt2.x, pt2.y);
+ 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));
@@ -101,8 +101,8 @@ void DrawTextString(CFX_RenderDevice* pDevice,
if (crTextStroke != 0) {
CFX_FloatPoint pt1;
CFX_FloatPoint pt2;
- pUser2Device->Transform(pt1.x, pt1.y);
- pUser2Device->Transform(pt2.x, pt2.y);
+ 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));
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index 94592159d4..90b7a3c7c0 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -43,8 +43,8 @@ bool CPWL_EditCtrl::IsWndHorV() {
CFX_FloatPoint point1(0, 1);
CFX_FloatPoint point2(1, 1);
- mt.Transform(point1.x, point1.y);
- mt.Transform(point2.x, point2.y);
+ mt.TransformPoint(point1.x, point1.y);
+ mt.TransformPoint(point2.x, point2.y);
return point2.y == point1.y;
}
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
index 8fd7b16212..1170660f1c 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
@@ -855,7 +855,7 @@ void CPWL_Wnd::PWLtoWnd(const CFX_FloatPoint& point,
int32_t& y) const {
CFX_Matrix mt = GetWindowMatrix();
CFX_FloatPoint pt = point;
- mt.Transform(pt.x, pt.y);
+ mt.TransformPoint(pt.x, pt.y);
x = (int32_t)(pt.x + 0.5);
y = (int32_t)(pt.y + 0.5);
}
@@ -874,7 +874,7 @@ CFX_FloatPoint CPWL_Wnd::ChildToParent(const CFX_FloatPoint& point) const {
return point;
CFX_FloatPoint pt = point;
- mt.Transform(pt.x, pt.y);
+ mt.TransformPoint(pt.x, pt.y);
return pt;
}
@@ -895,7 +895,7 @@ CFX_FloatPoint CPWL_Wnd::ParentToChild(const CFX_FloatPoint& point) const {
mt.SetReverse(mt);
CFX_FloatPoint pt = point;
- mt.Transform(pt.x, pt.y);
+ mt.TransformPoint(pt.x, pt.y);
return pt;
}
diff --git a/third_party/agg23/agg_rasterizer_scanline_aa.h b/third_party/agg23/agg_rasterizer_scanline_aa.h
index 77e04edee9..3cf1822301 100644
--- a/third_party/agg23/agg_rasterizer_scanline_aa.h
+++ b/third_party/agg23/agg_rasterizer_scanline_aa.h
@@ -390,10 +390,9 @@ public:
unsigned cmd;
vs.rewind(path_id);
while(!is_stop(cmd = vs.vertex(&x, &y))) {
- if (pMatrix) {
- pMatrix->Transform(x, y);
- }
- add_vertex(x, y, cmd);
+ if (pMatrix)
+ pMatrix->TransformPoint(x, y);
+ add_vertex(x, y, cmd);
}
}
private: