• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/SkSpan.h"
14 #include "include/core/SkTypes.h"
15 
16 class SkCanvas;
17 class SkSVGDOM;
18 
19 class SkSVGOpenTypeSVGDecoder : public SkOpenTypeSVGDecoder {
20 public:
21     static std::unique_ptr<SkOpenTypeSVGDecoder> Make(const uint8_t* svg, size_t svgLength);
22     size_t approximateSize() override;
23     bool render(SkCanvas&, int upem, SkGlyphID glyphId,
24                 SkColor foregroundColor, SkSpan<SkColor> palette) override;
25     ~SkSVGOpenTypeSVGDecoder() override;
26 private:
27     SkSVGOpenTypeSVGDecoder(sk_sp<SkSVGDOM> skSvg, size_t approximateSize);
28     sk_sp<SkSVGDOM> fSkSvg;
29     size_t fApproximateSize;
30 };
31 
32 #endif  // SkSVGOpenTypeSVGDecoder_DEFINED
33