Second wave of Win64 warning cleanup
https://codereview.chromium.org/27343002/ git-svn-id: http://skia.googlecode.com/svn/trunk@11778 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
baa15581f6
commit
8b169311b5
@ -20,7 +20,7 @@ static int count_glyphs(const uint16_t start[]) {
|
||||
while (*curr != gUniqueGlyphIDs_Sentinel) {
|
||||
curr += 1;
|
||||
}
|
||||
return curr - start;
|
||||
return static_cast<int>(curr - start);
|
||||
}
|
||||
|
||||
class FontCacheBench : public SkBenchmark {
|
||||
@ -39,7 +39,7 @@ protected:
|
||||
|
||||
const uint16_t* array = gUniqueGlyphIDs;
|
||||
while (*array != gUniqueGlyphIDs_Sentinel) {
|
||||
size_t count = count_glyphs(array);
|
||||
int count = count_glyphs(array);
|
||||
for (int i = 0; i < this->getLoops(); ++i) {
|
||||
paint.measureText(array, count * sizeof(uint16_t));
|
||||
}
|
||||
|
@ -150,10 +150,10 @@ int SkPictureRecord::save(SaveFlags flags) {
|
||||
|
||||
// op + flags
|
||||
uint32_t size = kSaveSize;
|
||||
uint32_t initialOffset = this->addDraw(SAVE, &size);
|
||||
size_t initialOffset = this->addDraw(SAVE, &size);
|
||||
addInt(flags);
|
||||
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
return this->INHERITED::save(flags);
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint,
|
||||
|
||||
SkASSERT(kSaveLayerNoBoundsSize == size || kSaveLayerWithBoundsSize == size);
|
||||
|
||||
uint32_t initialOffset = this->addDraw(SAVE_LAYER, &size);
|
||||
size_t initialOffset = this->addDraw(SAVE_LAYER, &size);
|
||||
addRectPtr(bounds);
|
||||
SkASSERT(initialOffset+getPaintOffset(SAVE_LAYER, size) == fWriter.size());
|
||||
addPaintPtr(paint);
|
||||
@ -183,7 +183,7 @@ int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint,
|
||||
fFirstSavedLayerIndex = fRestoreOffsetStack.count();
|
||||
}
|
||||
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
/* Don't actually call saveLayer, because that will try to allocate an
|
||||
offscreen device (potentially very big) which we don't actually need
|
||||
at this time (and may not be able to afford since during record our
|
||||
@ -603,66 +603,66 @@ void SkPictureRecord::restore() {
|
||||
|
||||
fRestoreOffsetStack.pop();
|
||||
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
return this->INHERITED::restore();
|
||||
}
|
||||
|
||||
bool SkPictureRecord::translate(SkScalar dx, SkScalar dy) {
|
||||
// op + dx + dy
|
||||
uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
|
||||
uint32_t initialOffset = this->addDraw(TRANSLATE, &size);
|
||||
size_t initialOffset = this->addDraw(TRANSLATE, &size);
|
||||
addScalar(dx);
|
||||
addScalar(dy);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
return this->INHERITED::translate(dx, dy);
|
||||
}
|
||||
|
||||
bool SkPictureRecord::scale(SkScalar sx, SkScalar sy) {
|
||||
// op + sx + sy
|
||||
uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
|
||||
uint32_t initialOffset = this->addDraw(SCALE, &size);
|
||||
size_t initialOffset = this->addDraw(SCALE, &size);
|
||||
addScalar(sx);
|
||||
addScalar(sy);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
return this->INHERITED::scale(sx, sy);
|
||||
}
|
||||
|
||||
bool SkPictureRecord::rotate(SkScalar degrees) {
|
||||
// op + degrees
|
||||
uint32_t size = 1 * kUInt32Size + sizeof(SkScalar);
|
||||
uint32_t initialOffset = this->addDraw(ROTATE, &size);
|
||||
size_t initialOffset = this->addDraw(ROTATE, &size);
|
||||
addScalar(degrees);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
return this->INHERITED::rotate(degrees);
|
||||
}
|
||||
|
||||
bool SkPictureRecord::skew(SkScalar sx, SkScalar sy) {
|
||||
// op + sx + sy
|
||||
uint32_t size = 1 * kUInt32Size + 2 * sizeof(SkScalar);
|
||||
uint32_t initialOffset = this->addDraw(SKEW, &size);
|
||||
size_t initialOffset = this->addDraw(SKEW, &size);
|
||||
addScalar(sx);
|
||||
addScalar(sy);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
return this->INHERITED::skew(sx, sy);
|
||||
}
|
||||
|
||||
bool SkPictureRecord::concat(const SkMatrix& matrix) {
|
||||
validate(fWriter.size(), 0);
|
||||
this->validate(fWriter.size(), 0);
|
||||
// op + matrix index
|
||||
uint32_t size = 2 * kUInt32Size;
|
||||
uint32_t initialOffset = this->addDraw(CONCAT, &size);
|
||||
size_t initialOffset = this->addDraw(CONCAT, &size);
|
||||
addMatrix(matrix);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
return this->INHERITED::concat(matrix);
|
||||
}
|
||||
|
||||
void SkPictureRecord::setMatrix(const SkMatrix& matrix) {
|
||||
validate(fWriter.size(), 0);
|
||||
this->validate(fWriter.size(), 0);
|
||||
// op + matrix index
|
||||
uint32_t size = 2 * kUInt32Size;
|
||||
uint32_t initialOffset = this->addDraw(SET_MATRIX, &size);
|
||||
size_t initialOffset = this->addDraw(SET_MATRIX, &size);
|
||||
addMatrix(matrix);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
this->INHERITED::setMatrix(matrix);
|
||||
}
|
||||
|
||||
@ -747,12 +747,12 @@ bool SkPictureRecord::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
|
||||
// + restore offset
|
||||
size += kUInt32Size;
|
||||
}
|
||||
uint32_t initialOffset = this->addDraw(CLIP_RECT, &size);
|
||||
size_t initialOffset = this->addDraw(CLIP_RECT, &size);
|
||||
addRect(rect);
|
||||
addInt(ClipParams_pack(op, doAA));
|
||||
recordRestoreOffsetPlaceholder(op);
|
||||
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
return this->INHERITED::clipRect(rect, op, doAA);
|
||||
}
|
||||
|
||||
@ -768,12 +768,12 @@ bool SkPictureRecord::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA
|
||||
// + restore offset
|
||||
size += kUInt32Size;
|
||||
}
|
||||
uint32_t initialOffset = this->addDraw(CLIP_RRECT, &size);
|
||||
size_t initialOffset = this->addDraw(CLIP_RRECT, &size);
|
||||
addRRect(rrect);
|
||||
addInt(ClipParams_pack(op, doAA));
|
||||
recordRestoreOffsetPlaceholder(op);
|
||||
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
|
||||
if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) {
|
||||
return this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false);
|
||||
@ -796,12 +796,12 @@ bool SkPictureRecord::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
|
||||
// + restore offset
|
||||
size += kUInt32Size;
|
||||
}
|
||||
uint32_t initialOffset = this->addDraw(CLIP_PATH, &size);
|
||||
size_t initialOffset = this->addDraw(CLIP_PATH, &size);
|
||||
addPath(path);
|
||||
addInt(ClipParams_pack(op, doAA));
|
||||
recordRestoreOffsetPlaceholder(op);
|
||||
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
|
||||
if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) {
|
||||
return this->updateClipConservativelyUsingBounds(path.getBounds(), op,
|
||||
@ -819,63 +819,63 @@ bool SkPictureRecord::clipRegion(const SkRegion& region, SkRegion::Op op) {
|
||||
// + restore offset
|
||||
size += kUInt32Size;
|
||||
}
|
||||
uint32_t initialOffset = this->addDraw(CLIP_REGION, &size);
|
||||
size_t initialOffset = this->addDraw(CLIP_REGION, &size);
|
||||
addRegion(region);
|
||||
addInt(ClipParams_pack(op, false));
|
||||
recordRestoreOffsetPlaceholder(op);
|
||||
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
return this->INHERITED::clipRegion(region, op);
|
||||
}
|
||||
|
||||
void SkPictureRecord::clear(SkColor color) {
|
||||
// op + color
|
||||
uint32_t size = 2 * kUInt32Size;
|
||||
uint32_t initialOffset = this->addDraw(DRAW_CLEAR, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_CLEAR, &size);
|
||||
addInt(color);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawPaint(const SkPaint& paint) {
|
||||
// op + paint index
|
||||
uint32_t size = 2 * kUInt32Size;
|
||||
uint32_t initialOffset = this->addDraw(DRAW_PAINT, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_PAINT, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_PAINT, size) == fWriter.size());
|
||||
addPaint(paint);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
const SkPaint& paint) {
|
||||
// op + paint index + mode + count + point data
|
||||
uint32_t size = 4 * kUInt32Size + count * sizeof(SkPoint);
|
||||
uint32_t initialOffset = this->addDraw(DRAW_POINTS, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_POINTS, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_POINTS, size) == fWriter.size());
|
||||
addPaint(paint);
|
||||
addInt(mode);
|
||||
addInt(count);
|
||||
fWriter.writeMul4(pts, count * sizeof(SkPoint));
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawOval(const SkRect& oval, const SkPaint& paint) {
|
||||
// op + paint index + rect
|
||||
uint32_t size = 2 * kUInt32Size + sizeof(oval);
|
||||
uint32_t initialOffset = this->addDraw(DRAW_OVAL, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_OVAL, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_OVAL, size) == fWriter.size());
|
||||
addPaint(paint);
|
||||
addRect(oval);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawRect(const SkRect& rect, const SkPaint& paint) {
|
||||
// op + paint index + rect
|
||||
uint32_t size = 2 * kUInt32Size + sizeof(rect);
|
||||
uint32_t initialOffset = this->addDraw(DRAW_RECT, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_RECT, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_RECT, size) == fWriter.size());
|
||||
addPaint(paint);
|
||||
addRect(rect);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
@ -891,31 +891,31 @@ void SkPictureRecord::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_RRECT, size) == fWriter.size());
|
||||
addPaint(paint);
|
||||
addRRect(rrect);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {
|
||||
// op + paint index + path index
|
||||
uint32_t size = 3 * kUInt32Size;
|
||||
uint32_t initialOffset = this->addDraw(DRAW_PATH, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_PATH, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.size());
|
||||
addPaint(paint);
|
||||
addPath(path);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
|
||||
const SkPaint* paint = NULL) {
|
||||
// op + paint index + bitmap index + left + top
|
||||
uint32_t size = 3 * kUInt32Size + 2 * sizeof(SkScalar);
|
||||
uint32_t initialOffset = this->addDraw(DRAW_BITMAP, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_BITMAP, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.size());
|
||||
addPaintPtr(paint);
|
||||
addBitmap(bitmap);
|
||||
addScalar(left);
|
||||
addScalar(top);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
|
||||
@ -928,52 +928,52 @@ void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect*
|
||||
}
|
||||
size += sizeof(dst); // + rect
|
||||
|
||||
uint32_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) == fWriter.size());
|
||||
addPaintPtr(paint);
|
||||
addBitmap(bitmap);
|
||||
addRectPtr(src); // may be null
|
||||
addRect(dst);
|
||||
addInt(flags);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix,
|
||||
const SkPaint* paint) {
|
||||
// id + paint index + bitmap index + matrix index
|
||||
uint32_t size = 4 * kUInt32Size;
|
||||
uint32_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.size());
|
||||
addPaintPtr(paint);
|
||||
addBitmap(bitmap);
|
||||
addMatrix(matrix);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
|
||||
const SkRect& dst, const SkPaint* paint) {
|
||||
// op + paint index + bitmap id + center + dst rect
|
||||
uint32_t size = 3 * kUInt32Size + sizeof(center) + sizeof(dst);
|
||||
uint32_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_BITMAP_NINE, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_NINE, size) == fWriter.size());
|
||||
addPaintPtr(paint);
|
||||
addBitmap(bitmap);
|
||||
addIRect(center);
|
||||
addRect(dst);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawSprite(const SkBitmap& bitmap, int left, int top,
|
||||
const SkPaint* paint = NULL) {
|
||||
// op + paint index + bitmap index + left + top
|
||||
uint32_t size = 5 * kUInt32Size;
|
||||
uint32_t initialOffset = this->addDraw(DRAW_SPRITE, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_SPRITE, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_SPRITE, size) == fWriter.size());
|
||||
addPaintPtr(paint);
|
||||
addBitmap(bitmap);
|
||||
addInt(left);
|
||||
addInt(top);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbot[2]) {
|
||||
@ -1006,7 +1006,7 @@ void SkPictureRecord::drawText(const void* text, size_t byteLength, SkScalar x,
|
||||
}
|
||||
|
||||
DrawType op = fast ? DRAW_TEXT_TOP_BOTTOM : DRAW_TEXT;
|
||||
uint32_t initialOffset = this->addDraw(op, &size);
|
||||
size_t initialOffset = this->addDraw(op, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.size());
|
||||
const SkFlatData* flatPaintData = addPaint(paint);
|
||||
SkASSERT(flatPaintData);
|
||||
@ -1016,7 +1016,7 @@ void SkPictureRecord::drawText(const void* text, size_t byteLength, SkScalar x,
|
||||
if (fast) {
|
||||
addFontMetricsTopBottom(paint, *flatPaintData, y, y);
|
||||
}
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawPosText(const void* text, size_t byteLength,
|
||||
@ -1072,7 +1072,7 @@ void SkPictureRecord::drawPosText(const void* text, size_t byteLength,
|
||||
} else {
|
||||
op = DRAW_POS_TEXT;
|
||||
}
|
||||
uint32_t initialOffset = this->addDraw(op, &size);
|
||||
size_t initialOffset = this->addDraw(op, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(op, size) == fWriter.size());
|
||||
const SkFlatData* flatPaintData = addPaint(paint);
|
||||
SkASSERT(flatPaintData);
|
||||
@ -1100,7 +1100,7 @@ void SkPictureRecord::drawPosText(const void* text, size_t byteLength,
|
||||
fPointBytes += fWriter.size() - start;
|
||||
fPointWrites += points;
|
||||
#endif
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawPosTextH(const void* text, size_t byteLength,
|
||||
@ -1127,7 +1127,7 @@ void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength,
|
||||
}
|
||||
// + y + the actual points
|
||||
size += 1 * kUInt32Size + points * sizeof(SkScalar);
|
||||
uint32_t initialOffset = this->addDraw(fast ? DRAW_POS_TEXT_H_TOP_BOTTOM : DRAW_POS_TEXT_H,
|
||||
size_t initialOffset = this->addDraw(fast ? DRAW_POS_TEXT_H_TOP_BOTTOM : DRAW_POS_TEXT_H,
|
||||
&size);
|
||||
SkASSERT(flatPaintData);
|
||||
addFlatPaint(flatPaintData);
|
||||
@ -1147,7 +1147,7 @@ void SkPictureRecord::drawPosTextHImpl(const void* text, size_t byteLength,
|
||||
fPointBytes += fWriter.size() - start;
|
||||
fPointWrites += points;
|
||||
#endif
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawTextOnPath(const void* text, size_t byteLength,
|
||||
@ -1155,21 +1155,21 @@ void SkPictureRecord::drawTextOnPath(const void* text, size_t byteLength,
|
||||
const SkPaint& paint) {
|
||||
// op + paint index + length + 'length' worth of data + path index + matrix index
|
||||
uint32_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * kUInt32Size;
|
||||
uint32_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.size());
|
||||
addPaint(paint);
|
||||
addText(text, byteLength);
|
||||
addPath(path);
|
||||
addMatrixPtr(matrix);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawPicture(SkPicture& picture) {
|
||||
// op + picture index
|
||||
uint32_t size = 2 * kUInt32Size;
|
||||
uint32_t initialOffset = this->addDraw(DRAW_PICTURE, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_PICTURE, &size);
|
||||
addPicture(picture);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount,
|
||||
@ -1201,7 +1201,7 @@ void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount,
|
||||
size += 1 * kUInt32Size + SkAlign4(indexCount * sizeof(uint16_t));
|
||||
}
|
||||
|
||||
uint32_t initialOffset = this->addDraw(DRAW_VERTICES, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_VERTICES, &size);
|
||||
SkASSERT(initialOffset+getPaintOffset(DRAW_VERTICES, size) == fWriter.size());
|
||||
addPaint(paint);
|
||||
addInt(flags);
|
||||
@ -1218,25 +1218,25 @@ void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount,
|
||||
addInt(indexCount);
|
||||
fWriter.writePad(indices, indexCount * sizeof(uint16_t));
|
||||
}
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::drawData(const void* data, size_t length) {
|
||||
// op + length + 'length' worth of data
|
||||
uint32_t size = 2 * kUInt32Size + SkAlign4(length);
|
||||
uint32_t initialOffset = this->addDraw(DRAW_DATA, &size);
|
||||
size_t initialOffset = this->addDraw(DRAW_DATA, &size);
|
||||
addInt(length);
|
||||
fWriter.writePad(data, length);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::beginCommentGroup(const char* description) {
|
||||
// op/size + length of string + \0 terminated chars
|
||||
int length = strlen(description);
|
||||
uint32_t size = 2 * kUInt32Size + SkAlign4(length + 1);
|
||||
uint32_t initialOffset = this->addDraw(BEGIN_COMMENT_GROUP, &size);
|
||||
size_t initialOffset = this->addDraw(BEGIN_COMMENT_GROUP, &size);
|
||||
fWriter.writeString(description, length);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::addComment(const char* kywd, const char* value) {
|
||||
@ -1244,17 +1244,17 @@ void SkPictureRecord::addComment(const char* kywd, const char* value) {
|
||||
int kywdLen = strlen(kywd);
|
||||
int valueLen = strlen(value);
|
||||
uint32_t size = 3 * kUInt32Size + SkAlign4(kywdLen + 1) + SkAlign4(valueLen + 1);
|
||||
uint32_t initialOffset = this->addDraw(COMMENT, &size);
|
||||
size_t initialOffset = this->addDraw(COMMENT, &size);
|
||||
fWriter.writeString(kywd, kywdLen);
|
||||
fWriter.writeString(value, valueLen);
|
||||
validate(initialOffset, size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
void SkPictureRecord::endCommentGroup() {
|
||||
// op/size
|
||||
uint32_t size = 1 * kUInt32Size;
|
||||
uint32_t initialOffset = this->addDraw(END_COMMENT_GROUP, &size);
|
||||
validate(initialOffset, size);
|
||||
size_t initialOffset = this->addDraw(END_COMMENT_GROUP, &size);
|
||||
this->validate(initialOffset, size);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -130,8 +130,8 @@ private:
|
||||
* end of blocks could go unused). Possibly add a second addDraw that
|
||||
* operates in this manner.
|
||||
*/
|
||||
uint32_t addDraw(DrawType drawType, uint32_t* size) {
|
||||
uint32_t offset = fWriter.size();
|
||||
size_t addDraw(DrawType drawType, uint32_t* size) {
|
||||
size_t offset = fWriter.size();
|
||||
|
||||
this->predrawNotify();
|
||||
|
||||
@ -202,7 +202,7 @@ public:
|
||||
|
||||
#ifdef SK_DEBUG_VALIDATE
|
||||
public:
|
||||
void validate(uint32_t initialOffset, uint32_t size) const;
|
||||
void validate(size_t initialOffset, uint32_t size) const;
|
||||
private:
|
||||
void validateBitmaps() const;
|
||||
void validateMatrices() const;
|
||||
@ -211,7 +211,7 @@ private:
|
||||
void validateRegions() const;
|
||||
#else
|
||||
public:
|
||||
void validate(uint32_t initialOffset, uint32_t size) const {
|
||||
void validate(size_t initialOffset, uint32_t size) const {
|
||||
SkASSERT(fWriter.size() == initialOffset + size);
|
||||
}
|
||||
#endif
|
||||
|
@ -62,16 +62,14 @@ GrPlot::~GrPlot() {
|
||||
delete fRects;
|
||||
}
|
||||
|
||||
static void adjust_for_offset(GrIPoint16* loc, const GrIPoint16& offset) {
|
||||
static inline void adjust_for_offset(GrIPoint16* loc, const GrIPoint16& offset) {
|
||||
loc->fX += offset.fX * GR_ATLAS_WIDTH;
|
||||
loc->fY += offset.fY * GR_ATLAS_HEIGHT;
|
||||
}
|
||||
|
||||
static uint8_t* zero_fill(uint8_t* ptr, int count) {
|
||||
while (--count >= 0) {
|
||||
*ptr++ = 0;
|
||||
}
|
||||
return ptr;
|
||||
static inline uint8_t* zero_fill(uint8_t* ptr, size_t count) {
|
||||
sk_bzero(ptr, count);
|
||||
return ptr + count;
|
||||
}
|
||||
|
||||
bool GrPlot::addSubImage(int width, int height, const void* image,
|
||||
@ -128,7 +126,7 @@ GrAtlasMgr::GrAtlasMgr(GrGpu* gpu, GrPixelConfig config) {
|
||||
fTexture = NULL;
|
||||
|
||||
// set up allocated plots
|
||||
int bpp = GrBytesPerPixel(fPixelConfig);
|
||||
size_t bpp = GrBytesPerPixel(fPixelConfig);
|
||||
fPlots = SkNEW_ARRAY(GrPlot, (GR_PLOT_WIDTH*GR_PLOT_HEIGHT));
|
||||
fFreePlots = NULL;
|
||||
GrPlot* currPlot = fPlots;
|
||||
|
@ -54,7 +54,7 @@ private:
|
||||
GrRectanizer* fRects;
|
||||
GrAtlasMgr* fAtlasMgr;
|
||||
GrIPoint16 fOffset;
|
||||
int fBytesPerPixel;
|
||||
size_t fBytesPerPixel;
|
||||
|
||||
friend class GrAtlasMgr;
|
||||
};
|
||||
|
@ -286,18 +286,18 @@ static void stretchImage(void* dst,
|
||||
void* src,
|
||||
int srcW,
|
||||
int srcH,
|
||||
int bpp) {
|
||||
size_t bpp) {
|
||||
GrFixed dx = (srcW << 16) / dstW;
|
||||
GrFixed dy = (srcH << 16) / dstH;
|
||||
|
||||
GrFixed y = dy >> 1;
|
||||
|
||||
int dstXLimit = dstW*bpp;
|
||||
size_t dstXLimit = dstW*bpp;
|
||||
for (int j = 0; j < dstH; ++j) {
|
||||
GrFixed x = dx >> 1;
|
||||
void* srcRow = (uint8_t*)src + (y>>16)*srcW*bpp;
|
||||
void* dstRow = (uint8_t*)dst + j*dstW*bpp;
|
||||
for (int i = 0; i < dstXLimit; i += bpp) {
|
||||
for (size_t i = 0; i < dstXLimit; i += bpp) {
|
||||
memcpy((uint8_t*) dstRow + i,
|
||||
(uint8_t*) srcRow + (x>>16)*bpp,
|
||||
bpp);
|
||||
@ -374,7 +374,7 @@ GrTexture* GrContext::createResizedTexture(const GrTextureDesc& desc,
|
||||
// no longer need to clamp at min RT size.
|
||||
rtDesc.fWidth = GrNextPow2(desc.fWidth);
|
||||
rtDesc.fHeight = GrNextPow2(desc.fHeight);
|
||||
int bpp = GrBytesPerPixel(desc.fConfig);
|
||||
size_t bpp = GrBytesPerPixel(desc.fConfig);
|
||||
SkAutoSMalloc<128*128*4> stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fHeight);
|
||||
stretchImage(stretchedPixels.get(), rtDesc.fWidth, rtDesc.fHeight,
|
||||
srcData, desc.fWidth, desc.fHeight, bpp);
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
fFontScalerKey = scaler->getKey();
|
||||
}
|
||||
|
||||
uint32_t getHash() const { return fFontScalerKey->getHash(); }
|
||||
intptr_t getHash() const { return fFontScalerKey->getHash(); }
|
||||
|
||||
static bool LT(const GrTextStrike& strike, const Key& key) {
|
||||
return *strike.getFontScalerKey() < *key.fFontScalerKey;
|
||||
|
@ -31,8 +31,8 @@ static void test_bsearch() {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99
|
||||
};
|
||||
|
||||
for (size_t n = 0; n < GR_ARRAY_COUNT(array); n++) {
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
for (int n = 0; n < static_cast<int>(GR_ARRAY_COUNT(array)); ++n) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
int index = GrTBSearch<int, int>(array, n, array[i]);
|
||||
SkASSERT(index == (int) i);
|
||||
index = GrTBSearch<int, int>(array, n, -array[i]);
|
||||
|
@ -242,7 +242,7 @@ static bool webp_get_config_resize(WebPDecoderConfig* config,
|
||||
|
||||
config->output.colorspace = mode;
|
||||
config->output.u.RGBA.rgba = (uint8_t*)decodedBitmap->getPixels();
|
||||
config->output.u.RGBA.stride = decodedBitmap->rowBytes();
|
||||
config->output.u.RGBA.stride = (int) decodedBitmap->rowBytes();
|
||||
config->output.u.RGBA.size = decodedBitmap->getSize();
|
||||
config->output.is_external_memory = 1;
|
||||
|
||||
|
@ -69,9 +69,9 @@ static void sk_skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
|
||||
skjpeg_source_mgr* src = (skjpeg_source_mgr*)cinfo->src;
|
||||
|
||||
if (num_bytes > (long)src->bytes_in_buffer) {
|
||||
long bytesToSkip = num_bytes - src->bytes_in_buffer;
|
||||
size_t bytesToSkip = num_bytes - src->bytes_in_buffer;
|
||||
while (bytesToSkip > 0) {
|
||||
long bytes = (long)src->fStream->skip(bytesToSkip);
|
||||
size_t bytes = src->fStream->skip(bytesToSkip);
|
||||
if (bytes <= 0 || bytes > bytesToSkip) {
|
||||
// SkDebugf("xxxxxxxxxxxxxx failure to skip request %d returned %d\n", bytesToSkip, bytes);
|
||||
cinfo->err->error_exit((j_common_ptr)cinfo);
|
||||
|
@ -65,7 +65,7 @@ SkPDFResourceDict::SkPDFResourceDict() : SkPDFDict() {
|
||||
|
||||
// Actual sub-dicts will be lazily added later
|
||||
fTypes.setCount(kResourceTypeCount);
|
||||
for (size_t i=0; i < kResourceTypeCount; i++) {
|
||||
for (int i=0; i < kResourceTypeCount; i++) {
|
||||
fTypes[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -291,12 +291,12 @@ public:
|
||||
// A O(n log n) algorithm is necessary as O(n^2) will choke some GMs.
|
||||
SkAutoMalloc sortedArray(fOrderedArray->bytes());
|
||||
T* sortedBase = reinterpret_cast<T*>(sortedArray.get());
|
||||
size_t count = fOrderedArray->count();
|
||||
int count = fOrderedArray->count();
|
||||
fOrderedArray->copyRange(sortedBase, 0, count);
|
||||
|
||||
SkTQSort<T>(sortedBase, sortedBase + count - 1);
|
||||
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (sortedBase[i] != (*fSetArray)[i]) {
|
||||
return false;
|
||||
}
|
||||
|
@ -694,7 +694,7 @@ void SkGPipeCanvas::drawPaint(const SkPaint& paint) {
|
||||
}
|
||||
|
||||
void SkGPipeCanvas::drawPoints(PointMode mode, size_t count,
|
||||
const SkPoint pts[], const SkPaint& paint) {
|
||||
const SkPoint pts[], const SkPaint& paint) {
|
||||
if (count) {
|
||||
NOTIFY_SETUP(this);
|
||||
this->writePaint(paint);
|
||||
|
@ -2154,10 +2154,10 @@ size_t LogFontTypeface::onGetTableData(SkFontTableTag tag, size_t offset,
|
||||
if (NULL == data) {
|
||||
length = 0;
|
||||
}
|
||||
DWORD bufferSize = GetFontData(hdc, tag, offset, data, length);
|
||||
DWORD bufferSize = GetFontData(hdc, tag, (DWORD) offset, data, (DWORD) length);
|
||||
if (bufferSize == GDI_ERROR) {
|
||||
call_ensure_accessible(lf);
|
||||
bufferSize = GetFontData(hdc, tag, offset, data, length);
|
||||
bufferSize = GetFontData(hdc, tag, (DWORD) offset, data, (DWORD) length);
|
||||
}
|
||||
|
||||
SelectObject(hdc, savefont);
|
||||
|
@ -231,7 +231,7 @@ bool SkImageDecoder_WIC::decodeStream(SkStream* stream, SkBitmap* bm, WICModes w
|
||||
if (SUCCEEDED(hr)) {
|
||||
SkAutoLockPixels alp(*bm);
|
||||
bm->eraseColor(SK_ColorTRANSPARENT);
|
||||
const UINT stride = bm->rowBytes();
|
||||
const UINT stride = (UINT) bm->rowBytes();
|
||||
hr = piBitmapSourceConverted->CopyPixels(
|
||||
NULL, //Get all the pixels
|
||||
stride,
|
||||
@ -414,7 +414,7 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
|
||||
//Write the pixels into the frame.
|
||||
if (SUCCEEDED(hr)) {
|
||||
SkAutoLockPixels alp(*bitmap);
|
||||
const UINT stride = bitmap->rowBytes();
|
||||
const UINT stride = (UINT) bitmap->rowBytes();
|
||||
hr = piBitmapFrameEncode->WritePixels(
|
||||
height
|
||||
, stride
|
||||
|
@ -60,7 +60,7 @@ struct SkCanvasLayerState {
|
||||
union {
|
||||
struct {
|
||||
RasterConfig config; // pixel format: a value from RasterConfigs.
|
||||
uint32_t rowBytes; // Number of bytes from start of one line to next.
|
||||
size_t rowBytes; // Number of bytes from start of one line to next.
|
||||
void* pixels; // The pixels, all (height * rowBytes) of them.
|
||||
} raster;
|
||||
struct {
|
||||
|
@ -43,7 +43,7 @@ static int fillIndices(uint16_t indices[], int xCount, int yCount) {
|
||||
}
|
||||
n += 1;
|
||||
}
|
||||
return indices - startIndices;
|
||||
return static_cast<int>(indices - startIndices);
|
||||
}
|
||||
|
||||
// Computes the delta between vertices along a single axis
|
||||
|
@ -124,7 +124,7 @@ bool SkOSWindow::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
} break;
|
||||
case WM_UNICHAR:
|
||||
this->handleChar(wParam);
|
||||
this->handleChar((SkUnichar) wParam);
|
||||
return true;
|
||||
case WM_CHAR: {
|
||||
this->handleChar(SkUTF8_ToUnichar((char*)&wParam));
|
||||
|
@ -115,7 +115,7 @@ static SkString replace_all(const SkString &input,
|
||||
static SkString filename_to_derived_filename(const SkString& filename, const char *suffix) {
|
||||
SkString diffName (filename);
|
||||
const char* cstring = diffName.c_str();
|
||||
int dotOffset = strrchr(cstring, '.') - cstring;
|
||||
size_t dotOffset = strrchr(cstring, '.') - cstring;
|
||||
diffName.remove(dotOffset, diffName.size() - dotOffset);
|
||||
diffName.append(suffix);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user