Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp

Issue 1726893002: Remove FXSYS_MulDiv(a, b, c). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 43ce995f0537365203b377a448ce871836f15aa5..4ad6f81d5ed410b9c0fdfe141319f22513b0ece1 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -319,7 +319,7 @@ FX_BOOL _GetScanlineIntersect(int y,
return FALSE;
}
}
- x = x1 + FXSYS_MulDiv(x2 - x1, y - y1, y2 - y1);
+ x = x1 + ((x2 - x1) * (y - y1) / (y2 - y1));
return TRUE;
}
static void DrawGouraud(CFX_DIBitmap* pBitmap,
@@ -355,15 +355,11 @@ static void DrawGouraud(CFX_DIBitmap* pBitmap,
if (!bIntersect) {
continue;
}
- r[nIntersects] =
- vertex1.r + FXSYS_MulDiv(vertex2.r - vertex1.r, y - vertex1.y,
- vertex2.y - vertex1.y);
- g[nIntersects] =
- vertex1.g + FXSYS_MulDiv(vertex2.g - vertex1.g, y - vertex1.y,
- vertex2.y - vertex1.y);
- b[nIntersects] =
- vertex1.b + FXSYS_MulDiv(vertex2.b - vertex1.b, y - vertex1.y,
- vertex2.y - vertex1.y);
+
+ FX_FLOAT y_dist = (y - vertex1.y) / (vertex2.y - vertex1.y);
+ r[nIntersects] = vertex1.r + ((vertex2.r - vertex1.r) * y_dist);
+ g[nIntersects] = vertex1.g + ((vertex2.g - vertex1.g) * y_dist);
+ b[nIntersects] = vertex1.b + ((vertex2.b - vertex1.b) * y_dist);
nIntersects++;
}
if (nIntersects != 2) {

Powered by Google App Engine
This is Rietveld 408576698