aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrSoftwarePathRenderer.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-09-28 11:53:03 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-28 16:26:27 +0000
commit1a0ea73bb264b7f7441331a15bb99b14b517c0c8 (patch)
treed462eaaf48778065155fb18ffab0256eb92e70ce /src/gpu/GrSoftwarePathRenderer.cpp
parente85ab6924da6dd8c5751369f067e55b777a3c6a2 (diff)
Use wider types to compute bounds area and avoid overflow
Bug: skia: Change-Id: I3ea8c8acf56d103a8f38e652b418239e0f517839 Reviewed-on: https://skia-review.googlesource.com/52720 Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrSoftwarePathRenderer.cpp')
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 9f876f1213..dd0e272dbb 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -256,8 +256,9 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
// Use the cache only if >50% of the path is visible.
int unclippedWidth = unclippedDevShapeBounds.width();
int unclippedHeight = unclippedDevShapeBounds.height();
- int unclippedArea = unclippedWidth * unclippedHeight;
- int clippedArea = clippedDevShapeBounds.width() * clippedDevShapeBounds.height();
+ int64_t unclippedArea = sk_64_mul(unclippedWidth, unclippedHeight);
+ int64_t clippedArea = sk_64_mul(clippedDevShapeBounds.width(),
+ clippedDevShapeBounds.height());
int maxTextureSize = args.fRenderTargetContext->caps()->maxTextureSize();
if (unclippedArea > 2 * clippedArea || unclippedWidth > maxTextureSize ||
unclippedHeight > maxTextureSize) {