1 | //! This file contains Default trait implementations for types that are re-exported from skia-safe. |
2 | #![allow (clippy::derivable_impls)] |
3 | |
4 | use crate::{ |
5 | SkBlendMode, SkBlurStyle, SkCanvas_Lattice_RectType, SkClipOp, SkPDF_Metadata_CompressionLevel, |
6 | SkPaint_Cap, SkPaint_Join, SkParsePath_PathEncoding, SkPathDirection, SkTileMode, |
7 | SkYUVColorSpace, |
8 | }; |
9 | |
10 | impl Default for SkBlendMode { |
11 | fn default() -> Self { |
12 | SkBlendMode::SrcOver |
13 | } |
14 | } |
15 | |
16 | impl Default for SkPaint_Cap { |
17 | fn default() -> Self { |
18 | SkPaint_Cap::Default |
19 | } |
20 | } |
21 | |
22 | impl Default for SkPaint_Join { |
23 | fn default() -> Self { |
24 | SkPaint_Join::Default |
25 | } |
26 | } |
27 | |
28 | impl Default for SkBlurStyle { |
29 | fn default() -> Self { |
30 | SkBlurStyle::Normal |
31 | } |
32 | } |
33 | |
34 | impl Default for SkCanvas_Lattice_RectType { |
35 | fn default() -> Self { |
36 | SkCanvas_Lattice_RectType::Default |
37 | } |
38 | } |
39 | |
40 | // This is the default for the canvas's clip functions. |
41 | impl Default for SkClipOp { |
42 | fn default() -> Self { |
43 | SkClipOp::Intersect |
44 | } |
45 | } |
46 | |
47 | impl Default for SkYUVColorSpace { |
48 | fn default() -> Self { |
49 | SkYUVColorSpace::Identity |
50 | } |
51 | } |
52 | |
53 | impl Default for SkPathDirection { |
54 | fn default() -> Self { |
55 | SkPathDirection::CW |
56 | } |
57 | } |
58 | |
59 | impl Default for SkTileMode { |
60 | fn default() -> Self { |
61 | SkTileMode::Clamp |
62 | } |
63 | } |
64 | |
65 | impl Default for SkParsePath_PathEncoding { |
66 | fn default() -> Self { |
67 | SkParsePath_PathEncoding::Absolute |
68 | } |
69 | } |
70 | |
71 | impl Default for SkPDF_Metadata_CompressionLevel { |
72 | fn default() -> Self { |
73 | SkPDF_Metadata_CompressionLevel::Default |
74 | } |
75 | } |
76 | |
77 | #[cfg (feature = "textlayout" )] |
78 | pub mod textlayout { |
79 | impl Default for crate::skia_textlayout_Affinity { |
80 | fn default() -> Self { |
81 | Self::Upstream |
82 | } |
83 | } |
84 | |
85 | impl Default for crate::skia_textlayout_TextAlign { |
86 | fn default() -> Self { |
87 | Self::Left |
88 | } |
89 | } |
90 | |
91 | // TODO: Remove as soon we are building with Rust stable >= 1.57 |
92 | #[allow (unknown_lints)] |
93 | #[allow (clippy::derivable_impls)] |
94 | impl Default for crate::skia_textlayout_PositionWithAffinity { |
95 | fn default() -> Self { |
96 | Self { |
97 | position: 0, |
98 | affinity: Default::default(), |
99 | } |
100 | } |
101 | } |
102 | |
103 | impl Default for crate::skia_textlayout_TextBaseline { |
104 | fn default() -> Self { |
105 | Self::Alphabetic |
106 | } |
107 | } |
108 | |
109 | impl Default for crate::skia_textlayout_TextDecorationStyle { |
110 | fn default() -> Self { |
111 | Self::Solid |
112 | } |
113 | } |
114 | |
115 | impl Default for crate::skia_textlayout_TextDecorationMode { |
116 | fn default() -> Self { |
117 | Self::Gaps |
118 | } |
119 | } |
120 | |
121 | impl Default for crate::skia_textlayout_StyleType { |
122 | fn default() -> Self { |
123 | Self::AllAttributes |
124 | } |
125 | } |
126 | } |
127 | |