| 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 #ifndef SkNinePatchIter_DEFINED | 8 #ifndef SkNinePatchIter_DEFINED |
| 9 #define SkNinePatchIter_DEFINED | 9 #define SkNinePatchIter_DEFINED |
| 10 | 10 |
| 11 #include "SkCanvas.h" |
| 11 #include "SkScalar.h" | 12 #include "SkScalar.h" |
| 13 #include "SkTArray.h" |
| 12 | 14 |
| 13 struct SkIRect; | 15 struct SkIRect; |
| 14 struct SkRect; | 16 struct SkRect; |
| 15 | 17 |
| 16 /** | 18 /** |
| 17 * Disect a ninepatch request into an sequence of src-rect / dst-rect pairs | 19 * Disect a ninepatch request into an sequence of src-rect / dst-rect pairs |
| 18 */ | 20 */ |
| 19 class SkNinePatchIter { | 21 class SkNinePatchIter { |
| 20 public: | 22 public: |
| 23 |
| 24 static bool Valid(int imageWidth, int imageHeight, const SkCanvas::NinePatch
Divs& divs); |
| 25 |
| 26 SkNinePatchIter(int imageWidth, int imageHeight, const SkCanvas::NinePatchDi
vs& divs, |
| 27 const SkRect& dst); |
| 28 |
| 21 static bool Valid(int imageWidth, int imageHeight, const SkIRect& center); | 29 static bool Valid(int imageWidth, int imageHeight, const SkIRect& center); |
| 22 | 30 |
| 23 SkNinePatchIter(int imageWidth, int imageHeight, const SkIRect& center, cons
t SkRect& dst); | 31 SkNinePatchIter(int imageWidth, int imageHeight, const SkIRect& center, cons
t SkRect& dst); |
| 24 | 32 |
| 25 /** | 33 /** |
| 26 * While it returns true, use src/dst to draw the image/bitmap | 34 * While it returns true, use src/dst to draw the image/bitmap |
| 27 */ | 35 */ |
| 28 bool next(SkRect* src, SkRect* dst); | 36 bool next(SkRect* src, SkRect* dst); |
| 29 | 37 |
| 30 private: | 38 private: |
| 31 SkScalar fSrcX[4]; | 39 SkTArray<SkScalar> fSrcX; |
| 32 SkScalar fSrcY[4]; | 40 SkTArray<SkScalar> fSrcY; |
| 33 SkScalar fDstX[4]; | 41 SkTArray<SkScalar> fDstX; |
| 34 SkScalar fDstY[4]; | 42 SkTArray<SkScalar> fDstY; |
| 35 | 43 |
| 36 int fCurrX; | 44 int fCurrX; |
| 37 int fCurrY; | 45 int fCurrY; |
| 38 bool fDone; | 46 bool fDone; |
| 39 }; | 47 }; |
| 40 | 48 |
| 41 #endif | 49 #endif |
| OLD | NEW |