Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp

Issue 2339323003: Remove platform/CheckedInt.h, we can use wtf/CheckedNumeric.h instead. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/CheckedInt.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
index 6b1a09250df6e655b7dc752ef88b7fd5da03af67..8a05ea3ff90fcb443fc5731ca2ba45f8a20c4de3 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
@@ -4,7 +4,6 @@
#include "platform/graphics/gpu/WebGLImageConversion.h"
-#include "platform/CheckedInt.h"
#include "platform/graphics/ImageObserver.h"
#include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h"
#include "platform/graphics/cpu/mips/WebGLImageConversionMSA.h"
@@ -12,6 +11,7 @@
#include "platform/graphics/skia/SkiaUtils.h"
#include "platform/image-decoders/ImageDecoder.h"
#include "third_party/skia/include/core/SkImage.h"
+#include "wtf/CheckedNumeric.h"
#include "wtf/PtrUtil.h"
#include <memory>
@@ -2062,77 +2062,77 @@ GLenum WebGLImageConversion::computeImageSizeInBytes(GLenum format, GLenum type,
if (!computeFormatAndTypeParameters(format, type, &bytesPerComponent, &componentsPerPixel))
return GL_INVALID_ENUM;
unsigned bytesPerGroup = bytesPerComponent * componentsPerPixel;
- CheckedInt<uint32_t> checkedValue = static_cast<uint32_t>(rowLength);
+ CheckedNumeric<uint32_t> checkedValue = static_cast<uint32_t>(rowLength);
checkedValue *= bytesPerGroup;
- if (!checkedValue.isValid())
+ if (!checkedValue.IsValid())
return GL_INVALID_VALUE;
unsigned lastRowSize;
if (params.rowLength > 0 && params.rowLength != width) {
- CheckedInt<uint32_t> tmp = width;
+ CheckedNumeric<uint32_t> tmp = width;
tmp *= bytesPerGroup;
- if (!tmp.isValid())
+ if (!tmp.IsValid())
return GL_INVALID_VALUE;
- lastRowSize = tmp.value();
+ lastRowSize = tmp.ValueOrDie();
} else {
- lastRowSize = checkedValue.value();
+ lastRowSize = checkedValue.ValueOrDie();
}
unsigned padding = 0;
- unsigned residual = checkedValue.value() % params.alignment;
+ unsigned residual = checkedValue.ValueOrDie() % params.alignment;
if (residual) {
padding = params.alignment - residual;
checkedValue += padding;
}
- if (!checkedValue.isValid())
+ if (!checkedValue.IsValid())
return GL_INVALID_VALUE;
- unsigned paddedRowSize = checkedValue.value();
+ unsigned paddedRowSize = checkedValue.ValueOrDie();
- CheckedInt<uint32_t> rows = imageHeight;
+ CheckedNumeric<uint32_t> rows = imageHeight;
rows *= (depth - 1);
// Last image is not affected by IMAGE_HEIGHT parameter.
rows += height;
- if (!rows.isValid())
+ if (!rows.IsValid())
return GL_INVALID_VALUE;
- checkedValue *= (rows.value() - 1);
+ checkedValue *= (rows.ValueOrDie() - 1);
// Last row is not affected by ROW_LENGTH parameter.
checkedValue += lastRowSize;
- if (!checkedValue.isValid())
+ if (!checkedValue.IsValid())
return GL_INVALID_VALUE;
- *imageSizeInBytes = checkedValue.value();
+ *imageSizeInBytes = checkedValue.ValueOrDie();
if (paddingInBytes)
*paddingInBytes = padding;
- CheckedInt<uint32_t> skipSize = 0;
+ CheckedNumeric<uint32_t> skipSize = 0;
if (params.skipImages > 0) {
- CheckedInt<uint32_t> tmp = paddedRowSize;
+ CheckedNumeric<uint32_t> tmp = paddedRowSize;
tmp *= imageHeight;
tmp *= params.skipImages;
- if (!tmp.isValid())
+ if (!tmp.IsValid())
return GL_INVALID_VALUE;
- skipSize += tmp.value();
+ skipSize += tmp.ValueOrDie();
}
if (params.skipRows > 0) {
- CheckedInt<uint32_t> tmp = paddedRowSize;
+ CheckedNumeric<uint32_t> tmp = paddedRowSize;
tmp *= params.skipRows;
- if (!tmp.isValid())
+ if (!tmp.IsValid())
return GL_INVALID_VALUE;
- skipSize += tmp.value();
+ skipSize += tmp.ValueOrDie();
}
if (params.skipPixels > 0) {
- CheckedInt<uint32_t> tmp = bytesPerGroup;
+ CheckedNumeric<uint32_t> tmp = bytesPerGroup;
tmp *= params.skipPixels;
- if (!tmp.isValid())
+ if (!tmp.IsValid())
return GL_INVALID_VALUE;
- skipSize += tmp.value();
+ skipSize += tmp.ValueOrDie();
}
- if (!skipSize.isValid())
+ if (!skipSize.IsValid())
return GL_INVALID_VALUE;
if (skipSizeInBytes)
- *skipSizeInBytes = skipSize.value();
+ *skipSizeInBytes = skipSize.ValueOrDie();
- checkedValue += skipSize.value();
- if (!checkedValue.isValid())
+ checkedValue += skipSize.ValueOrDie();
+ if (!checkedValue.IsValid())
return GL_INVALID_VALUE;
return GL_NO_ERROR;
}
« no previous file with comments | « third_party/WebKit/Source/platform/CheckedInt.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698