| 1 |
/* |
| 2 |
* Copyright 2022 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 |
#ifndef SkSVGOpenTypeSVGDecoder_DEFINED |
| 9 |
#define SkSVGOpenTypeSVGDecoder_DEFINED |
| 10 |
|
| 11 |
#include "include/core/SkColor.h" |
| 12 |
#include "include/core/SkOpenTypeSVGDecoder.h" |
| 13 |
#include "include/core/SkRefCnt.h" |
| 14 |
#include "include/core/SkSpan.h" |
| 15 |
#include "include/core/SkTypes.h" |
| 16 |
|
| 17 |
#include <cstddef> |
| 18 |
#include <cstdint> |
| 19 |
#include <memory> |
| 20 |
|
| 21 |
class SkCanvas; |
| 22 |
class SkSVGDOM; |
| 23 |
|
| 24 |
class SkSVGOpenTypeSVGDecoder : public SkOpenTypeSVGDecoder { |
| 25 |
public: |
| 26 |
static std::unique_ptr<SkOpenTypeSVGDecoder> Make(const uint8_t* svg, size_t svgLength); |
| 27 |
size_t approximateSize() override; |
| 28 |
bool render(SkCanvas&, int upem, SkGlyphID glyphId, |
| 29 |
SkColor foregroundColor, SkSpan<SkColor> palette) override; |
| 30 |
~SkSVGOpenTypeSVGDecoder() override; |
| 31 |
private: |
| 32 |
SkSVGOpenTypeSVGDecoder(sk_sp<SkSVGDOM> skSvg, size_t approximateSize); |
| 33 |
sk_sp<SkSVGDOM> fSkSvg; |
| 34 |
size_t fApproximateSize; |
| 35 |
}; |
| 36 |
|
| 37 |
#endif // SkSVGOpenTypeSVGDecoder_DEFINED |