Skip to content

Commit

Permalink
Revert "_CGImageJPEGRepresentation"
Browse files Browse the repository at this point in the history
This reverts commit 5315d9b.
  • Loading branch information
Raj Seshasankaran committed Jul 22, 2016
1 parent 7af8620 commit c734776
Show file tree
Hide file tree
Showing 9 changed files with 1,321 additions and 1,580 deletions.
2,285 changes: 1,047 additions & 1,238 deletions Frameworks/CoreGraphics/CGImage.mm

Large diffs are not rendered by default.

15 changes: 2 additions & 13 deletions Frameworks/CoreGraphics/CGJPEGDecoderImage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static int jpeg_find_orientation(j_decompress_ptr cinfo) {
return 0;

// Find offset and tag count
DWORD offset = readDWord(curPos, left, bigEndian);
WORD offset = readWord(curPos, left, bigEndian);
offset -= 8;
if (offset > left)
return 0;
Expand Down Expand Up @@ -387,24 +387,13 @@ static int jpeg_find_orientation(j_decompress_ptr cinfo) {
case 1:
_orientation = 0;
break;
case 2:
_orientation = UIImageOrientationUpMirrored;
break;

case 3:
_orientation = UIImageOrientationDown;
break;
case 4:
_orientation = UIImageOrientationDownMirrored;
break;
case 5:
_orientation = UIImageOrientationRightMirrored;
break;
case 6:
_orientation = UIImageOrientationRight;
break;
case 7:
_orientation = UIImageOrientationLeftMirrored;
break;
case 8:
_orientation = UIImageOrientationLeft;
break;
Expand Down
17 changes: 7 additions & 10 deletions Frameworks/UIKit/UIImage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@ void UIImageSetLayerContents(CALayer* layer, UIImage* image) {
if ([layer contentsScale] != [image scale]) {
[layer setContentsScale:[image scale]];
}

// if setContentsOrientation with image orientation here,
// the Image will be rotated twice when shown in the screen.
[layer setContentsOrientation:0];

if ([layer contentsOrientation] != [image imageOrientation]) {
[layer setContentsOrientation:[image imageOrientation]];
}
CGRect stretch = [image _imageStretch];
if (!CGRectEqualToRect([layer contentsCenter], stretch)) {
[layer setContentsCenter:stretch];
Expand Down Expand Up @@ -115,12 +113,11 @@ - (void)encodeWithCoder:(NSCoder*)encoder {
}

+ (UIImageCachedObject*)cacheImage:(UIImage*)image withName:(NSString*)name {
// Cache the image
// Cache the image
UIImageCachedObject* obj = [UIImageCachedObject new];
obj->_scale = image->_scale;
obj->_imageStretch = image->_imageStretch;
obj->m_pImage = image->m_pImage;
obj->_orientation = image->_orientation;
CGImageRetain(obj->m_pImage);
obj->_cacheName = [name copy];
pthread_mutex_lock(&imageCacheLock);
Expand Down Expand Up @@ -462,7 +459,6 @@ - (instancetype)initWithContentsOfFile:(NSString*)pathAddr {
_scale = cachedImage->_scale;
_imageStretch = cachedImage->_imageStretch;
_isFromCache = true;
_orientation = cachedImage->_orientation;
pthread_mutex_unlock(&imageCacheLock);
return self;
}
Expand Down Expand Up @@ -1365,10 +1361,11 @@ + (UIImage*)animatedResizableImageNamed:(NSString*)name
}

/**
@Status Interoperable
@Status Stub
*/
NSData* UIImageJPEGRepresentation(UIImage* img, CGFloat quality) {
return _CGImageJPEGRepresentation(img, quality);
UNIMPLEMENTED();
return StubReturn();
}

/**
Expand Down
1 change: 0 additions & 1 deletion Frameworks/UIKit/UIImageCachedObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
id _cacheName;
float _scale;
CGRect _imageStretch;
UIImageOrientation _orientation;
}
- (void)dealloc;
@end
2 changes: 1 addition & 1 deletion Frameworks/include/CGImageInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,5 @@ class __CGImage: private objc_object {
typedef void (*CGImageDestructionListener)(CGImageRef img);
COREGRAPHICS_EXPORT void CGImageAddDestructionListener(CGImageDestructionListener listener);
COREGRAPHICS_EXPORT NSData* _CGImagePNGRepresentation(UIImage* img);
COREGRAPHICS_EXPORT NSData* _CGImageJPEGRepresentation(UIImage* img, CGFloat compressionQuality);

#endif
1 change: 0 additions & 1 deletion build/CoreGraphics/dll/CoreGraphics.def
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ LIBRARY CoreGraphics
CGPNGImageCreateFromData
CGJPEGImageCreateFromFile
CGPNGImageCreateFromFile
_CGImageJPEGRepresentation
_CGImagePNGRepresentation

; CGLayer.mm
Expand Down
532 changes: 264 additions & 268 deletions build/Tests/UnitTests/UIKit/UIKit.UnitTests.vcxproj

Large diffs are not rendered by default.

48 changes: 0 additions & 48 deletions tests/unittests/UIKit/UIImageTests.mm

This file was deleted.

Binary file removed tests/unittests/UIKit/rightOrientationPhoto.JPG
Binary file not shown.

0 comments on commit c734776

Please sign in to comment.