OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkSVGAttribute.h" | 9 #include "SkSVGAttribute.h" |
10 #include "SkSVGRenderContext.h" | 10 #include "SkSVGRenderContext.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 | 217 |
218 ApplyLazyInheritedAttribute(Fill); | 218 ApplyLazyInheritedAttribute(Fill); |
219 ApplyLazyInheritedAttribute(FillOpacity); | 219 ApplyLazyInheritedAttribute(FillOpacity); |
220 ApplyLazyInheritedAttribute(Stroke); | 220 ApplyLazyInheritedAttribute(Stroke); |
221 ApplyLazyInheritedAttribute(StrokeLineCap); | 221 ApplyLazyInheritedAttribute(StrokeLineCap); |
222 ApplyLazyInheritedAttribute(StrokeLineJoin); | 222 ApplyLazyInheritedAttribute(StrokeLineJoin); |
223 ApplyLazyInheritedAttribute(StrokeOpacity); | 223 ApplyLazyInheritedAttribute(StrokeOpacity); |
224 ApplyLazyInheritedAttribute(StrokeWidth); | 224 ApplyLazyInheritedAttribute(StrokeWidth); |
225 | 225 |
226 #undef ApplyLazyInheritedAttribute | 226 #undef ApplyLazyInheritedAttribute |
227 | |
228 // Uninherited attributes. Only apply to the current context. | |
229 | |
230 if (auto* opacity = attrs.fOpacity.getMaybeNull()) { | |
231 SkPaint opacityPaint; | |
232 opacityPaint.setAlpha(static_cast<uint8_t>(opacity->value() * 255)); | |
233 fCanvas->saveLayer(nullptr, &opacityPaint); | |
robertphillips
2016/08/15 17:31:27
Where is the matching restore ?
f(malita)
2016/08/15 17:33:58
SkSVGRenderContext is node-scoped and always resto
robertphillips
2016/08/15 17:37:54
Ah - okay. Can you add that as a comment? It wasn'
f(malita)
2016/08/15 17:41:22
Done.
| |
234 } | |
227 } | 235 } |
228 | 236 |
229 const SkPaint* SkSVGRenderContext::fillPaint() const { | 237 const SkPaint* SkSVGRenderContext::fillPaint() const { |
230 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fFill.ge t()->type(); | 238 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fFill.ge t()->type(); |
231 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fFillPa int : nullptr; | 239 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fFillPa int : nullptr; |
232 } | 240 } |
233 | 241 |
234 const SkPaint* SkSVGRenderContext::strokePaint() const { | 242 const SkPaint* SkSVGRenderContext::strokePaint() const { |
235 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fStroke. get()->type(); | 243 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fStroke. get()->type(); |
236 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fStroke Paint : nullptr; | 244 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fStroke Paint : nullptr; |
237 } | 245 } |
OLD | NEW |