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

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

Issue 2246943002: [SVGDom] Add opacity support (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: pic/serialize blacklist 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/SkSVGNode.cpp ('k') | infra/bots/recipes/swarm_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Balanced in the destructor, via restoreToCount().
234 fCanvas->saveLayer(nullptr, &opacityPaint);
235 }
227 } 236 }
228 237
229 const SkPaint* SkSVGRenderContext::fillPaint() const { 238 const SkPaint* SkSVGRenderContext::fillPaint() const {
230 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fFill.ge t()->type(); 239 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fFill.ge t()->type();
231 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fFillPa int : nullptr; 240 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fFillPa int : nullptr;
232 } 241 }
233 242
234 const SkPaint* SkSVGRenderContext::strokePaint() const { 243 const SkPaint* SkSVGRenderContext::strokePaint() const {
235 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fStroke. get()->type(); 244 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fStroke. get()->type();
236 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fStroke Paint : nullptr; 245 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fStroke Paint : nullptr;
237 } 246 }
OLDNEW
« no previous file with comments | « experimental/svg/model/SkSVGNode.cpp ('k') | infra/bots/recipes/swarm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698