skia2/experimental/svg/model/SkSVGGradient.h
John Stiles 7571f9e490 Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'.
Mechanically updated via Xcode "Replace Regular Expression":

  typedef (.*) INHERITED;
    -->
  using INHERITED = $1;

The ClangTidy approach generated an even larger CL which would have
required a significant amount of hand-tweaking to be usable.

Change-Id: I671dc9d9efdf6d60151325c8d4d13fad7e10a15b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314999
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-03 03:41:26 +00:00

52 lines
1.7 KiB
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkSVGGradient_DEFINED
#define SkSVGGradient_DEFINED
#include "experimental/svg/model/SkSVGHiddenContainer.h"
#include "experimental/svg/model/SkSVGTypes.h"
#include "include/core/SkShader.h"
class SkMatrix;
class SkSVGRenderContext;
class SkSVGStop;
class SkSVGGradient : public SkSVGHiddenContainer {
public:
~SkSVGGradient() override = default;
void setHref(const SkSVGStringType&);
void setGradientTransform(const SkSVGTransformType&);
void setSpreadMethod(const SkSVGSpreadMethod&);
protected:
explicit SkSVGGradient(SkSVGTag t) : INHERITED(t) {}
void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
bool onAsPaint(const SkSVGRenderContext&, SkPaint*) const final;
virtual sk_sp<SkShader> onMakeShader(const SkSVGRenderContext&,
const SkColor*, const SkScalar*, int count,
SkTileMode, const SkMatrix& localMatrix) const = 0;
private:
using StopPositionArray = SkSTArray<2, SkScalar, true>;
using StopColorArray = SkSTArray<2, SkColor, true>;
void collectColorStops(const SkSVGRenderContext&, StopPositionArray*, StopColorArray*) const;
SkColor resolveStopColor(const SkSVGRenderContext&, const SkSVGStop&) const;
SkSVGStringType fHref;
SkSVGTransformType fGradientTransform = SkSVGTransformType(SkMatrix::I());
SkSVGSpreadMethod fSpreadMethod = SkSVGSpreadMethod(SkSVGSpreadMethod::Type::kPad);
using INHERITED = SkSVGHiddenContainer;
};
#endif // SkSVGGradient_DEFINED