Chromium Code Reviews| Index: include/core/SkPatch.h |
| diff --git a/include/core/SkPatch.h b/include/core/SkPatch.h |
| index 3e06c3fc91f9ce5bf5df56d2da680f8cefc36068..8e33f1bbe986e96483f3513a644389b8f6a1f2b0 100644 |
| --- a/include/core/SkPatch.h |
| +++ b/include/core/SkPatch.h |
| @@ -77,6 +77,12 @@ public: |
| kBottomLeft_CornerColors |
| }; |
| + enum { |
| + kNumCtrlPts = 12, |
| + kNumColors = 4, |
| + kNumPtsCubic = 4 |
| + }; |
| + |
| /** |
| * Points are in the following order: |
| * (top curve) |
| @@ -86,7 +92,8 @@ public: |
| * 9 8 7 6 |
| * (bottom curve) |
| */ |
| - SkPatch(SkPoint points[12], SkColor colors[4]); |
| + SkPatch() { } |
| + SkPatch(const SkPoint points[12], const SkColor colors[4]); |
| /** |
| * Function that evaluates the coons patch interpolation. |
| @@ -138,9 +145,40 @@ public: |
| return fCornerColors; |
| } |
| + void setPoints(const SkPoint points[12]) { |
| + memcpy(fCtrlPoints, points, kNumCtrlPts * sizeof(SkPoint)); |
|
robertphillips
2014/08/05 15:42:00
extra line here ?
|
| + |
| + } |
| + |
| + void setColors(const SkColor colors[4]) { |
| + memcpy(fCornerColors, colors, kNumColors * sizeof(SkColor)); |
| + } |
| + |
| + void reset(const SkPoint points[12], const SkColor colors[4]) { |
| + this->setPoints(points); |
| + this->setColors(colors); |
| + } |
| + |
| + /** |
| + * Write the patch to the buffer, and return the number of bytes written. |
| + * If buffer is NULL, it still returns the number of bytes. |
| + */ |
| + size_t writeToMemory(void* buffer) const; |
| + |
| + /** |
| + * Initializes the patch from the buffer |
| + * |
| + * buffer Memory to read from |
| + * length Amount of memory available in the buffer |
|
robertphillips
2014/08/05 15:42:00
Should the rest of this comment not be:
* Returns
dandov
2014/08/05 17:34:05
Done. Fixed function to follow the comment.
|
| + * returns the number of bytes read |
| + * number of bytes read (must be a multiple of 4) or |
| + * 0 if there was not enough memory available |
| + */ |
| + size_t readFromMemory(const void* buffer, size_t length); |
| + |
| private: |
| - SkPoint fCtrlPoints[12]; |
| - SkColor fCornerColors[4]; |
| + SkPoint fCtrlPoints[kNumCtrlPts]; |
| + SkColor fCornerColors[kNumColors]; |
| }; |
| #endif |