OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "SkSVGRenderContext.h" |
| 9 |
| 10 SkSVGRenderContext::SkSVGRenderContext() { } |
| 11 |
| 12 SkSVGRenderContext& SkSVGRenderContext::operator=(const SkSVGRenderContext& othe
r) { |
| 13 if (other.fFill.isValid()) { |
| 14 fFill.set(*other.fFill.get()); |
| 15 } else { |
| 16 fFill.reset(); |
| 17 } |
| 18 |
| 19 if (other.fStroke.isValid()) { |
| 20 fStroke.set(*other.fStroke.get()); |
| 21 } else { |
| 22 fStroke.reset(); |
| 23 } |
| 24 |
| 25 return *this; |
| 26 } |
| 27 |
| 28 SkPaint& SkSVGRenderContext::ensureFill() { |
| 29 if (!fFill.isValid()) { |
| 30 fFill.init(); |
| 31 fFill.get()->setStyle(SkPaint::kFill_Style); |
| 32 fFill.get()->setAntiAlias(true); |
| 33 } |
| 34 return *fFill.get(); |
| 35 } |
| 36 |
| 37 SkPaint& SkSVGRenderContext::ensureStroke() { |
| 38 if (!fStroke.isValid()) { |
| 39 fStroke.init(); |
| 40 fStroke.get()->setStyle(SkPaint::kStroke_Style); |
| 41 fStroke.get()->setAntiAlias(true); |
| 42 } |
| 43 return *fStroke.get(); |
| 44 } |
| 45 |
| 46 void SkSVGRenderContext::setFillColor(SkColor color) { |
| 47 this->ensureFill().setColor(color); |
| 48 } |
| 49 |
| 50 void SkSVGRenderContext::setStrokeColor(SkColor color) { |
| 51 this->ensureStroke().setColor(color); |
| 52 } |
OLD | NEW |