epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
reed@android.com | f76bacf | 2009-05-13 14:00:33 +0000 | [diff] [blame] | 8 | #ifndef SkRectShape_DEFINED |
| 9 | #define SkRectShape_DEFINED |
| 10 | |
| 11 | #include "SkShape.h" |
| 12 | #include "SkPaint.h" |
| 13 | #include "SkSize.h" |
| 14 | |
| 15 | class SkPaintShape : public SkShape { |
| 16 | public: |
| 17 | SkPaintShape(); |
| 18 | |
| 19 | SkPaint& paint() { return fPaint; } |
| 20 | const SkPaint& paint() const { return fPaint; } |
| 21 | |
| 22 | // overrides |
| 23 | virtual void flatten(SkFlattenableWriteBuffer&); |
| 24 | |
| 25 | protected: |
| 26 | SkPaintShape(SkFlattenableReadBuffer& buffer); |
| 27 | |
| 28 | private: |
| 29 | SkPaint fPaint; |
| 30 | |
| 31 | typedef SkShape INHERITED; |
| 32 | }; |
| 33 | |
| 34 | class SkRectShape : public SkPaintShape { |
| 35 | public: |
| 36 | SkRectShape(); |
| 37 | |
| 38 | void setRect(const SkRect&); |
| 39 | void setOval(const SkRect&); |
| 40 | void setCircle(SkScalar x, SkScalar y, SkScalar radius); |
| 41 | void setRRect(const SkRect&, SkScalar rx, SkScalar ry); |
| 42 | |
| 43 | // overrides |
reed@android.com | f76bacf | 2009-05-13 14:00:33 +0000 | [diff] [blame] | 44 | virtual void flatten(SkFlattenableWriteBuffer&); |
| 45 | |
djsollen@google.com | ba28d03 | 2012-03-26 17:57:35 +0000 | [diff] [blame] | 46 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRectShape) |
reed@android.com | 0ad336f | 2009-06-29 16:02:20 +0000 | [diff] [blame] | 47 | |
reed@android.com | f76bacf | 2009-05-13 14:00:33 +0000 | [diff] [blame] | 48 | protected: |
| 49 | SkRectShape(SkFlattenableReadBuffer&); |
| 50 | |
| 51 | // overrides |
| 52 | virtual void onDraw(SkCanvas*); |
| 53 | |
| 54 | private: |
| 55 | SkRect fBounds; |
| 56 | SkSize fRadii; |
| 57 | |
reed@android.com | f76bacf | 2009-05-13 14:00:33 +0000 | [diff] [blame] | 58 | typedef SkPaintShape INHERITED; |
| 59 | }; |
| 60 | |
| 61 | #endif |