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