Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkSVGDevice.h
Go to the documentation of this file.
1/*
2 * Copyright 2015 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 SkSVGDevice_DEFINED
9#define SkSVGDevice_DEFINED
10
18
19#include <cstddef>
20#include <cstdint>
21#include <memory>
22#include <type_traits>
23
24namespace sktext {
25class GlyphRunList;
26}
27
28class SkDevice;
29class SkBitmap;
30class SkBlender;
31class SkClipStack;
32class SkData;
33class SkImage;
34class SkMesh;
35class SkPaint;
36class SkPath;
37class SkRRect;
38class SkVertices;
39class SkXMLWriter;
40struct SkISize;
41struct SkPoint;
42struct SkRect;
44
45class SkSVGDevice final : public SkClipStackDevice {
46public:
47 static sk_sp<SkDevice> Make(const SkISize& size, std::unique_ptr<SkXMLWriter>, uint32_t flags);
48
49 void drawPaint(const SkPaint& paint) override;
50 void drawAnnotation(const SkRect& rect, const char key[], SkData* value) override;
51 void drawPoints(SkCanvas::PointMode mode, size_t count,
52 const SkPoint[], const SkPaint& paint) override;
53 void drawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
54 const SkSamplingOptions&, const SkPaint& paint,
55 SkCanvas::SrcRectConstraint constraint) override;
56 void drawRect(const SkRect& r, const SkPaint& paint) override;
57 void drawOval(const SkRect& oval, const SkPaint& paint) override;
58 void drawRRect(const SkRRect& rr, const SkPaint& paint) override;
59 void drawPath(const SkPath& path,
60 const SkPaint& paint,
61 bool pathIsMutable = false) override;
62
63 void drawVertices(const SkVertices*, sk_sp<SkBlender>, const SkPaint&, bool) override;
64 void drawMesh(const SkMesh&, sk_sp<SkBlender>, const SkPaint&) override;
65
66private:
67 SkSVGDevice(const SkISize& size, std::unique_ptr<SkXMLWriter>, uint32_t);
68 ~SkSVGDevice() override;
69
70 void onDrawGlyphRunList(SkCanvas*, const sktext::GlyphRunList&, const SkPaint& paint) override;
71
72 struct MxCp;
73 void drawBitmapCommon(const MxCp&, const SkBitmap& bm, const SkPaint& paint);
74
75 void syncClipStack(const SkClipStack&);
76
77 SkParsePath::PathEncoding pathEncoding() const;
78
79 class AutoElement;
80 class ResourceBucket;
81
82 const std::unique_ptr<SkXMLWriter> fWriter;
83 const std::unique_ptr<ResourceBucket> fResourceBucket;
84 const uint32_t fFlags;
85
86 struct ClipRec {
87 std::unique_ptr<AutoElement> fClipPathElem;
88 uint32_t fGenID;
89
90 static_assert(::sk_is_trivially_relocatable<decltype(fClipPathElem)>::value);
91
92 using sk_is_trivially_relocatable = std::true_type;
93 };
94
95 std::unique_ptr<AutoElement> fRootElement;
97};
98
99#endif // SkSVGDevice_DEFINED
int count
uint16_t fFlags
SrcRectConstraint
Definition SkCanvas.h:1541
SkISize size() const
Definition SkDevice.h:126
void drawOval(const SkRect &oval, const SkPaint &paint) override
void drawPath(const SkPath &path, const SkPaint &paint, bool pathIsMutable=false) override
void drawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint[], const SkPaint &paint) override
void drawPaint(const SkPaint &paint) override
void onDrawGlyphRunList(SkCanvas *, const sktext::GlyphRunList &, const SkPaint &paint) override
static sk_sp< SkDevice > Make(const SkISize &size, std::unique_ptr< SkXMLWriter >, uint32_t flags)
void drawVertices(const SkVertices *, sk_sp< SkBlender >, const SkPaint &, bool) override
void drawAnnotation(const SkRect &rect, const char key[], SkData *value) override
~SkSVGDevice() override
void drawRRect(const SkRRect &rr, const SkPaint &paint) override
void drawImageRect(const SkImage *image, const SkRect *src, const SkRect &dst, const SkSamplingOptions &, const SkPaint &paint, SkCanvas::SrcRectConstraint constraint) override
void drawMesh(const SkMesh &, sk_sp< SkBlender >, const SkPaint &) override
void drawRect(const SkRect &r, const SkPaint &paint) override
const Paint & paint
sk_sp< SkImage > image
Definition examples.cpp:29
FlutterSemanticsFlag flags
uint8_t value