OLD | NEW |
| (Empty) |
1 /* libs/graphics/animator/SkPaintParts.cpp | |
2 ** | |
3 ** Copyright 2006, The Android Open Source Project | |
4 ** | |
5 ** Licensed under the Apache License, Version 2.0 (the "License"); | |
6 ** you may not use this file except in compliance with the License. | |
7 ** You may obtain a copy of the License at | |
8 ** | |
9 ** http://www.apache.org/licenses/LICENSE-2.0 | |
10 ** | |
11 ** Unless required by applicable law or agreed to in writing, software | |
12 ** distributed under the License is distributed on an "AS IS" BASIS, | |
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 ** See the License for the specific language governing permissions and | |
15 ** limitations under the License. | |
16 */ | |
17 | |
18 #include "SkPaintParts.h" | |
19 #include "SkDrawPaint.h" | |
20 #ifdef SK_DUMP_ENABLED | |
21 #include "SkDisplayList.h" | |
22 #include "SkDump.h" | |
23 #endif | |
24 | |
25 SkPaintPart::SkPaintPart() : fPaint(NULL) { | |
26 } | |
27 | |
28 SkDisplayable* SkPaintPart::getParent() const { | |
29 return fPaint; | |
30 } | |
31 | |
32 bool SkPaintPart::setParent(SkDisplayable* parent) { | |
33 SkASSERT(parent != NULL); | |
34 if (parent->isPaint() == false) | |
35 return true; | |
36 fPaint = (SkDrawPaint*) parent; | |
37 return false; | |
38 } | |
39 | |
40 | |
41 // SkDrawMaskFilter | |
42 bool SkDrawMaskFilter::add() { | |
43 if (fPaint->maskFilter != (SkDrawMaskFilter*) -1) | |
44 return true; | |
45 fPaint->maskFilter = this; | |
46 fPaint->fOwnsMaskFilter = true; | |
47 return false; | |
48 } | |
49 | |
50 SkMaskFilter* SkDrawMaskFilter::getMaskFilter() { | |
51 return NULL; | |
52 } | |
53 | |
54 | |
55 // SkDrawPathEffect | |
56 bool SkDrawPathEffect::add() { | |
57 if (fPaint->isPaint()) { | |
58 if (fPaint->pathEffect != (SkDrawPathEffect*) -1) | |
59 return true; | |
60 fPaint->pathEffect = this; | |
61 fPaint->fOwnsPathEffect = true; | |
62 return false; | |
63 } | |
64 fPaint->add(*(SkAnimateMaker*) NULL, this); | |
65 return false; | |
66 } | |
67 | |
68 SkPathEffect* SkDrawPathEffect::getPathEffect() { | |
69 return NULL; | |
70 } | |
71 | |
72 | |
73 // SkDrawShader | |
74 SkShader* SkDrawShader::getShader() { | |
75 return NULL; | |
76 } | |
77 | |
78 | |
79 // Typeface | |
80 #if SK_USE_CONDENSED_INFO == 0 | |
81 | |
82 const SkMemberInfo SkDrawTypeface::fInfo[] = { | |
83 SK_MEMBER(fontName, String), | |
84 SK_MEMBER(style, FontStyle) | |
85 }; | |
86 | |
87 #endif | |
88 | |
89 DEFINE_GET_MEMBER(SkDrawTypeface); | |
90 | |
91 SkDrawTypeface::SkDrawTypeface() : style (SkTypeface::kNormal){ | |
92 } | |
93 | |
94 bool SkDrawTypeface::add() { | |
95 if (fPaint->typeface != (SkDrawTypeface*) -1) | |
96 return true; | |
97 fPaint->typeface = this; | |
98 fPaint->fOwnsTypeface = true; | |
99 return false; | |
100 } | |
101 | |
102 #ifdef SK_DUMP_ENABLED | |
103 void SkDrawTypeface::dump(SkAnimateMaker* maker) { | |
104 SkDebugf("%*s<typeface fontName=\"%s\" ", SkDisplayList::fIndent, "", fontNa
me.c_str()); | |
105 SkString string; | |
106 SkDump::GetEnumString(SkType_FontStyle, style, &string); | |
107 SkDebugf("style=\"%s\" />\n", string.c_str()); | |
108 } | |
109 #endif | |
110 | |
111 | |
OLD | NEW |