aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-01-17 11:55:07 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-17 19:31:16 +0000
commitfe266c2bce2b8ac4ef953f16c8e1a7801da9c57d (patch)
tree7c476e2a6ad621f5766b0720f3b33930fac7b768 /src/gpu
parente201ebc995151adbe0e15cd88d7277d41c40ddbf (diff)
use safemath::mull for buffer sizes
Bug:780104 Change-Id: Ic683abd9c7d15ebb01b6e5d40dbeb6e76f102eff Reviewed-on: https://skia-review.googlesource.com/95760 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrBufferAllocPool.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp
index fc5fb66478..5b0d8cc6d7 100644
--- a/src/gpu/GrBufferAllocPool.cpp
+++ b/src/gpu/GrBufferAllocPool.cpp
@@ -14,7 +14,7 @@
#include "GrGpu.h"
#include "GrResourceProvider.h"
#include "GrTypes.h"
-
+#include "SkSafeMath.h"
#include "SkTraceEvent.h"
#ifdef SK_DEBUG
@@ -392,7 +392,7 @@ void* GrVertexBufferAllocPool::makeSpace(size_t vertexSize,
SkASSERT(startVertex);
size_t offset SK_INIT_TO_AVOID_WARNING;
- void* ptr = INHERITED::makeSpace(vertexSize * vertexCount,
+ void* ptr = INHERITED::makeSpace(SkSafeMath::Mul(vertexSize, vertexCount),
vertexSize,
buffer,
&offset);
@@ -414,8 +414,8 @@ void* GrVertexBufferAllocPool::makeSpaceAtLeast(size_t vertexSize, int minVertex
size_t offset SK_INIT_TO_AVOID_WARNING;
size_t actualSize SK_INIT_TO_AVOID_WARNING;
- void* ptr = INHERITED::makeSpaceAtLeast(vertexSize * minVertexCount,
- vertexSize * fallbackVertexCount,
+ void* ptr = INHERITED::makeSpaceAtLeast(SkSafeMath::Mul(vertexSize, minVertexCount),
+ SkSafeMath::Mul(vertexSize, fallbackVertexCount),
vertexSize,
buffer,
&offset,
@@ -446,7 +446,7 @@ void* GrIndexBufferAllocPool::makeSpace(int indexCount,
SkASSERT(startIndex);
size_t offset SK_INIT_TO_AVOID_WARNING;
- void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t),
+ void* ptr = INHERITED::makeSpace(SkSafeMath::Mul(indexCount, sizeof(uint16_t)),
sizeof(uint16_t),
buffer,
&offset);
@@ -467,8 +467,8 @@ void* GrIndexBufferAllocPool::makeSpaceAtLeast(int minIndexCount, int fallbackIn
size_t offset SK_INIT_TO_AVOID_WARNING;
size_t actualSize SK_INIT_TO_AVOID_WARNING;
- void* ptr = INHERITED::makeSpaceAtLeast(minIndexCount * sizeof(uint16_t),
- fallbackIndexCount * sizeof(uint16_t),
+ void* ptr = INHERITED::makeSpaceAtLeast(SkSafeMath::Mul(minIndexCount, sizeof(uint16_t)),
+ SkSafeMath::Mul(fallbackIndexCount, sizeof(uint16_t)),
sizeof(uint16_t),
buffer,
&offset,