From f8b15f46e69fdec04a03afeb6f2bf60f90dff433 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Fri, 17 Mar 2017 15:23:16 -0400 Subject: HardClip points a bit better in fx_agg_driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In agg, the length is of type coord_type, which we have as int16. So having points bigger than the max short will not work properly. BUG=chromium:699982 Change-Id: I0e4cab6ae2b6aa023359aec4b5b3d611f8a8eb4f Reviewed-on: https://pdfium-review.googlesource.com/3101 Reviewed-by: Lei Zhang Commit-Queue: Nicolás Peña --- core/fxge/agg/fx_agg_driver.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 5ab48a95fe..4534ee1425 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -27,9 +27,11 @@ namespace { +const float kMaxPos = 32000.0f; + CFX_PointF HardClip(const CFX_PointF& pos) { - return CFX_PointF(std::max(std::min(pos.x, 50000.0f), -50000.0f), - std::max(std::min(pos.y, 50000.0f), -50000.0f)); + return CFX_PointF(std::max(std::min(pos.x, kMaxPos), -kMaxPos), + std::max(std::min(pos.y, kMaxPos), -kMaxPos)); } void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, uint32_t argb) { -- cgit v1.2.3