Chromium Code Reviews| Index: include/core/SkPatch.h |
| diff --git a/include/core/SkPatch.h b/include/core/SkPatch.h |
| index 3e06c3fc91f9ce5bf5df56d2da680f8cefc36068..15fed666770fc251c2ce80ec0cbdc07fdce9cd6e 100644 |
| --- a/include/core/SkPatch.h |
| +++ b/include/core/SkPatch.h |
| @@ -86,7 +86,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,6 +139,40 @@ public: |
| return fCornerColors; |
| } |
| + void setPoints(const SkPoint points[12]) { |
|
robertphillips
2014/08/04 18:44:18
Just memcpy these ?
dandov
2014/08/04 19:59:27
Done.
|
| + for (int i = 0; i < 12; i++) { |
| + fCtrlPoints[i] = points[i]; |
| + } |
| + } |
| + |
| + void setColors(const SkColor colors[4]) { |
|
robertphillips
2014/08/04 18:44:18
These too ?
dandov
2014/08/04 19:59:27
Done.
|
| + fCornerColors[0] = colors[0]; |
| + fCornerColors[1] = colors[1]; |
| + fCornerColors[2] = colors[2]; |
| + fCornerColors[3] = colors[3]; |
| + } |
| + |
| + 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 |
| + * 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]; |