| 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 }; |
| 11 static const uint8_t kDeltaInterlaceYValues[] = { 8, 8, 4, 2 }; | 11 static const uint8_t kDeltaInterlaceYValues[] = { 8, 8, 4, 2 }; |
| 12 | 12 |
| 13 SkGifInterlaceIter::SkGifInterlaceIter(int height) : fHeight(height) { | 13 SkGifInterlaceIter::SkGifInterlaceIter(int height) : fHeight(height) { |
| 14 fStartYPtr = kStartingInterlaceYValues; | 14 fStartYPtr = kStartingInterlaceYValues; |
| 15 fDeltaYPtr = kDeltaInterlaceYValues; | 15 fDeltaYPtr = kDeltaInterlaceYValues; |
| 16 | |
| 17 fCurrY = *fStartYPtr++; | 16 fCurrY = *fStartYPtr++; |
| 18 fDeltaY = *fDeltaYPtr++; | 17 fDeltaY = *fDeltaYPtr++; |
| 19 } | 18 } |
| 20 | 19 |
| 21 void SkGifInterlaceIter::prepareY() { | 20 void SkGifInterlaceIter::prepareY() { |
| 22 int32_t y = fCurrY + fDeltaY; | 21 int32_t y = fCurrY + fDeltaY; |
| 23 | 22 |
| 24 // Iterate through fStartYPtr until a valid row is found. | 23 // Iterate through fStartYPtr until a valid row is found. |
| 25 // This ensures that we do not move past the height of the small images. | 24 // This ensures that we do not move past the height of the small images. |
| 26 while (y >= fHeight) { | 25 while (y >= fHeight) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 39 fCurrY = y; | 38 fCurrY = y; |
| 40 } | 39 } |
| 41 | 40 |
| 42 int32_t SkGifInterlaceIter::nextY() { | 41 int32_t SkGifInterlaceIter::nextY() { |
| 43 SkASSERT(fStartYPtr); | 42 SkASSERT(fStartYPtr); |
| 44 SkASSERT(fDeltaYPtr); | 43 SkASSERT(fDeltaYPtr); |
| 45 int32_t y = fCurrY; | 44 int32_t y = fCurrY; |
| 46 prepareY(); | 45 prepareY(); |
| 47 return y; | 46 return y; |
| 48 } | 47 } |
| OLD | NEW |