| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The Android Open Source Project | 2 * Copyright 2015 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkGifInterlaceIter.h" | 8 #include "SkGifInterlaceIter.h" |
| 9 | 9 |
| 10 static const uint8_t kStartingInterlaceYValues[] = { 0, 4, 2, 1 }; | 10 static const uint8_t kStartingInterlaceYValues[] = { 0, 4, 2, 1 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 void SkGifInterlaceIter::prepareY() { | 21 void SkGifInterlaceIter::prepareY() { |
| 22 int32_t y = fCurrY + fDeltaY; | 22 int32_t y = fCurrY + fDeltaY; |
| 23 | 23 |
| 24 // Iterate through fStartYPtr until a valid row is found. | 24 // Iterate through fStartYPtr until a valid row is found. |
| 25 // This ensures that we do not move past the height of the small images. | 25 // This ensures that we do not move past the height of the small images. |
| 26 while (y >= fHeight) { | 26 while (y >= fHeight) { |
| 27 if (kStartingInterlaceYValues + | 27 if (kStartingInterlaceYValues + |
| 28 SK_ARRAY_COUNT(kStartingInterlaceYValues) == fStartYPtr) { | 28 SK_ARRAY_COUNT(kStartingInterlaceYValues) == fStartYPtr) { |
| 29 // Now we have iterated over the entire image. Forbid any | 29 // Now we have iterated over the entire image. Forbid any |
| 30 // subsequent calls to nextY(). | 30 // subsequent calls to nextY(). |
| 31 SkDEBUGCODE(fStartYPtr = NULL;) | 31 SkDEBUGCODE(fStartYPtr = nullptr;) |
| 32 SkDEBUGCODE(fDeltaYPtr = NULL;) | 32 SkDEBUGCODE(fDeltaYPtr = nullptr;) |
| 33 y = 0; | 33 y = 0; |
| 34 } else { | 34 } else { |
| 35 y = *fStartYPtr++; | 35 y = *fStartYPtr++; |
| 36 fDeltaY = *fDeltaYPtr++; | 36 fDeltaY = *fDeltaYPtr++; |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 fCurrY = y; | 39 fCurrY = y; |
| 40 } | 40 } |
| 41 | 41 |
| 42 int32_t SkGifInterlaceIter::nextY() { | 42 int32_t SkGifInterlaceIter::nextY() { |
| 43 SkASSERT(fStartYPtr); | 43 SkASSERT(fStartYPtr); |
| 44 SkASSERT(fDeltaYPtr); | 44 SkASSERT(fDeltaYPtr); |
| 45 int32_t y = fCurrY; | 45 int32_t y = fCurrY; |
| 46 prepareY(); | 46 prepareY(); |
| 47 return y; | 47 return y; |
| 48 } | 48 } |
| OLD | NEW |