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

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

Issue 2349143002: [SVGDom] Only apply opacity when needed (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | 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 "SkSVGNode.h" 10 #include "SkSVGNode.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 ApplyLazyInheritedAttribute(Stroke); 260 ApplyLazyInheritedAttribute(Stroke);
261 ApplyLazyInheritedAttribute(StrokeLineCap); 261 ApplyLazyInheritedAttribute(StrokeLineCap);
262 ApplyLazyInheritedAttribute(StrokeLineJoin); 262 ApplyLazyInheritedAttribute(StrokeLineJoin);
263 ApplyLazyInheritedAttribute(StrokeOpacity); 263 ApplyLazyInheritedAttribute(StrokeOpacity);
264 ApplyLazyInheritedAttribute(StrokeWidth); 264 ApplyLazyInheritedAttribute(StrokeWidth);
265 265
266 #undef ApplyLazyInheritedAttribute 266 #undef ApplyLazyInheritedAttribute
267 267
268 // Uninherited attributes. Only apply to the current context. 268 // Uninherited attributes. Only apply to the current context.
269 269
270 if (auto* opacity = attrs.fOpacity.getMaybeNull()) { 270 auto* opacity = attrs.fOpacity.getMaybeNull();
271 if (opacity && opacity->value() < 1) {
reed1 2016/09/19 12:47:38 // How is the restore conditionally execute, balan
f(malita) 2016/09/19 13:08:30 Comment a few lines below: // Balanced in the des
271 SkPaint opacityPaint; 272 SkPaint opacityPaint;
272 opacityPaint.setAlpha(opacity_to_alpha(opacity->value())); 273 opacityPaint.setAlpha(opacity_to_alpha(opacity->value()));
273 // Balanced in the destructor, via restoreToCount(). 274 // Balanced in the destructor, via restoreToCount().
274 fCanvas->saveLayer(nullptr, &opacityPaint); 275 fCanvas->saveLayer(nullptr, &opacityPaint);
275 } 276 }
276 } 277 }
277 278
278 const SkPaint* SkSVGRenderContext::fillPaint() const { 279 const SkPaint* SkSVGRenderContext::fillPaint() const {
279 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fFill.ge t()->type(); 280 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fFill.ge t()->type();
280 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fFillPa int : nullptr; 281 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fFillPa int : nullptr;
281 } 282 }
282 283
283 const SkPaint* SkSVGRenderContext::strokePaint() const { 284 const SkPaint* SkSVGRenderContext::strokePaint() const {
284 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fStroke. get()->type(); 285 const SkSVGPaint::Type paintType = fPresentationContext->fInherited.fStroke. get()->type();
285 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fStroke Paint : nullptr; 286 return paintType != SkSVGPaint::Type::kNone ? &fPresentationContext->fStroke Paint : nullptr;
286 } 287 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698