skia2/experimental/svg/model/SkSVGPath.cpp
Mike Reed 4241f5e0a8 Revert "add guard to switch to SkPathTypes"
This reverts commit e1af44498b.

Reason for revert: breaking google3?

Original change's description:
> add guard to switch to SkPathTypes
> 
> Change-Id: I44d8b5ae8a5172d11a6d4cd9d994373dd3816d6f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241278
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=robertphillips@google.com,kjlubick@google.com,fmalita@chromium.org,reed@google.com

Change-Id: If1fffb6310921ee6f213af000da793afcf62ab0b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241560
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-09-14 19:13:44 +00:00

42 lines
1.3 KiB
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "experimental/svg/model/SkSVGPath.h"
#include "experimental/svg/model/SkSVGRenderContext.h"
#include "experimental/svg/model/SkSVGValue.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkPaint.h"
SkSVGPath::SkSVGPath() : INHERITED(SkSVGTag::kPath) { }
void SkSVGPath::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) {
switch (attr) {
case SkSVGAttribute::kD:
if (const auto* path = v.as<SkSVGPathValue>()) {
this->setPath(*path);
}
break;
default:
this->INHERITED::onSetAttribute(attr, v);
}
}
void SkSVGPath::onDraw(SkCanvas* canvas, const SkSVGLengthContext&, const SkPaint& paint,
SkPath::FillType fillType) const {
// the passed fillType follows inheritance rules and needs to be applied at draw time.
fPath.setFillType(fillType);
canvas->drawPath(fPath, paint);
}
SkPath SkSVGPath::onAsPath(const SkSVGRenderContext& ctx) const {
SkPath path = fPath;
// clip-rule can be inherited and needs to be applied at clip time.
path.setFillType(ctx.presentationContext().fInherited.fClipRule.get()->asFillType());
this->mapToParent(&path);
return path;
}