OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include "Sk2DPathEffect.h" | 9 #include "Sk2DPathEffect.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 void Sk2DPathEffect::begin(const SkIRect& uvBounds, SkPath* dst) const {} | 65 void Sk2DPathEffect::begin(const SkIRect& uvBounds, SkPath* dst) const {} |
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", fMatrix); |
74 } | 74 } |
75 | 75 |
76 #ifndef SK_IGNORE_TO_STRING | 76 #ifndef SK_IGNORE_TO_STRING |
77 void Sk2DPathEffect::toString(SkString* str) const { | 77 void Sk2DPathEffect::toString(SkString* str) const { |
78 str->appendf("(matrix: %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f)", | 78 str->appendf("(matrix: %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f)", |
79 fMatrix[SkMatrix::kMScaleX], fMatrix[SkMatrix::kMSkewX], fMatrix[Sk
Matrix::kMTransX], | 79 fMatrix[SkMatrix::kMScaleX], fMatrix[SkMatrix::kMSkewX], fMatrix[Sk
Matrix::kMTransX], |
80 fMatrix[SkMatrix::kMSkewY], fMatrix[SkMatrix::kMScaleY], fMatrix[Sk
Matrix::kMTransY], | 80 fMatrix[SkMatrix::kMSkewY], fMatrix[SkMatrix::kMScaleY], fMatrix[Sk
Matrix::kMTransY], |
81 fMatrix[SkMatrix::kMPersp0], fMatrix[SkMatrix::kMPersp1], fMatrix[Sk
Matrix::kMPersp2]); | 81 fMatrix[SkMatrix::kMPersp0], fMatrix[SkMatrix::kMPersp1], fMatrix[Sk
Matrix::kMPersp2]); |
82 } | 82 } |
83 #endif | 83 #endif |
(...skipping 23 matching lines...) Expand all Loading... |
107 } | 107 } |
108 | 108 |
109 sk_sp<SkFlattenable> SkLine2DPathEffect::CreateProc(SkReadBuffer& buffer) { | 109 sk_sp<SkFlattenable> SkLine2DPathEffect::CreateProc(SkReadBuffer& buffer) { |
110 SkMatrix matrix; | 110 SkMatrix matrix; |
111 buffer.readMatrix(&matrix); | 111 buffer.readMatrix(&matrix); |
112 SkScalar width = buffer.readScalar(); | 112 SkScalar width = buffer.readScalar(); |
113 return SkLine2DPathEffect::Make(width, matrix); | 113 return SkLine2DPathEffect::Make(width, matrix); |
114 } | 114 } |
115 | 115 |
116 void SkLine2DPathEffect::flatten(SkWriteBuffer &buffer) const { | 116 void SkLine2DPathEffect::flatten(SkWriteBuffer &buffer) const { |
117 buffer.writeMatrix(this->getMatrix()); | 117 buffer.writeMatrix("fMatrix", this->getMatrix()); |
118 buffer.writeScalar(fWidth); | 118 buffer.writeScalar("fWidth", fWidth); |
119 } | 119 } |
120 | 120 |
121 | 121 |
122 #ifndef SK_IGNORE_TO_STRING | 122 #ifndef SK_IGNORE_TO_STRING |
123 void SkLine2DPathEffect::toString(SkString* str) const { | 123 void SkLine2DPathEffect::toString(SkString* str) const { |
124 str->appendf("SkLine2DPathEffect: ("); | 124 str->appendf("SkLine2DPathEffect: ("); |
125 this->INHERITED::toString(str); | 125 this->INHERITED::toString(str); |
126 str->appendf("width: %f", fWidth); | 126 str->appendf("width: %f", fWidth); |
127 str->appendf(")"); | 127 str->appendf(")"); |
128 } | 128 } |
129 #endif | 129 #endif |
130 | 130 |
131 /////////////////////////////////////////////////////////////////////////////// | 131 /////////////////////////////////////////////////////////////////////////////// |
132 | 132 |
133 SkPath2DPathEffect::SkPath2DPathEffect(const SkMatrix& m, const SkPath& p) | 133 SkPath2DPathEffect::SkPath2DPathEffect(const SkMatrix& m, const SkPath& p) |
134 : INHERITED(m), fPath(p) { | 134 : INHERITED(m), fPath(p) { |
135 } | 135 } |
136 | 136 |
137 sk_sp<SkFlattenable> SkPath2DPathEffect::CreateProc(SkReadBuffer& buffer) { | 137 sk_sp<SkFlattenable> SkPath2DPathEffect::CreateProc(SkReadBuffer& buffer) { |
138 SkMatrix matrix; | 138 SkMatrix matrix; |
139 buffer.readMatrix(&matrix); | 139 buffer.readMatrix(&matrix); |
140 SkPath path; | 140 SkPath path; |
141 buffer.readPath(&path); | 141 buffer.readPath(&path); |
142 return SkPath2DPathEffect::Make(matrix, path); | 142 return SkPath2DPathEffect::Make(matrix, path); |
143 } | 143 } |
144 | 144 |
145 void SkPath2DPathEffect::flatten(SkWriteBuffer& buffer) const { | 145 void SkPath2DPathEffect::flatten(SkWriteBuffer& buffer) const { |
146 buffer.writeMatrix(this->getMatrix()); | 146 buffer.writeMatrix("fMatrix", this->getMatrix()); |
147 buffer.writePath(fPath); | 147 buffer.writePath("fPath", fPath); |
148 } | 148 } |
149 | 149 |
150 void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v, | 150 void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v, |
151 SkPath* dst) const { | 151 SkPath* dst) const { |
152 dst->addPath(fPath, loc.fX, loc.fY); | 152 dst->addPath(fPath, loc.fX, loc.fY); |
153 } | 153 } |
154 | 154 |
155 #ifndef SK_IGNORE_TO_STRING | 155 #ifndef SK_IGNORE_TO_STRING |
156 void SkPath2DPathEffect::toString(SkString* str) const { | 156 void SkPath2DPathEffect::toString(SkString* str) const { |
157 str->appendf("SkPath2DPathEffect: ("); | 157 str->appendf("SkPath2DPathEffect: ("); |
158 this->INHERITED::toString(str); | 158 this->INHERITED::toString(str); |
159 // TODO: print out path information | 159 // TODO: print out path information |
160 str->appendf(")"); | 160 str->appendf(")"); |
161 } | 161 } |
162 #endif | 162 #endif |
OLD | NEW |