• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
9 
10 #ifndef SkMatrixParts_DEFINED
11 #define SkMatrixParts_DEFINED
12 
13 #include "SkDisplayable.h"
14 #include "SkMemberInfo.h"
15 #include "SkPathMeasure.h"
16 
17 class SkDrawPath;
18 class SkDrawRect;
19 class SkPolygon;
20 
21 class SkDrawMatrix;
22 // class SkMatrix;
23 
24 class SkMatrixPart : public SkDisplayable {
25 public:
26     SkMatrixPart();
27     virtual bool add() = 0;
28     virtual void dirty();
29     virtual SkDisplayable* getParent() const;
30     virtual bool setParent(SkDisplayable* parent);
31 #ifdef SK_DEBUG
isMatrixPart()32     virtual bool isMatrixPart() const { return true; }
33 #endif
34 protected:
35     SkDrawMatrix* fMatrix;
36 };
37 
38 class SkRotate : public SkMatrixPart {
39     DECLARE_MEMBER_INFO(Rotate);
40     SkRotate();
41 protected:
42     bool add() override;
43     SkScalar degrees;
44     SkPoint center;
45 };
46 
47 class SkScale : public SkMatrixPart {
48     DECLARE_MEMBER_INFO(Scale);
49     SkScale();
50 protected:
51     bool add() override;
52     SkScalar x;
53     SkScalar y;
54     SkPoint center;
55 };
56 
57 class SkSkew : public SkMatrixPart {
58     DECLARE_MEMBER_INFO(Skew);
59     SkSkew();
60 protected:
61     bool add() override;
62     SkScalar x;
63     SkScalar y;
64     SkPoint center;
65 };
66 
67 class SkTranslate : public SkMatrixPart {
68     DECLARE_MEMBER_INFO(Translate);
69     SkTranslate();
70 protected:
71     bool add() override;
72     SkScalar x;
73     SkScalar y;
74 };
75 
76 class SkFromPath : public SkMatrixPart {
77     DECLARE_MEMBER_INFO(FromPath);
78     SkFromPath();
79     virtual ~SkFromPath();
80 protected:
81     bool add() override;
82     int32_t mode;
83     SkScalar offset;
84     SkDrawPath* path;
85     SkPathMeasure fPathMeasure;
86 };
87 
88 class SkRectToRect : public SkMatrixPart {
89     DECLARE_MEMBER_INFO(RectToRect);
90     SkRectToRect();
91     virtual ~SkRectToRect();
92 #ifdef SK_DUMP_ENABLED
93     void dump(SkAnimateMaker* ) override;
94 #endif
95     const SkMemberInfo* preferredChild(SkDisplayTypes type) override;
96 protected:
97     bool add() override;
98     SkDrawRect* source;
99     SkDrawRect* destination;
100 };
101 
102 class SkPolyToPoly : public SkMatrixPart {
103     DECLARE_MEMBER_INFO(PolyToPoly);
104     SkPolyToPoly();
105     virtual ~SkPolyToPoly();
106 #ifdef SK_DUMP_ENABLED
107     void dump(SkAnimateMaker* ) override;
108 #endif
109     void onEndElement(SkAnimateMaker& ) override;
110     const SkMemberInfo* preferredChild(SkDisplayTypes type) override;
111 protected:
112     bool add() override;
113     SkPolygon* source;
114     SkPolygon* destination;
115 };
116 
117 // !!! add concat matrix ?
118 
119 #endif // SkMatrixParts_DEFINED
120