diff options
author | Brian Osman <brianosman@google.com> | 2017-09-28 11:53:03 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-28 16:26:27 +0000 |
commit | 1a0ea73bb264b7f7441331a15bb99b14b517c0c8 (patch) | |
tree | d462eaaf48778065155fb18ffab0256eb92e70ce /src | |
parent | e85ab6924da6dd8c5751369f067e55b777a3c6a2 (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')
-rw-r--r-- | src/gpu/GrSoftwarePathRenderer.cpp | 5 |
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) { |