| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 if (paint.getStyle() == SkPaint::kFill_Style) { | 230 if (paint.getStyle() == SkPaint::kFill_Style) { |
| 231 fEncoder->fillPath(p, m); | 231 fEncoder->fillPath(p, m); |
| 232 } else { | 232 } else { |
| 233 // TODO: handle kStrokeAndFill_Style | 233 // TODO: handle kStrokeAndFill_Style |
| 234 fEncoder->strokePath(p, m, ls.lookup(Stroke::CreateFrom(paint))); | 234 fEncoder->strokePath(p, m, ls.lookup(Stroke::CreateFrom(paint))); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 void Client::onDrawPaint(const SkPaint& paint) { | 238 void Client::onDrawPaint(const SkPaint& paint) { |
| 239 this->onDrawRect(SkRect::MakeLargest(), paint); | 239 SkPath path; |
| 240 path.setFillType(SkPath::kInverseWinding_FillType); // Either inverse F
illType works fine. |
| 241 this->onDrawPath(path, paint); |
| 240 } | 242 } |
| 241 | 243 |
| 242 void Client::onDrawText(const void* text, size_t byteLength, SkScalar x, | 244 void Client::onDrawText(const void* text, size_t byteLength, SkScalar x, |
| 243 SkScalar y, const SkPaint& paint) { | 245 SkScalar y, const SkPaint& paint) { |
| 244 // Text-as-paths is a temporary hack. | 246 // Text-as-paths is a temporary hack. |
| 245 // TODO: send SkTextBlobs and SkTypefaces | 247 // TODO: send SkTextBlobs and SkTypefaces |
| 246 SkPath path; | 248 SkPath path; |
| 247 paint.getTextPath(text, byteLength, x, y, &path); | 249 paint.getTextPath(text, byteLength, x, y, &path); |
| 248 this->onDrawPath(path, paint); | 250 this->onDrawPath(path, paint); |
| 249 } | 251 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 } | 323 } |
| 322 void Server::strokePath(ID path, ID misc, ID stroke) { | 324 void Server::strokePath(ID path, ID misc, ID stroke) { |
| 323 SkPaint paint; | 325 SkPaint paint; |
| 324 paint.setStyle(SkPaint::kStroke_Style); | 326 paint.setStyle(SkPaint::kStroke_Style); |
| 325 fMisc .find(misc ).applyTo(&paint); | 327 fMisc .find(misc ).applyTo(&paint); |
| 326 fStroke.find(stroke).applyTo(&paint); | 328 fStroke.find(stroke).applyTo(&paint); |
| 327 fCanvas->drawPath(fPath.find(path), paint); | 329 fCanvas->drawPath(fPath.find(path), paint); |
| 328 } | 330 } |
| 329 | 331 |
| 330 } // namespace SkRemote | 332 } // namespace SkRemote |
| OLD | NEW |