From a4c6e4d6d3a4010df8dd2b04314675e4c201133b Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Wed, 20 Jun 2012 14:29:50 +0000 Subject: [PATCH] landing mirror of https://codereview.appspot.com/6304098/ by kondapallykalyan fixing compiler warnings in SkAAClip git-svn-id: http://skia.googlecode.com/svn/trunk@4283 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkAAClip.cpp | 21 +++++++++++---------- src/core/SkAAClip.h | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp index 86c99d8..c4b15b6 100644 --- a/src/core/SkAAClip.cpp +++ b/src/core/SkAAClip.cpp @@ -135,6 +135,7 @@ SkAAClip::Iter::Iter(const SkAAClip& clip) { fDone = true; fTop = fBottom = clip.fBounds.fBottom; fData = NULL; + fStopYOff = NULL; return; } @@ -809,7 +810,9 @@ const uint8_t* SkAAClip::findX(const uint8_t data[], int x, int* initialCount) c for (;;) { int n = data[0]; if (x < n) { - *initialCount = n - x; + if (initialCount) { + *initialCount = n - x; + } break; } data += 2; @@ -831,7 +834,7 @@ bool SkAAClip::quickContains(int left, int top, int right, int bottom) const { } #endif - int lastY; + int lastY SK_INIT_TO_AVOID_WARNING; const uint8_t* row = this->findRow(top, &lastY); if (lastY < bottom) { return false; @@ -1835,8 +1838,7 @@ void SkAAClipBlitter::blitH(int x, int y, int width) { SkASSERT(fAAClipBounds.contains(x, y)); SkASSERT(fAAClipBounds.contains(x + width - 1, y)); - int lastY; - const uint8_t* row = fAAClip->findRow(y, &lastY); + const uint8_t* row = fAAClip->findRow(y); int initialCount; row = fAAClip->findX(row, x, &initialCount); @@ -1903,8 +1905,8 @@ static void merge(const uint8_t* SK_RESTRICT row, int rowN, void SkAAClipBlitter::blitAntiH(int x, int y, const SkAlpha aa[], const int16_t runs[]) { - int lastY; - const uint8_t* row = fAAClip->findRow(y, &lastY); + + const uint8_t* row = fAAClip->findRow(y); int initialCount; row = fAAClip->findX(row, x, &initialCount); @@ -1921,7 +1923,7 @@ void SkAAClipBlitter::blitV(int x, int y, int height, SkAlpha alpha) { } for (;;) { - int lastY; + int lastY SK_INIT_TO_AVOID_WARNING; const uint8_t* row = fAAClip->findRow(y, &lastY); int dy = lastY - y + 1; if (dy > height) { @@ -1929,8 +1931,7 @@ void SkAAClipBlitter::blitV(int x, int y, int height, SkAlpha alpha) { } height -= dy; - int initialCount; - row = fAAClip->findX(row, x, &initialCount); + row = fAAClip->findX(row, x); SkAlpha newAlpha = SkMulDiv255Round(alpha, row[1]); if (newAlpha) { fBlitter->blitV(x, y, dy, newAlpha); @@ -2138,7 +2139,7 @@ void SkAAClipBlitter::blitMask(const SkMask& origMask, const SkIRect& clip) { const int stopY = y + clip.height(); do { - int localStopY; + int localStopY SK_INIT_TO_AVOID_WARNING; const uint8_t* row = fAAClip->findRow(y, &localStopY); // findRow returns last Y, not stop, so we add 1 localStopY = SkMin32(localStopY + 1, stopY); diff --git a/src/core/SkAAClip.h b/src/core/SkAAClip.h index 6036427..03f6992 100644 --- a/src/core/SkAAClip.h +++ b/src/core/SkAAClip.h @@ -61,8 +61,8 @@ public: return this->quickContains(r.fLeft, r.fTop, r.fRight, r.fBottom); } - const uint8_t* findRow(int y, int* lastYForRow) const; - const uint8_t* findX(const uint8_t data[], int x, int* initialCount) const; + const uint8_t* findRow(int y, int* lastYForRow = NULL) const; + const uint8_t* findX(const uint8_t data[], int x, int* initialCount = NULL) const; class Iter; struct RunHead; -- 2.7.4