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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 path.addOval(oval); | 200 path.addOval(oval); |
201 this->onDrawPath(path, paint); | 201 this->onDrawPath(path, paint); |
202 } | 202 } |
203 | 203 |
204 void Client::onDrawRect(const SkRect& rect, const SkPaint& paint) { | 204 void Client::onDrawRect(const SkRect& rect, const SkPaint& paint) { |
205 SkPath path; | 205 SkPath path; |
206 path.addRect(rect); | 206 path.addRect(rect); |
207 this->onDrawPath(path, paint); | 207 this->onDrawPath(path, paint); |
208 } | 208 } |
209 | 209 |
| 210 void Client::onDrawDRRect(const SkRRect& outside, |
| 211 const SkRRect& inside, |
| 212 const SkPaint& paint) { |
| 213 SkPath path; |
| 214 path.addRRect(outside); |
| 215 path.addRRect(inside, SkPath::kCCW_Direction); |
| 216 this->onDrawPath(path, paint); |
| 217 } |
| 218 |
210 void Client::onDrawPath(const SkPath& path, const SkPaint& paint) { | 219 void Client::onDrawPath(const SkPath& path, const SkPaint& paint) { |
211 LookupScope ls(fCache, fEncoder); | 220 LookupScope ls(fCache, fEncoder); |
212 ID p = ls.lookup(path), | 221 ID p = ls.lookup(path), |
213 m = ls.lookup(Misc::CreateFrom(paint)); | 222 m = ls.lookup(Misc::CreateFrom(paint)); |
214 | 223 |
215 if (paint.getStyle() == SkPaint::kFill_Style) { | 224 if (paint.getStyle() == SkPaint::kFill_Style) { |
216 fEncoder->fillPath(p, m); | 225 fEncoder->fillPath(p, m); |
217 } else { | 226 } else { |
218 // TODO: handle kStrokeAndFill_Style | 227 // TODO: handle kStrokeAndFill_Style |
219 fEncoder->strokePath(p, m, ls.lookup(Stroke::CreateFrom(paint))); | 228 fEncoder->strokePath(p, m, ls.lookup(Stroke::CreateFrom(paint))); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 286 } |
278 void Server::strokePath(ID path, ID misc, ID stroke) { | 287 void Server::strokePath(ID path, ID misc, ID stroke) { |
279 SkPaint paint; | 288 SkPaint paint; |
280 paint.setStyle(SkPaint::kStroke_Style); | 289 paint.setStyle(SkPaint::kStroke_Style); |
281 fMisc .find(misc ).applyTo(&paint); | 290 fMisc .find(misc ).applyTo(&paint); |
282 fStroke.find(stroke).applyTo(&paint); | 291 fStroke.find(stroke).applyTo(&paint); |
283 fCanvas->drawPath(fPath.find(path), paint); | 292 fCanvas->drawPath(fPath.find(path), paint); |
284 } | 293 } |
285 | 294 |
286 } // namespace SkRemote | 295 } // namespace SkRemote |
OLD | NEW |