Skip to content

Commit c1be7ba

Browse files
authored
Fix accidentally dropping image encoding quality on the floor on Windows. (#1368)
This fixes a bug in `AttachableImageFormat.init(encoderCLSID:encodingQuality:)` where the `encodingQuality` argument would not be preserved. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent f817ce5 commit c1be7ba

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Sources/Overlays/_Testing_WinSDK/Attachments/AttachableImageFormat+CLSID.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,14 @@ extension AttachableImageFormat {
277277
@_spi(_)
278278
#endif
279279
public init(encoderCLSID: CLSID, encodingQuality: Float = 1.0) {
280-
if encoderCLSID == CLSID_WICPngEncoder {
281-
self = .png
280+
let kind: Kind = if encoderCLSID == CLSID_WICPngEncoder {
281+
.png
282282
} else if encoderCLSID == CLSID_WICJpegEncoder {
283-
self = .jpeg
283+
.jpeg
284284
} else {
285-
self.init(kind: .systemValue(encoderCLSID), encodingQuality: encodingQuality)
285+
.systemValue(encoderCLSID)
286286
}
287+
self.init(kind: kind, encodingQuality: encodingQuality)
287288
}
288289

289290
/// Construct an instance of this type with the given path extension and

0 commit comments

Comments
 (0)