1 /* 2 * Copyright 2017 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 "SkSGPaintNode.h" 9 10 namespace sksg { 11 12 // Paint nodes don't generate damage on their own, but via their aggregation ancestor Draw nodes. PaintNode()13PaintNode::PaintNode() : INHERITED(kBubbleDamage_Trait) {} 14 makePaint() const15SkPaint PaintNode::makePaint() const { 16 SkASSERT(!this->hasInval()); 17 18 SkPaint paint; 19 20 paint.setAntiAlias(fAntiAlias); 21 paint.setBlendMode(fBlendMode); 22 paint.setStyle(fStyle); 23 paint.setStrokeWidth(fStrokeWidth); 24 paint.setStrokeMiter(fStrokeMiter); 25 paint.setStrokeJoin(fStrokeJoin); 26 paint.setStrokeCap(fStrokeCap); 27 28 this->onApplyToPaint(&paint); 29 30 // Compose opacity on top of the subclass value. 31 paint.setAlpha(SkScalarRoundToInt(paint.getAlpha() * SkTPin<SkScalar>(fOpacity, 0, 1))); 32 33 return paint; 34 } 35 onRevalidate(InvalidationController *,const SkMatrix &)36SkRect PaintNode::onRevalidate(InvalidationController*, const SkMatrix&) { 37 SkASSERT(this->hasInval()); 38 39 return SkRect::MakeEmpty(); 40 } 41 42 } // namespace sksg 43