Skip to content

Commit 9f78a1f

Browse files
committed
fix RGBA -> RGB conversion
1 parent 8070092 commit 9f78a1f

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

JxlCoder.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'JxlCoder'
3-
s.version = '1.3.2'
3+
s.version = '1.3.3'
44
s.summary = 'JXL coder for iOS and MacOS'
55
s.description = 'Provides support for JXL files in iOS and MacOS'
66
s.homepage = 'https://github.com/awxkee/jxl-coder-swift'

Sources/jxlc/JXLSystemImage.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ -(bool)unpremultiply:(nonnull unsigned char*)data width:(NSInteger)width height:
5050
return true;
5151
}
5252

53-
5453
#if TARGET_OS_OSX
5554

5655
-(nullable CGImageRef)makeCGImage {

Sources/jxlc/RgbRgbaConverter.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ @implementation RgbRgbaConverter: NSObject
4848
.height = static_cast<vImagePixelCount>(height),
4949
.rowBytes = static_cast<vImagePixelCount>(width * 3)
5050
};
51-
uint8_t fillColor = 0x0000000;
52-
vImage_Error vEerror = vImageFlatten_RGBA8888ToRGB888(&src, &dest, &fillColor, false, kvImageNoFlags);
51+
Pixel_8888 fillColor = {0x00, 0x00, 0x00, 0xFF};
52+
vImage_Error vEerror = vImageFlatten_RGBA8888ToRGB888(&src, &dest, fillColor, true, kvImageNoFlags);
5353
if (vEerror != kvImageNoError) {
5454
dstVector.resize(1);
5555
return dstVector;
@@ -58,7 +58,7 @@ @implementation RgbRgbaConverter: NSObject
5858
}
5959

6060
+(bool)convertRGBU16ToRGBAU16:(uint16_t*)src dst:(uint16_t*)dst width:(int)width height:(int)height depth:(int)depth {
61-
uint16_t whiteColor = (uint16_t)(powf(2.0f, (float)depth) - 1);
61+
Pixel_16U whiteColor = (uint16_t)(powf(2.0f, (float)depth) - 1);
6262
vImage_Buffer srcBuffer = {
6363
.data = (void*)src,
6464
.width = static_cast<vImagePixelCount>(width),
@@ -80,7 +80,7 @@ +(bool)convertRGBU16ToRGBAU16:(uint16_t*)src dst:(uint16_t*)dst width:(int)width
8080
}
8181

8282
+(bool)convertRGBU8ToRGBAU8:(uint8_t*)src dst:(uint8_t*)dst width:(int)width height:(int)height; {
83-
uint16_t whiteColor = (uint16_t)(powf(2.0f, (float)8) - 1);
83+
Pixel_16U whiteColor = (uint16_t)(powf(2.0f, (float)8) - 1);
8484
vImage_Buffer srcBuffer = {
8585
.data = (void*)src,
8686
.width = static_cast<vImagePixelCount>(width),

0 commit comments

Comments
 (0)