Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Small improvements for iOS wrapper #14

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ NS_SWIFT_NAME(Configuration)
- (instancetype)initWithGeneral:(FSPConfigurationGeneral *)general
jpeg:(FSPConfigurationJpeg *)jpeg
png:(FSPConfigurationPng *)png
webp:(FSPConfigurationWebp *)webp;
webp:(FSPConfigurationWebp *)webp NS_DESIGNATED_INITIALIZER;

- (BOOL)isEqualToConfiguration:(FSPConfiguration *)object;

Expand Down
8 changes: 4 additions & 4 deletions ios/SpectrumKit/SpectrumKit/FSPResult.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ + (instancetype)resultForFailure
{
return [[self alloc] initWithDidSucceed:NO
ruleName:nil
outputImageSpecification:nil
outputImageSpecification:nil
totalBytesRead:0
totalBytesWritten:0
duration:0];
}

- (instancetype)initWithDidSucceed:(BOOL)didSucceed
ruleName:(NSString *)ruleName
outputImageSpecification:(FSPImageSpecification *)outputImageSpecification
ruleName:(nullable NSString *)ruleName
outputImageSpecification:(nullable FSPImageSpecification *)outputImageSpecification
totalBytesRead:(NSUInteger)totalBytesRead
totalBytesWritten:(NSUInteger)totalBytesWritten
duration:(NSUInteger)duration
Expand All @@ -46,7 +46,7 @@ - (instancetype)initWithDidSucceed:(BOOL)didSucceed

- (instancetype)initWithInternalTranscodeResult:(const Result &)result
{
return [self initWithDidSucceed:true
return [self initWithDidSucceed:YES
ruleName:[NSString stringWithUTF8String:result.ruleName.c_str()]
outputImageSpecification:[FSPImageSpecification imageSpecificationFromInternalImageSpecification:result.outputImageSpecification]
totalBytesRead:static_cast<NSUInteger>(result.totalBytesRead)
Expand Down
3 changes: 2 additions & 1 deletion ios/SpectrumKit/SpectrumKit/FSPSpectrum.mm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ - (FSPResultData *)encodeImage:(UIImage *)image
{
const auto outputStream = [NSOutputStream outputStreamToMemory];
auto imageSink = io::OutputStreamImageSink{outputStream};
const auto result = [self _runEncodeImage:image sink:imageSink
const auto result = [self _runEncodeImage:image
sink:imageSink
options:options
error:error];
return [self.class resultDataWithResult:result outputStream:outputStream];
Expand Down
4 changes: 2 additions & 2 deletions ios/SpectrumKit/SpectrumKit/Image/FSPImageMetadata.mm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ @implementation FSPImageMetadata {

#pragma mark - Initialisers

+ (instancetype)imageMetadataWithDictionary:(NSDictionary<NSString *, id> *)dictionary
+ (instancetype)imageMetadataWithDictionary:(nullable NSDictionary<NSString *, id> *)dictionary
{
return [[self alloc] initWithMetadataDictionary:dictionary];
}
Expand All @@ -52,7 +52,7 @@ + (instancetype)imageMetadataFromImage:(UIImage *)image
return metadata;
}

- (instancetype)initWithMetadataDictionary:(NSDictionary<NSString *, id> *)dictionary
- (instancetype)initWithMetadataDictionary:(nullable NSDictionary<NSString *, id> *)dictionary
{
if (self = [super init]) {
_dictionary = [NSDictionary dictionaryWithDictionary:dictionary];
Expand Down
4 changes: 2 additions & 2 deletions ios/SpectrumKit/SpectrumKit/Image/FSPImageSpecification.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ + (instancetype)imageSpecificationWithSize:(CGSize)size
pixelSpecification:(FSPImagePixelSpecification *)pixelSpecification
orientation:(FSPImageOrientation)orientation
chromaSamplingMode:(FSPImageChromaSamplingMode)chromaSamplingMode
metadata:(FSPImageMetadata *)metadata
metadata:(nullable FSPImageMetadata *)metadata
{
return [[self alloc] initWithSize:size
format:format
Expand All @@ -43,7 +43,7 @@ - (instancetype)initWithSize:(CGSize)size
pixelSpecification:(FSPImagePixelSpecification *)pixelSpecification
orientation:(FSPImageOrientation)orientation
chromaSamplingMode:(FSPImageChromaSamplingMode)chromaSamplingMode
metadata:(FSPImageMetadata *)metadata
metadata:(nullable FSPImageMetadata *)metadata
{
FSPReportMustFixIfNil(format, nil);
FSPReportMustFixIfNil(pixelSpecification, nil);
Expand Down