Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(972)

Side by Side Diff: experimental/svg/model/SkSVGRenderContext.cpp

Issue 2164193002: Initial SVG model (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: warning fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « experimental/svg/model/SkSVGRenderContext.h ('k') | experimental/svg/model/SkSVGSVG.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « experimental/svg/model/SkSVGRenderContext.h ('k') | experimental/svg/model/SkSVGSVG.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698