OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 #include "SkPath.h" | 8 #include "SkPath.h" |
9 #include "SkRect.h" | 9 #include "SkRect.h" |
10 #include "SkRemote.h" | 10 #include "SkRemote.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 ID p = ls.lookup(path), | 199 ID p = ls.lookup(path), |
200 m = ls.lookup(Misc::CreateFrom(paint)); | 200 m = ls.lookup(Misc::CreateFrom(paint)); |
201 | 201 |
202 if (paint.getStyle() == SkPaint::kFill_Style) { | 202 if (paint.getStyle() == SkPaint::kFill_Style) { |
203 fEncoder->fillPath(p, m); | 203 fEncoder->fillPath(p, m); |
204 } else { | 204 } else { |
205 // TODO: handle kStrokeAndFill_Style | 205 // TODO: handle kStrokeAndFill_Style |
206 fEncoder->strokePath(p, m, ls.lookup(Stroke::CreateFrom(paint))); | 206 fEncoder->strokePath(p, m, ls.lookup(Stroke::CreateFrom(paint))); |
207 } | 207 } |
208 } | 208 } |
209 | 209 |
mtklein
2015/10/17 12:57:45
//Text-as-paths is a temporary hack.
//TODO: send
hal.canary
2015/10/17 22:37:08
Done.
| |
210 void Client::onDrawText(const void* text, size_t byteLength, SkScalar x, | |
211 SkScalar y, const SkPaint& paint) { | |
212 SkPath path; | |
213 paint.getTextPath(text, byteLength, x, y, &path); | |
214 this->onDrawPath(path, paint); | |
215 } | |
216 | |
217 void Client::onDrawPosText(const void* text, size_t byteLength, | |
218 const SkPoint pos[], const SkPaint& paint) { | |
219 SkPath path; | |
220 paint.getPosTextPath(text, byteLength, pos, &path); | |
221 this->onDrawPath(path, paint); | |
222 } | |
223 | |
224 void Client::onDrawPosTextH(const void* text, size_t byteLength, | |
225 const SkScalar xpos[], SkScalar constY, | |
226 const SkPaint& paint) { | |
227 size_t length = paint.countText(text, byteLength); | |
228 SkAutoTArray<SkPoint> pos(length); | |
229 for(size_t i = 0; i < length; ++i) { | |
230 pos[i].set(xpos[i], constY); | |
231 } | |
232 this->onDrawPosText(text, byteLength, &pos[0], paint); | |
233 } | |
234 | |
210 void Client::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle) { | 235 void Client::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e dgeStyle) { |
211 SkPath path; | 236 SkPath path; |
212 path.addRect(rect); | 237 path.addRect(rect); |
213 this->onClipPath(path, op, edgeStyle); | 238 this->onClipPath(path, op, edgeStyle); |
214 } | 239 } |
215 | 240 |
216 void Client::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle) { | 241 void Client::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e edgeStyle) { |
217 SkPath path; | 242 SkPath path; |
218 path.addRRect(rrect); | 243 path.addRRect(rrect); |
219 this->onClipPath(path, op, edgeStyle); | 244 this->onClipPath(path, op, edgeStyle); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 } | 285 } |
261 void Server::strokePath(ID path, ID misc, ID stroke) { | 286 void Server::strokePath(ID path, ID misc, ID stroke) { |
262 SkPaint paint; | 287 SkPaint paint; |
263 paint.setStyle(SkPaint::kStroke_Style); | 288 paint.setStyle(SkPaint::kStroke_Style); |
264 fMisc .find(misc ).applyTo(&paint); | 289 fMisc .find(misc ).applyTo(&paint); |
265 fStroke.find(stroke).applyTo(&paint); | 290 fStroke.find(stroke).applyTo(&paint); |
266 fCanvas->drawPath(fPath.find(path), paint); | 291 fCanvas->drawPath(fPath.find(path), paint); |
267 } | 292 } |
268 | 293 |
269 } // namespace SkRemote | 294 } // namespace SkRemote |
OLD | NEW |