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

Unified Diff: src/pipe/SkGPipeWrite.cpp

Issue 256443002: fix int/size_t warnings in pipe (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | « src/pipe/SkGPipeRead.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/SkGPipeWrite.cpp
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 297e613a6f0a24d466aa18e89846b2d21070a15d..82848f8a6ff1af1aa7b81b6147f791c658bcb4b3 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -59,7 +59,7 @@ static size_t writeTypeface(SkWriter32* writer, SkTypeface* typeface) {
typeface->serialize(&stream);
size_t size = stream.getOffset();
if (writer) {
- writer->write32(size);
+ writer->write32(SkToU32(size));
SkAutoDataUnref data(stream.copyToData());
writer->writePad(data->data(), size);
}
@@ -379,7 +379,7 @@ bool SkGPipeCanvas::shuttleBitmap(const SkBitmap& bm, int32_t slot) {
buffer.setNamedFactoryRecorder(fFactorySet);
buffer.writeBitmap(bm);
this->flattenFactoryNames();
- uint32_t size = buffer.bytesWritten();
+ size_t size = buffer.bytesWritten();
if (this->needOpBytes(size)) {
this->writeOp(kDef_Bitmap_DrawOp, 0, slot);
void* dst = static_cast<void*>(fWriter.reserve(size));
@@ -478,7 +478,7 @@ bool SkGPipeCanvas::needOpBytes(size_t needed) {
// Before we wipe out any data that has already been written, read it
// out.
this->doNotify();
- size_t blockSize = SkMax32(MIN_BLOCK_SIZE, needed);
+ size_t blockSize = SkTMax<size_t>(MIN_BLOCK_SIZE, needed);
void* block = fController->requestBlock(blockSize, &fBlockSize);
if (NULL == block) {
// Do not notify the readers, which would call this function again.
@@ -704,7 +704,7 @@ void SkGPipeCanvas::drawPoints(PointMode mode, size_t count,
this->writePaint(paint);
if (this->needOpBytes(4 + count * sizeof(SkPoint))) {
this->writeOp(kDrawPoints_DrawOp, mode, 0);
- fWriter.write32(count);
+ fWriter.write32(SkToU32(count));
fWriter.write(pts, count * sizeof(SkPoint));
}
}
@@ -855,7 +855,7 @@ void SkGPipeCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x,
this->writePaint(paint);
if (this->needOpBytes(4 + SkAlign4(byteLength) + 2 * sizeof(SkScalar))) {
this->writeOp(kDrawText_DrawOp);
- fWriter.write32(byteLength);
+ fWriter.write32(SkToU32(byteLength));
fWriter.writePad(text, byteLength);
fWriter.writeScalar(x);
fWriter.writeScalar(y);
@@ -871,7 +871,7 @@ void SkGPipeCanvas::onDrawPosText(const void* text, size_t byteLength, const SkP
int count = paint.textToGlyphs(text, byteLength, NULL);
if (this->needOpBytes(4 + SkAlign4(byteLength) + 4 + count * sizeof(SkPoint))) {
this->writeOp(kDrawPosText_DrawOp);
- fWriter.write32(byteLength);
+ fWriter.write32(SkToU32(byteLength));
fWriter.writePad(text, byteLength);
fWriter.write32(count);
fWriter.write(pos, count * sizeof(SkPoint));
@@ -887,7 +887,7 @@ void SkGPipeCanvas::onDrawPosTextH(const void* text, size_t byteLength, const Sk
int count = paint.textToGlyphs(text, byteLength, NULL);
if (this->needOpBytes(4 + SkAlign4(byteLength) + 4 + count * sizeof(SkScalar) + 4)) {
this->writeOp(kDrawPosTextH_DrawOp);
- fWriter.write32(byteLength);
+ fWriter.write32(SkToU32(byteLength));
fWriter.writePad(text, byteLength);
fWriter.write32(count);
fWriter.write(xpos, count * sizeof(SkScalar));
@@ -910,7 +910,7 @@ void SkGPipeCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const
if (this->needOpBytes(size)) {
this->writeOp(kDrawTextOnPath_DrawOp, flags, 0);
- fWriter.write32(byteLength);
+ fWriter.write32(SkToU32(byteLength));
fWriter.writePad(text, byteLength);
fWriter.writePath(path);
@@ -989,7 +989,7 @@ void SkGPipeCanvas::drawData(const void* ptr, size_t size) {
if (this->needOpBytes(4 + SkAlign4(size))) {
this->writeOp(kDrawData_DrawOp, 0, data);
if (0 == data) {
- fWriter.write32(size);
+ fWriter.write32(SkToU32(size));
}
fWriter.writePad(ptr, size);
}
@@ -1139,7 +1139,7 @@ void SkGPipeCanvas::writePaint(const SkPaint& paint) {
size_t size = (char*)ptr - (char*)storage;
if (size && this->needOpBytes(size)) {
- this->writeOp(kPaintOp_DrawOp, 0, size);
+ this->writeOp(kPaintOp_DrawOp, 0, SkToU32(size));
fWriter.write(storage, size);
for (size_t i = 0; i < size/4; i++) {
// SkDebugf("[%d] %08X\n", i, storage[i]);
@@ -1159,7 +1159,7 @@ void SkGPipeCanvas::writePaint(const SkPaint& paint) {
paint.getAnnotation()->writeToBuffer(buffer);
const size_t size = buffer.bytesWritten();
if (this->needOpBytes(size)) {
- this->writeOp(kSetAnnotation_DrawOp, 0, size);
+ this->writeOp(kSetAnnotation_DrawOp, 0, SkToU32(size));
buffer.writeToMemory(fWriter.reserve(size));
}
}
« no previous file with comments | « src/pipe/SkGPipeRead.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698