Fix some 64 bit warnings on mac.

SkAAClip:
Change fDataSize to a size_t, since that is how it is used in all
cases.

SkAlphaRuns.cpp:
Use SkToS32 when subtracting a pointer from another pointer to
return an int.

BUG=http://code.google.com/p/skia/issues/detail?id=1103

Review URL: https://codereview.appspot.com/7314043

git-svn-id: http://skia.googlecode.com/svn/trunk@7591 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
scroggo@google.com 2013-02-05 18:49:00 +00:00
parent 19376b8047
commit 493c65f1aa
2 changed files with 3 additions and 4 deletions

View File

@ -56,7 +56,7 @@ struct SkAAClip::YOffset {
struct SkAAClip::RunHead { struct SkAAClip::RunHead {
int32_t fRefCnt; int32_t fRefCnt;
int32_t fRowCount; int32_t fRowCount;
int32_t fDataSize; size_t fDataSize;
YOffset* yoffsets() { YOffset* yoffsets() {
return (YOffset*)((char*)this + sizeof(RunHead)); return (YOffset*)((char*)this + sizeof(RunHead));
@ -193,7 +193,6 @@ void SkAAClip::validate() const {
const RunHead* head = fRunHead; const RunHead* head = fRunHead;
SkASSERT(head->fRefCnt > 0); SkASSERT(head->fRefCnt > 0);
SkASSERT(head->fRowCount > 0); SkASSERT(head->fRowCount > 0);
SkASSERT(head->fDataSize > 0);
const YOffset* yoff = head->yoffsets(); const YOffset* yoff = head->yoffsets();
const YOffset* ystop = yoff + head->fRowCount; const YOffset* ystop = yoff + head->fRowCount;
@ -210,7 +209,7 @@ void SkAAClip::validate() const {
prevOffset = yoff->fOffset; prevOffset = yoff->fOffset;
const uint8_t* row = head->data() + yoff->fOffset; const uint8_t* row = head->data() + yoff->fOffset;
size_t rowLength = compute_row_length(row, fBounds.width()); size_t rowLength = compute_row_length(row, fBounds.width());
SkASSERT(yoff->fOffset + rowLength <= (size_t) head->fDataSize); SkASSERT(yoff->fOffset + rowLength <= head->fDataSize);
yoff += 1; yoff += 1;
} }
// check the last entry; // check the last entry;

View File

@ -126,7 +126,7 @@ int SkAlphaRuns::add(int x, U8CPU startAlpha, int middleCount, U8CPU stopAlpha,
lastAlpha = alpha; lastAlpha = alpha;
} }
return lastAlpha - fAlpha; // new offsetX return SkToS32(lastAlpha - fAlpha); // new offsetX
} }
#ifdef SK_DEBUG #ifdef SK_DEBUG