Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ios
/
yh_sdwebimage
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
DreamPiggy
7 years ago
Commit
2e4266b7dbff8295fddebb79afae91be701810fe
1 parent
b758c97d
Change all UIImage init method to alloc instead of autorelease to immediately release it after usage
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
11 deletions
SDWebImage/SDWebImageGIFCoder.m
SDWebImage/SDWebImageImageIOCoder.m
SDWebImage/SDWebImageWebPCoder.m
SDWebImage/SDWebImageGIFCoder.m
View file @
2e4266b
...
...
@@ -65,7 +65,7 @@
CGFloat
scale
=
1
;
scale
=
[
UIScreen
mainScreen
].
scale
;
#endif
UIImage
*
image
=
[
UIImage
image
WithCGImage
:
imageRef
scale
:
scale
orientation
:
UIImageOrientationUp
];
UIImage
*
image
=
[
[
UIImage
alloc
]
init
WithCGImage
:
imageRef
scale
:
scale
orientation
:
UIImageOrientationUp
];
CGImageRelease
(
imageRef
);
SDWebImageFrame
*
frame
=
[
SDWebImageFrame
frameWithImage
:
image
duration
:
duration
];
...
...
SDWebImage/SDWebImageImageIOCoder.m
View file @
2e4266b
...
...
@@ -107,9 +107,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
UIImageOrientation
orientation
=
[[
self
class
]
sd_imageOrientationFromImageData
:
data
];
if
(
orientation
!=
UIImageOrientationUp
)
{
image
=
[
UIImage
imageWithCGImage
:
image
.
CGImage
scale
:
image
.
scale
orientation
:
orientation
];
image
=
[[
UIImage
alloc
]
initWithCGImage
:
image
.
CGImage
scale
:
image
.
scale
orientation
:
orientation
];
}
return
image
;
...
...
@@ -175,7 +173,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
if
(
partialImageRef
)
{
#if SD_UIKIT || SD_WATCH
image
=
[
UIImage
image
WithCGImage
:
partialImageRef
scale
:
1
orientation
:
_orientation
];
image
=
[
[
UIImage
alloc
]
init
WithCGImage
:
partialImageRef
scale
:
1
orientation
:
_orientation
];
#elif SD_MAC
image
=
[[
UIImage
alloc
]
initWithCGImage
:
partialImageRef
size
:
NSZeroSize
];
#endif
...
...
@@ -260,10 +258,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
// Draw the image into the context and retrieve the new bitmap image without alpha
CGContextDrawImage
(
context
,
CGRectMake
(
0
,
0
,
width
,
height
),
imageRef
);
CGImageRef
imageRefWithoutAlpha
=
CGBitmapContextCreateImage
(
context
);
UIImage
*
imageWithoutAlpha
=
[
UIImage
imageWithCGImage
:
imageRefWithoutAlpha
scale
:
image
.
scale
orientation
:
image
.
imageOrientation
];
UIImage
*
imageWithoutAlpha
=
[[
UIImage
alloc
]
initWithCGImage
:
imageRefWithoutAlpha
scale
:
image
.
scale
orientation
:
image
.
imageOrientation
];
CGContextRelease
(
context
);
CGImageRelease
(
imageRefWithoutAlpha
);
...
...
@@ -378,7 +373,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
if
(
destImageRef
==
NULL
)
{
return
image
;
}
UIImage
*
destImage
=
[
UIImage
image
WithCGImage
:
destImageRef
scale
:
image
.
scale
orientation
:
image
.
imageOrientation
];
UIImage
*
destImage
=
[
[
UIImage
alloc
]
init
WithCGImage
:
destImageRef
scale
:
image
.
scale
orientation
:
image
.
imageOrientation
];
CGImageRelease
(
destImageRef
);
if
(
destImage
==
nil
)
{
return
image
;
...
...
SDWebImage/SDWebImageWebPCoder.m
View file @
2e4266b
...
...
@@ -254,7 +254,7 @@
CGImageRef
newImageRef
=
CGBitmapContextCreateImage
(
canvas
);
#if SD_UIKIT || SD_WATCH
image
=
[
UIImage
image
WithCGImage
:
newImageRef
];
image
=
[
[
UIImage
alloc
]
init
WithCGImage
:
newImageRef
];
#elif SD_MAC
image
=
[[
UIImage
alloc
]
initWithCGImage
:
newImageRef
size
:
NSZeroSize
];
#endif
...
...
Please
register
or
login
to post a comment