summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp54
-rw-r--r--core/fpdfapi/render/cpdf_textrenderer.cpp10
-rw-r--r--core/fpdfapi/render/cpdf_textrenderer.h1
-rw-r--r--core/fpdftext/cpdf_textpage.cpp6
-rw-r--r--core/fxcrt/fx_basic_coords.cpp12
-rw-r--r--core/fxcrt/fx_coordinates.h1
-rw-r--r--core/fxge/win32/fx_win32_gdipext.cpp15
7 files changed, 42 insertions, 57 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<FX_FLOAT>(column), static_cast<FX_FLOAT>(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<FX_FLOAT>(column), static_cast<FX_FLOAT>(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<FX_FLOAT>(column), static_cast<FX_FLOAT>(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<int> safeStartX =
- FXSYS_round(orig_x + left_offset);
+ FXSYS_round(original.x + left_offset);
pdfium::base::CheckedNumeric<int> 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<CFX_FloatRect> 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<CFX_FloatRect> 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;