summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-03-17 15:23:16 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-17 21:22:50 +0000
commitf8b15f46e69fdec04a03afeb6f2bf60f90dff433 (patch)
tree52243ca49e9459a268edc720ba8b7c046c6a4db5 /core/fxge
parent7630907c7ecbb700e4de287550dbed06f36fbe9e (diff)
downloadpdfium-f8b15f46e69fdec04a03afeb6f2bf60f90dff433.tar.xz
HardClip points a bit better in fx_agg_driver
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 <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp6
1 files 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) {