Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: src/core/SkNinePatchIter.cpp

Issue 1451183004: fix ninepatch iter from generating invalid rects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tidy Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698