2016-07-27 01:46:34 +00:00
|
|
|
/*
|
|
|
|
* 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 "SkCanvas.h"
|
|
|
|
#include "SkPaint.h"
|
|
|
|
#include "SkSVGPath.h"
|
|
|
|
#include "SkSVGRenderContext.h"
|
|
|
|
#include "SkSVGValue.h"
|
|
|
|
|
2016-07-29 15:52:03 +00:00
|
|
|
SkSVGPath::SkSVGPath() : INHERITED(SkSVGTag::kPath) { }
|
2016-07-27 01:46:34 +00:00
|
|
|
|
|
|
|
void SkSVGPath::onSetAttribute(SkSVGAttribute attr, const SkSVGValue& v) {
|
|
|
|
switch (attr) {
|
2016-07-29 15:52:03 +00:00
|
|
|
case SkSVGAttribute::kD:
|
2016-07-27 01:46:34 +00:00
|
|
|
if (const auto* path = v.as<SkSVGPathValue>()) {
|
|
|
|
this->setPath(*path);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
this->INHERITED::onSetAttribute(attr, v);
|
|
|
|
}
|
|
|
|
}
|
2016-08-03 17:21:11 +00:00
|
|
|
|
|
|
|
void SkSVGPath::onDraw(SkCanvas* canvas, const SkSVGLengthContext&, const SkPaint& paint) const {
|
|
|
|
canvas->drawPath(fPath, paint);
|
|
|
|
}
|