diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-12-11 16:26:00 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-12-11 16:26:00 -0800 |
commit | f75bdb181576e4a4cf8291706a0db86c687e5fc3 (patch) | |
tree | 4440158d95c723b1ef02753b4dfa9d1a598e1a87 /xfa/src/fxgraphics | |
parent | 74aa4e19a332436ff3bcf539c905e992b1d3ac4e (diff) | |
download | pdfium-f75bdb181576e4a4cf8291706a0db86c687e5fc3.tar.xz |
XFA: avoid multiplications in FX_Allocs
In some cases, we can use the safe FX_Alloc2D, in others
there's an extra multiplication by the size of the type.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1519233002 .
Diffstat (limited to 'xfa/src/fxgraphics')
-rw-r--r-- | xfa/src/fxgraphics/src/fx_graphics.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/xfa/src/fxgraphics/src/fx_graphics.cpp b/xfa/src/fxgraphics/src/fx_graphics.cpp index 53d001e9d7..d983b5d6f8 100644 --- a/xfa/src/fxgraphics/src/fx_graphics.cpp +++ b/xfa/src/fxgraphics/src/fx_graphics.cpp @@ -534,8 +534,7 @@ FX_ERR CFX_Graphics::CalcTextRect(CFX_RectF& rect, _FX_RETURN_VALUE_IF_FAIL(_renderDevice, FX_ERR_Property_Invalid);
int32_t length = text.GetLength();
FX_DWORD* charCodes = FX_Alloc(FX_DWORD, length);
- FXTEXT_CHARPOS* charPos =
- FX_Alloc(FXTEXT_CHARPOS, length * sizeof(FXTEXT_CHARPOS));
+ FXTEXT_CHARPOS* charPos = FX_Alloc(FXTEXT_CHARPOS, length);
CalcTextInfo(text, charCodes, charPos, rect);
FX_Free(charPos);
FX_Free(charCodes);
@@ -867,8 +866,7 @@ FX_ERR CFX_Graphics::RenderDeviceShowText(const CFX_PointF& point, CFX_Matrix* matrix) {
int32_t length = text.GetLength();
FX_DWORD* charCodes = FX_Alloc(FX_DWORD, length);
- FXTEXT_CHARPOS* charPos =
- FX_Alloc(FXTEXT_CHARPOS, length * sizeof(FXTEXT_CHARPOS));
+ FXTEXT_CHARPOS* charPos = FX_Alloc(FXTEXT_CHARPOS, length);
CFX_RectF rect;
rect.Set(point.x, point.y, 0, 0);
CalcTextInfo(text, charCodes, charPos, rect);
|