OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkParsePaint.h" | 8 #include "SkParsePaint.h" |
9 #include "SkTSearch.h" | 9 #include "SkTSearch.h" |
10 #include "SkParse.h" | 10 #include "SkParse.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 { | 89 { |
90 SkColor c = paint->getColor(); | 90 SkColor c = paint->getColor(); |
91 if (SkParse::FindColor(str, &c)) | 91 if (SkParse::FindColor(str, &c)) |
92 paint->setColor(c); | 92 paint->setColor(c); |
93 } | 93 } |
94 | 94 |
95 // do this AFTER parsing for the color | 95 // do this AFTER parsing for the color |
96 if (dom.findScalar(node, "opacity", &x)) | 96 if (dom.findScalar(node, "opacity", &x)) |
97 { | 97 { |
98 x = SkMaxScalar(0, SkMinScalar(x, SK_Scalar1)); | 98 x = SkMaxScalar(0, SkMinScalar(x, SK_Scalar1)); |
99 paint->setAlpha(SkScalarRound(x * 255)); | 99 paint->setAlpha(SkScalarRoundToInt(x * 255)); |
100 } | 100 } |
101 | 101 |
102 int index = dom.findList(node, "text-anchor", "left,center,right"); | 102 int index = dom.findList(node, "text-anchor", "left,center,right"); |
103 if (index >= 0) | 103 if (index >= 0) |
104 paint->setTextAlign((SkPaint::Align)index); | 104 paint->setTextAlign((SkPaint::Align)index); |
105 | 105 |
106 SkShader* shader = inflate_shader(dom, node); | 106 SkShader* shader = inflate_shader(dom, node); |
107 if (shader) | 107 if (shader) |
108 paint->setShader(shader)->unref(); | 108 paint->setShader(shader)->unref(); |
109 } | 109 } |
OLD | NEW |