epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2006 The Android Open Source Project |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 9 | |
| 10 | #ifndef SkDrawPath_DEFINED |
| 11 | #define SkDrawPath_DEFINED |
| 12 | |
| 13 | #include "SkBoundable.h" |
| 14 | #include "SkIntArray.h" |
| 15 | #include "SkMemberInfo.h" |
| 16 | #include "SkPath.h" |
| 17 | |
| 18 | class SkDrawPath : public SkBoundable { |
| 19 | DECLARE_DRAW_MEMBER_INFO(Path); |
| 20 | SkDrawPath(); |
| 21 | virtual ~SkDrawPath(); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 22 | bool addChild(SkAnimateMaker& , SkDisplayable* child) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 23 | bool childHasID() { return SkToBool(fChildHasID); } |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 24 | bool childrenNeedDisposing() const override; |
| 25 | void dirty() override; |
| 26 | bool draw(SkAnimateMaker& ) override; |
| 27 | SkDisplayable* getParent() const override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 28 | #ifdef SK_DUMP_ENABLED |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 29 | void dump(SkAnimateMaker* ) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 30 | #endif |
| 31 | SkPath& getPath(); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 32 | bool getProperty(int index, SkScriptValue* value) const override; |
| 33 | bool setProperty(int index, SkScriptValue& value) override; |
| 34 | void onEndElement(SkAnimateMaker& ) override; |
| 35 | void setChildHasID() override; |
| 36 | bool setParent(SkDisplayable* parent) override; |
| 37 | bool isPath() const override { return true; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 38 | public: |
| 39 | SkPath fPath; |
| 40 | protected: |
| 41 | void parseSVG(); |
| 42 | SkString d; |
| 43 | SkTDPathPartArray fParts; |
| 44 | mutable SkScalar fLength; |
| 45 | SkDisplayable* fParent; // SkPolyToPoly or SkFromPath, for instance |
| 46 | SkBool8 fChildHasID; |
| 47 | SkBool8 fDirty; |
| 48 | private: |
| 49 | typedef SkBoundable INHERITED; |
| 50 | }; |
| 51 | |
| 52 | class SkPolyline : public SkDrawPath { |
| 53 | DECLARE_MEMBER_INFO(Polyline); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 54 | bool addChild(SkAnimateMaker& , SkDisplayable*) override; |
| 55 | void onEndElement(SkAnimateMaker& ) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 56 | protected: |
| 57 | SkTDScalarArray points; |
| 58 | private: |
| 59 | typedef SkDrawPath INHERITED; |
| 60 | }; |
| 61 | |
| 62 | class SkPolygon : public SkPolyline { |
| 63 | DECLARE_MEMBER_INFO(Polygon); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 64 | void onEndElement(SkAnimateMaker& ) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 65 | private: |
| 66 | typedef SkPolyline INHERITED; |
| 67 | }; |
| 68 | |
| 69 | #endif // SkDrawPath_DEFINED |