OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "Sk2DPathEffect.h" | 10 #include "Sk2DPathEffect.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 void Sk2DPathEffect::next(const SkPoint& loc, int u, int v, SkPath* dst) const {
} | 66 void Sk2DPathEffect::next(const SkPoint& loc, int u, int v, SkPath* dst) const {
} |
67 void Sk2DPathEffect::end(SkPath* dst) const {} | 67 void Sk2DPathEffect::end(SkPath* dst) const {} |
68 | 68 |
69 /////////////////////////////////////////////////////////////////////////////// | 69 /////////////////////////////////////////////////////////////////////////////// |
70 | 70 |
71 void Sk2DPathEffect::flatten(SkWriteBuffer& buffer) const { | 71 void Sk2DPathEffect::flatten(SkWriteBuffer& buffer) const { |
72 this->INHERITED::flatten(buffer); | 72 this->INHERITED::flatten(buffer); |
73 buffer.writeMatrix(fMatrix); | 73 buffer.writeMatrix(fMatrix); |
74 } | 74 } |
75 | 75 |
| 76 #ifndef SK_IGNORE_TO_STRING |
| 77 void Sk2DPathEffect::toString(SkString* str) const { |
| 78 str->appendf("(matrix: %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f)", |
| 79 fMatrix[SkMatrix::kMScaleX], fMatrix[SkMatrix::kMSkewX], fMatrix[Sk
Matrix::kMTransX], |
| 80 fMatrix[SkMatrix::kMSkewY], fMatrix[SkMatrix::kMScaleY], fMatrix[Sk
Matrix::kMTransY], |
| 81 fMatrix[SkMatrix::kMPersp0], fMatrix[SkMatrix::kMPersp1], fMatrix[Sk
Matrix::kMPersp2]); |
| 82 } |
| 83 #endif |
| 84 |
76 /////////////////////////////////////////////////////////////////////////////// | 85 /////////////////////////////////////////////////////////////////////////////// |
77 | 86 |
78 bool SkLine2DPathEffect::filterPath(SkPath* dst, const SkPath& src, | 87 bool SkLine2DPathEffect::filterPath(SkPath* dst, const SkPath& src, |
79 SkStrokeRec* rec, const SkRect* cullRect) const { | 88 SkStrokeRec* rec, const SkRect* cullRect) const { |
80 if (this->INHERITED::filterPath(dst, src, rec, cullRect)) { | 89 if (this->INHERITED::filterPath(dst, src, rec, cullRect)) { |
81 rec->setStrokeStyle(fWidth); | 90 rec->setStrokeStyle(fWidth); |
82 return true; | 91 return true; |
83 } | 92 } |
84 return false; | 93 return false; |
85 } | 94 } |
(...skipping 16 matching lines...) Expand all Loading... |
102 buffer.readMatrix(&matrix); | 111 buffer.readMatrix(&matrix); |
103 SkScalar width = buffer.readScalar(); | 112 SkScalar width = buffer.readScalar(); |
104 return SkLine2DPathEffect::Create(width, matrix); | 113 return SkLine2DPathEffect::Create(width, matrix); |
105 } | 114 } |
106 | 115 |
107 void SkLine2DPathEffect::flatten(SkWriteBuffer &buffer) const { | 116 void SkLine2DPathEffect::flatten(SkWriteBuffer &buffer) const { |
108 buffer.writeMatrix(this->getMatrix()); | 117 buffer.writeMatrix(this->getMatrix()); |
109 buffer.writeScalar(fWidth); | 118 buffer.writeScalar(fWidth); |
110 } | 119 } |
111 | 120 |
| 121 |
| 122 #ifndef SK_IGNORE_TO_STRING |
| 123 void SkLine2DPathEffect::toString(SkString* str) const { |
| 124 str->appendf("SkLine2DPathEffect: ("); |
| 125 this->INHERITED::toString(str); |
| 126 str->appendf("width: %f", fWidth); |
| 127 str->appendf(")"); |
| 128 } |
| 129 #endif |
| 130 |
112 /////////////////////////////////////////////////////////////////////////////// | 131 /////////////////////////////////////////////////////////////////////////////// |
113 | 132 |
114 SkPath2DPathEffect::SkPath2DPathEffect(const SkMatrix& m, const SkPath& p) | 133 SkPath2DPathEffect::SkPath2DPathEffect(const SkMatrix& m, const SkPath& p) |
115 : INHERITED(m), fPath(p) { | 134 : INHERITED(m), fPath(p) { |
116 } | 135 } |
117 | 136 |
118 SkFlattenable* SkPath2DPathEffect::CreateProc(SkReadBuffer& buffer) { | 137 SkFlattenable* SkPath2DPathEffect::CreateProc(SkReadBuffer& buffer) { |
119 SkMatrix matrix; | 138 SkMatrix matrix; |
120 buffer.readMatrix(&matrix); | 139 buffer.readMatrix(&matrix); |
121 SkPath path; | 140 SkPath path; |
122 buffer.readPath(&path); | 141 buffer.readPath(&path); |
123 return SkPath2DPathEffect::Create(matrix, path); | 142 return SkPath2DPathEffect::Create(matrix, path); |
124 } | 143 } |
125 | 144 |
126 void SkPath2DPathEffect::flatten(SkWriteBuffer& buffer) const { | 145 void SkPath2DPathEffect::flatten(SkWriteBuffer& buffer) const { |
127 buffer.writeMatrix(this->getMatrix()); | 146 buffer.writeMatrix(this->getMatrix()); |
128 buffer.writePath(fPath); | 147 buffer.writePath(fPath); |
129 } | 148 } |
130 | 149 |
131 void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v, | 150 void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v, |
132 SkPath* dst) const { | 151 SkPath* dst) const { |
133 dst->addPath(fPath, loc.fX, loc.fY); | 152 dst->addPath(fPath, loc.fX, loc.fY); |
134 } | 153 } |
| 154 |
| 155 #ifndef SK_IGNORE_TO_STRING |
| 156 void SkPath2DPathEffect::toString(SkString* str) const { |
| 157 str->appendf("SkPath2DPathEffect: ("); |
| 158 this->INHERITED::toString(str); |
| 159 // TODO: print out path information |
| 160 str->appendf(")"); |
| 161 } |
| 162 #endif |
OLD | NEW |