зеркало из https://github.com/mozilla/moz-skia.git
Third wave of Win64 warning cleanup
https://codereview.chromium.org/27487003/ git-svn-id: http://skia.googlecode.com/svn/trunk@11817 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
1ae6c2b012
Коммит
e9cd27d4a3
|
@ -331,7 +331,7 @@ int tool_main(int argc, char** argv) {
|
|||
bool runDefaultConfigs = false;
|
||||
// Try user-given configs first.
|
||||
for (int i = 0; i < FLAGS_config.count(); i++) {
|
||||
for (size_t j = 0; j < SK_ARRAY_COUNT(gConfigs); j++) {
|
||||
for (int j = 0; j < static_cast<int>(SK_ARRAY_COUNT(gConfigs)); ++j) {
|
||||
if (0 == strcmp(FLAGS_config[i], gConfigs[j].name)) {
|
||||
*configs.append() = j;
|
||||
} else if (0 == strcmp(FLAGS_config[i], kDefaultsConfigStr)) {
|
||||
|
@ -341,7 +341,7 @@ int tool_main(int argc, char** argv) {
|
|||
}
|
||||
// If there weren't any, fill in with defaults.
|
||||
if (runDefaultConfigs) {
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); ++i) {
|
||||
for (int i = 0; i < static_cast<int>(SK_ARRAY_COUNT(gConfigs)); ++i) {
|
||||
if (gConfigs[i].runByDefault) {
|
||||
*configs.append() = i;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ protected:
|
|||
|
||||
// columns -- flags
|
||||
// rows -- permutations of setting the clip and matrix
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(flags); ++i) {
|
||||
for (int i = 0; i < static_cast<int>(SK_ARRAY_COUNT(flags)); ++i) {
|
||||
for (int j = 0; j < 2; ++j) {
|
||||
for (int k = 0; k < 2; ++k) {
|
||||
this->drawTestPattern(i, (2*j)+k, canvas, flags[i],
|
||||
|
|
|
@ -183,7 +183,7 @@ protected:
|
|||
static const int rowHeight = 60;
|
||||
static const int colWidth = 300;
|
||||
canvas->save();
|
||||
for (size_t s = 0; s < SK_ARRAY_COUNT(shaders); s++) {
|
||||
for (int s = 0; s < static_cast<int>(SK_ARRAY_COUNT(shaders)); s++) {
|
||||
canvas->save();
|
||||
int i = 2*s;
|
||||
canvas->translate(SkIntToScalar((i / testsPerCol) * colWidth),
|
||||
|
|
|
@ -194,7 +194,7 @@ protected:
|
|||
|
||||
SkString str("Hamburgefons");
|
||||
|
||||
for (size_t i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) {
|
||||
for (int i = 0; i < static_cast<int>(SK_ARRAY_COUNT(gRastProcs)); i++) {
|
||||
apply_shader(&paint, i);
|
||||
|
||||
// paint.setMaskFilter(NULL);
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
fData = NULL;
|
||||
#endif
|
||||
}
|
||||
SkTDArray(const T src[], size_t count) {
|
||||
SkTDArray(const T src[], int count) {
|
||||
SkASSERT(src || count == 0);
|
||||
|
||||
fReserve = fCount = 0;
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
/**
|
||||
* Return the number of elements in the array
|
||||
*/
|
||||
int count() const { return (int)fCount; }
|
||||
int count() const { return fCount; }
|
||||
|
||||
/**
|
||||
* return the number of bytes in the array: count * sizeof(T)
|
||||
|
@ -111,11 +111,11 @@ public:
|
|||
const T* end() const { return fArray ? fArray + fCount : NULL; }
|
||||
|
||||
T& operator[](int index) {
|
||||
SkASSERT((unsigned)index < fCount);
|
||||
SkASSERT(index < fCount);
|
||||
return fArray[index];
|
||||
}
|
||||
const T& operator[](int index) const {
|
||||
SkASSERT((unsigned)index < fCount);
|
||||
SkASSERT(index < fCount);
|
||||
return fArray[index];
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
fCount = 0;
|
||||
}
|
||||
|
||||
void setCount(size_t count) {
|
||||
void setCount(int count) {
|
||||
if (count > fReserve) {
|
||||
this->growBy(count - fCount);
|
||||
} else {
|
||||
|
@ -152,10 +152,10 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void setReserve(size_t reserve) {
|
||||
void setReserve(int reserve) {
|
||||
if (reserve > fReserve) {
|
||||
SkASSERT(reserve > fCount);
|
||||
size_t count = fCount;
|
||||
int count = fCount;
|
||||
this->growBy(reserve - fCount);
|
||||
fCount = count;
|
||||
}
|
||||
|
@ -170,8 +170,8 @@ public:
|
|||
T* append() {
|
||||
return this->append(1, NULL);
|
||||
}
|
||||
T* append(size_t count, const T* src = NULL) {
|
||||
size_t oldCount = fCount;
|
||||
T* append(int count, const T* src = NULL) {
|
||||
int oldCount = fCount;
|
||||
if (count) {
|
||||
SkASSERT(src == NULL || fArray == NULL ||
|
||||
src + count <= fArray || fArray + oldCount <= src);
|
||||
|
@ -190,10 +190,10 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
T* insert(size_t index) {
|
||||
T* insert(int index) {
|
||||
return this->insert(index, 1, NULL);
|
||||
}
|
||||
T* insert(size_t index, size_t count, const T* src = NULL) {
|
||||
T* insert(int index, int count, const T* src = NULL) {
|
||||
SkASSERT(count);
|
||||
SkASSERT(index <= fCount);
|
||||
size_t oldCount = fCount;
|
||||
|
@ -206,15 +206,15 @@ public:
|
|||
return dst;
|
||||
}
|
||||
|
||||
void remove(size_t index, size_t count = 1) {
|
||||
void remove(int index, int count = 1) {
|
||||
SkASSERT(index + count <= fCount);
|
||||
fCount = fCount - count;
|
||||
memmove(fArray + index, fArray + index + count, sizeof(T) * (fCount - index));
|
||||
}
|
||||
|
||||
void removeShuffle(size_t index) {
|
||||
void removeShuffle(int index) {
|
||||
SkASSERT(index < fCount);
|
||||
size_t newCount = fCount - 1;
|
||||
int newCount = fCount - 1;
|
||||
fCount = newCount;
|
||||
if (index != newCount) {
|
||||
memcpy(fArray + index, fArray + newCount, sizeof(T));
|
||||
|
@ -256,7 +256,7 @@ public:
|
|||
* Copies up to max elements into dst. The number of items copied is
|
||||
* capped by count - index. The actual number copied is returned.
|
||||
*/
|
||||
int copyRange(T* dst, size_t index, int max) const {
|
||||
int copyRange(T* dst, int index, int max) const {
|
||||
SkASSERT(max >= 0);
|
||||
SkASSERT(!max || dst);
|
||||
if (index >= fCount) {
|
||||
|
@ -346,13 +346,14 @@ private:
|
|||
ArrayT* fData;
|
||||
#endif
|
||||
T* fArray;
|
||||
size_t fReserve, fCount;
|
||||
int fReserve;
|
||||
int fCount;
|
||||
|
||||
void growBy(size_t extra) {
|
||||
void growBy(int extra) {
|
||||
SkASSERT(extra);
|
||||
|
||||
if (fCount + extra > fReserve) {
|
||||
size_t size = fCount + extra + 4;
|
||||
int size = fCount + extra + 4;
|
||||
size += size >> 2;
|
||||
|
||||
fArray = (T*)sk_realloc_throw(fArray, size * sizeof(T));
|
||||
|
|
|
@ -78,7 +78,7 @@ void* GrGLBufferImpl::lock(GrGpuGL* gpu) {
|
|||
this->bind(gpu);
|
||||
// Let driver know it can discard the old data
|
||||
GL_CALL(gpu, BufferData(fBufferType,
|
||||
fDesc.fSizeInBytes,
|
||||
(GrGLsizeiptr) fDesc.fSizeInBytes,
|
||||
NULL,
|
||||
fDesc.fDynamic ? DYNAMIC_USAGE_PARAM : GR_GL_STATIC_DRAW));
|
||||
GR_GL_CALL_RET(gpu->glInterface(),
|
||||
|
@ -119,7 +119,7 @@ bool GrGLBufferImpl::updateData(GrGpuGL* gpu, const void* src, size_t srcSizeInB
|
|||
|
||||
#if GR_GL_USE_BUFFER_DATA_NULL_HINT
|
||||
if (fDesc.fSizeInBytes == srcSizeInBytes) {
|
||||
GL_CALL(gpu, BufferData(fBufferType, srcSizeInBytes, src, usage));
|
||||
GL_CALL(gpu, BufferData(fBufferType, (GrGLsizeiptr) srcSizeInBytes, src, usage));
|
||||
} else {
|
||||
// Before we call glBufferSubData we give the driver a hint using
|
||||
// glBufferData with NULL. This makes the old buffer contents
|
||||
|
@ -127,8 +127,8 @@ bool GrGLBufferImpl::updateData(GrGpuGL* gpu, const void* src, size_t srcSizeInB
|
|||
// draws that reference the old contents. With this hint it can
|
||||
// assign a different allocation for the new contents to avoid
|
||||
// flushing the gpu past draws consuming the old contents.
|
||||
GL_CALL(gpu, BufferData(fBufferType, fDesc.fSizeInBytes, NULL, usage));
|
||||
GL_CALL(gpu, BufferSubData(fBufferType, 0, srcSizeInBytes, src));
|
||||
GL_CALL(gpu, BufferData(fBufferType, (GrGLsizeiptr) fDesc.fSizeInBytes, NULL, usage));
|
||||
GL_CALL(gpu, BufferSubData(fBufferType, 0, (GrGLsizeiptr) srcSizeInBytes, src));
|
||||
}
|
||||
#else
|
||||
// Note that we're cheating on the size here. Currently no methods
|
||||
|
|
|
@ -630,7 +630,7 @@ bool attach_shader(const GrGLInterface* gli,
|
|||
}
|
||||
|
||||
const GrGLchar* sourceStr = shaderSrc.c_str();
|
||||
int sourceLength = shaderSrc.size();
|
||||
GrGLint sourceLength = static_cast<GrGLint>(shaderSrc.size());
|
||||
GR_GL_CALL(gli, ShaderSource(shaderId, 1, &sourceStr, &sourceLength));
|
||||
|
||||
GrGLint compiled = GR_GL_INIT_ZERO;
|
||||
|
|
|
@ -1167,7 +1167,7 @@ GrVertexBuffer* GrGpuGL::onCreateVertexBuffer(size_t size, bool dynamic) {
|
|||
// make sure driver can allocate memory for this buffer
|
||||
GL_ALLOC_CALL(this->glInterface(),
|
||||
BufferData(GR_GL_ARRAY_BUFFER,
|
||||
desc.fSizeInBytes,
|
||||
(GrGLsizeiptr) desc.fSizeInBytes,
|
||||
NULL, // data ptr
|
||||
desc.fDynamic ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
|
||||
if (CHECK_ALLOC_ERROR(this->glInterface()) != GR_GL_NO_ERROR) {
|
||||
|
@ -1200,7 +1200,7 @@ GrIndexBuffer* GrGpuGL::onCreateIndexBuffer(size_t size, bool dynamic) {
|
|||
// make sure driver can allocate memory for this buffer
|
||||
GL_ALLOC_CALL(this->glInterface(),
|
||||
BufferData(GR_GL_ELEMENT_ARRAY_BUFFER,
|
||||
desc.fSizeInBytes,
|
||||
(GrGLsizeiptr) desc.fSizeInBytes,
|
||||
NULL, // data ptr
|
||||
desc.fDynamic ? GR_GL_DYNAMIC_DRAW : GR_GL_STATIC_DRAW));
|
||||
if (CHECK_ALLOC_ERROR(this->glInterface()) != GR_GL_NO_ERROR) {
|
||||
|
@ -1448,7 +1448,8 @@ bool GrGpuGL::onReadPixels(GrRenderTarget* target,
|
|||
if (rowBytes != tightRowBytes) {
|
||||
if (this->glCaps().packRowLengthSupport()) {
|
||||
SkASSERT(!(rowBytes % sizeof(GrColor)));
|
||||
GL_CALL(PixelStorei(GR_GL_PACK_ROW_LENGTH, rowBytes / sizeof(GrColor)));
|
||||
GL_CALL(PixelStorei(GR_GL_PACK_ROW_LENGTH,
|
||||
static_cast<GrGLint>(rowBytes / sizeof(GrColor))));
|
||||
readDstRowBytes = rowBytes;
|
||||
} else {
|
||||
scratch.reset(tightRowBytes * height);
|
||||
|
|
|
@ -199,7 +199,7 @@ public:
|
|||
|
||||
/** Reserves memory for the set.
|
||||
*/
|
||||
void setReserve(size_t reserve) {
|
||||
void setReserve(int reserve) {
|
||||
SkASSERT(fSetArray);
|
||||
SkASSERT(fOrderedArray);
|
||||
fSetArray->setReserve(reserve);
|
||||
|
|
|
@ -38,7 +38,7 @@ bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output) {
|
|||
return false;
|
||||
}
|
||||
|
||||
size_t width = image.width(), height = image.height();
|
||||
int width = image.width(), height = image.height();
|
||||
size_t rowSize = image.bytes_per_row();
|
||||
char *imgData = image.data();
|
||||
|
||||
|
@ -51,9 +51,9 @@ bool SkPopplerRasterizePDF(SkStream* pdf, SkBitmap* output) {
|
|||
SkPMColor* bitmapPixels = (SkPMColor*)bitmap.getPixels();
|
||||
|
||||
// do pixel-by-pixel copy to deal with RGBA ordering conversions
|
||||
for (size_t y = 0; y < height; y++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
char *rowData = imgData;
|
||||
for (size_t x = 0; x < width; x++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
uint8_t a = rowData[3];
|
||||
uint8_t r = rowData[2];
|
||||
uint8_t g = rowData[1];
|
||||
|
|
|
@ -415,7 +415,7 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
|
|||
reporter->reportFailed(str);
|
||||
}
|
||||
|
||||
size_t subW, subH;
|
||||
int subW, subH;
|
||||
// Set sizes to be height = 2 to force the last row of the
|
||||
// source to be used, thus verifying correct operation if
|
||||
// the bitmap is an extracted subset.
|
||||
|
@ -472,7 +472,7 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
|
|||
// To simplify verifying correctness of copies attach
|
||||
// buf to a SkBitmap, but copies are done using the
|
||||
// raw buffer pointer.
|
||||
const uint32_t bufSize = subH *
|
||||
const size_t bufSize = subH *
|
||||
SkBitmap::ComputeRowBytes(src.getConfig(), subW) * 2;
|
||||
SkAutoMalloc autoBuf (bufSize);
|
||||
uint8_t* buf = static_cast<uint8_t*>(autoBuf.get());
|
||||
|
@ -482,8 +482,8 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
|
|||
|
||||
// Set up values for each pixel being copied.
|
||||
Coordinates coords(subW * subH);
|
||||
for (size_t x = 0; x < subW; ++x)
|
||||
for (size_t y = 0; y < subH; ++y)
|
||||
for (int x = 0; x < subW; ++x)
|
||||
for (int y = 0; y < subH; ++y)
|
||||
{
|
||||
int index = y * subW + x;
|
||||
SkASSERT(index < coords.length);
|
||||
|
|
|
@ -191,7 +191,7 @@ static void test_gatherpixelrefs(skiatest::Reporter* reporter) {
|
|||
SkAutoDataUnref data(SkPictureUtils::GatherPixelRefs(pic, r));
|
||||
REPORTER_ASSERT(reporter, data);
|
||||
if (data) {
|
||||
int count = data->size() / sizeof(SkPixelRef*);
|
||||
int count = static_cast<int>(data->size() / sizeof(SkPixelRef*));
|
||||
REPORTER_ASSERT(reporter, 1 == count);
|
||||
REPORTER_ASSERT(reporter, *(SkPixelRef**)data->data() == refs[i]);
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ static void test_gatherpixelrefs(skiatest::Reporter* reporter) {
|
|||
|
||||
SkData* data = SkPictureUtils::GatherPixelRefs(pic, r);
|
||||
size_t dataSize = data ? data->size() : 0;
|
||||
int gatherCount = dataSize / sizeof(SkPixelRef*);
|
||||
int gatherCount = static_cast<int>(dataSize / sizeof(SkPixelRef*));
|
||||
SkASSERT(gatherCount * sizeof(SkPixelRef*) == dataSize);
|
||||
SkPixelRef** gatherRefs = data ? (SkPixelRef**)(data->data()) : NULL;
|
||||
SkAutoDataUnref adu(data);
|
||||
|
|
Загрузка…
Ссылка в новой задаче