blob: d64195b0cbb9f576b29e7b36a8acb8b38bfab655 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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.com8a1c16f2008-12-17 15:59:43 +00009
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
18class SkDrawPath : public SkBoundable {
19 DECLARE_DRAW_MEMBER_INFO(Path);
20 SkDrawPath();
21 virtual ~SkDrawPath();
mtklein72c9faa2015-01-09 10:06:39 -080022 bool addChild(SkAnimateMaker& , SkDisplayable* child) SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000023 bool childHasID() { return SkToBool(fChildHasID); }
mtklein72c9faa2015-01-09 10:06:39 -080024 bool childrenNeedDisposing() const SK_OVERRIDE;
25 void dirty() SK_OVERRIDE;
26 bool draw(SkAnimateMaker& ) SK_OVERRIDE;
27 SkDisplayable* getParent() const SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000028#ifdef SK_DUMP_ENABLED
mtklein72c9faa2015-01-09 10:06:39 -080029 void dump(SkAnimateMaker* ) SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000030#endif
31 SkPath& getPath();
mtklein72c9faa2015-01-09 10:06:39 -080032 bool getProperty(int index, SkScriptValue* value) const SK_OVERRIDE;
33 bool setProperty(int index, SkScriptValue& value) SK_OVERRIDE;
34 void onEndElement(SkAnimateMaker& ) SK_OVERRIDE;
35 void setChildHasID() SK_OVERRIDE;
36 bool setParent(SkDisplayable* parent) SK_OVERRIDE;
37 bool isPath() const SK_OVERRIDE { return true; }
reed@android.com8a1c16f2008-12-17 15:59:43 +000038public:
39 SkPath fPath;
40protected:
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;
48private:
49 typedef SkBoundable INHERITED;
50};
51
52class SkPolyline : public SkDrawPath {
53 DECLARE_MEMBER_INFO(Polyline);
mtklein72c9faa2015-01-09 10:06:39 -080054 bool addChild(SkAnimateMaker& , SkDisplayable*) SK_OVERRIDE;
55 void onEndElement(SkAnimateMaker& ) SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000056protected:
57 SkTDScalarArray points;
58private:
59 typedef SkDrawPath INHERITED;
60};
61
62class SkPolygon : public SkPolyline {
63 DECLARE_MEMBER_INFO(Polygon);
mtklein72c9faa2015-01-09 10:06:39 -080064 void onEndElement(SkAnimateMaker& ) SK_OVERRIDE;
reed@android.com8a1c16f2008-12-17 15:59:43 +000065private:
66 typedef SkPolyline INHERITED;
67};
68
69#endif // SkDrawPath_DEFINED