зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1099437 - Part 2: Clean up int vs uint usage. r=nical
This commit is contained in:
Родитель
a402938525
Коммит
714a806fb0
|
@ -35,11 +35,11 @@ using namespace gfx;
|
|||
namespace {
|
||||
struct SurfaceBufferInfo
|
||||
{
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
SurfaceFormat format;
|
||||
|
||||
static uint32_t GetOffset()
|
||||
static int32_t GetOffset()
|
||||
{
|
||||
return GetAlignedStride<16>(sizeof(SurfaceBufferInfo));
|
||||
}
|
||||
|
@ -66,12 +66,12 @@ ImageDataSerializer::InitializeBufferInfo(IntSize aSize,
|
|||
Validate();
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
ComputeStride(SurfaceFormat aFormat, uint32_t aWidth)
|
||||
static inline int32_t
|
||||
ComputeStride(SurfaceFormat aFormat, int32_t aWidth)
|
||||
{
|
||||
CheckedInt<uint32_t> size = BytesPerPixel(aFormat);
|
||||
CheckedInt<int32_t> size = BytesPerPixel(aFormat);
|
||||
size *= aWidth;
|
||||
if (!size.isValid() || size == 0) {
|
||||
if (!size.isValid() || size.value() <= 0) {
|
||||
gfxDebug() << "ComputeStride overflow " << aWidth;
|
||||
return 0;
|
||||
}
|
||||
|
@ -89,10 +89,10 @@ ImageDataSerializerBase::ComputeMinBufferSize(IntSize aSize,
|
|||
return 0;
|
||||
}
|
||||
|
||||
CheckedInt<uint32_t> bufsize = ComputeStride(aFormat, aSize.width);
|
||||
CheckedInt<int32_t> bufsize = ComputeStride(aFormat, aSize.width);
|
||||
bufsize *= aSize.height;
|
||||
|
||||
if (!bufsize.isValid() || bufsize.value() == 0) {
|
||||
if (!bufsize.isValid() || bufsize.value() <= 0) {
|
||||
gfxDebug() << "Buffer size overflow " << aSize.width << "x" << aSize.height;
|
||||
return 0;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче