OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 "SkNinePatchIter.h" | 8 #include "SkNinePatchIter.h" |
9 #include "SkRect.h" | 9 #include "SkRect.h" |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 fDone = false; | 49 fDone = false; |
50 } | 50 } |
51 | 51 |
52 bool SkNinePatchIter::next(SkRect* src, SkRect* dst) { | 52 bool SkNinePatchIter::next(SkRect* src, SkRect* dst) { |
53 if (fDone) { | 53 if (fDone) { |
54 return false; | 54 return false; |
55 } | 55 } |
56 | 56 |
57 const int x = fCurrX; | 57 const int x = fCurrX; |
58 const int y = fCurrY; | 58 const int y = fCurrY; |
59 SkASSERT(x >= 0 && x < 4); | 59 SkASSERT(x >= 0 && x < 3); |
60 SkASSERT(y >= 0 && y < 4); | 60 SkASSERT(y >= 0 && y < 3); |
61 | 61 |
62 src->set(fSrcX[x], fSrcY[y], fSrcX[x + 1], fSrcY[y + 1]); | 62 src->set(fSrcX[x], fSrcY[y], fSrcX[x + 1], fSrcY[y + 1]); |
63 dst->set(fDstX[x], fDstY[y], fDstX[x + 1], fDstY[y + 1]); | 63 dst->set(fDstX[x], fDstY[y], fDstX[x + 1], fDstY[y + 1]); |
64 if (4 == ++fCurrX) { | 64 if (3 == ++fCurrX) { |
65 fCurrX = 0; | 65 fCurrX = 0; |
66 fCurrY += 1; | 66 fCurrY += 1; |
67 if (fCurrY >= 4) { | 67 if (fCurrY >= 3) { |
68 fDone = true; | 68 fDone = true; |
69 } | 69 } |
70 } | 70 } |
71 return true; | 71 return true; |
72 } | 72 } |
OLD | NEW |