[svg] Cleanup: drop the presentation attribute SkPaint cache

Instead of attempting to keep fill & stroke SkPaints synchronized with
the current presentation attributes throughout the DAG walk, build the
SkPaints on the fly, only when needed.

This simplifies presentation attribute handling and enables further
/future refactoring.

Change-Id: I3791b4244530644e7e4b983d93b3c966ea7a1b22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355096
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
diff --git a/modules/svg/src/SkSVGShape.cpp b/modules/svg/src/SkSVGShape.cpp
index 327acfd..617d8f7 100644
--- a/modules/svg/src/SkSVGShape.cpp
+++ b/modules/svg/src/SkSVGShape.cpp
@@ -13,12 +13,15 @@
 void SkSVGShape::onRender(const SkSVGRenderContext& ctx) const {
     const auto fillType = ctx.presentationContext().fInherited.fFillRule->asFillType();
 
+    const auto fillPaint = ctx.fillPaint(),
+             strokePaint = ctx.strokePaint();
+
     // TODO: this approach forces duplicate geometry resolution in onDraw(); refactor to avoid.
-    if (const SkPaint* fillPaint = ctx.fillPaint()) {
+    if (fillPaint.isValid()) {
         this->onDraw(ctx.canvas(), ctx.lengthContext(), *fillPaint, fillType);
     }
 
-    if (const SkPaint* strokePaint = ctx.strokePaint()) {
+    if (strokePaint.isValid()) {
         this->onDraw(ctx.canvas(), ctx.lengthContext(), *strokePaint, fillType);
     }
 }