Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Fixed image memory calculation #3344

Merged
merged 1 commit into from Feb 23, 2016
Merged

Fixed image memory calculation #3344

merged 1 commit into from Feb 23, 2016

Conversation

YasinZhou
Copy link

Fixed image memory calculation

@cnoon
Copy link
Member

cnoon commented Feb 23, 2016

This logic is exactly the same @SummertimSadness. Your calculation just multiplies width x height and then by bytesPerPixel instead of the row size which is width x bytesPerPixel then finally by the height. Both operations result in the same value.

I'm going to close this PR out for now. If I'm missing something very obvious, please point out my mistake and I'll gladly re-open.

Cheers. 🍻

@cnoon cnoon closed this Feb 23, 2016
@cnoon cnoon self-assigned this Feb 23, 2016
@tewha
Copy link
Contributor

tewha commented Feb 23, 2016

Ack. Take another look.

Current code:

    CGFloat bytesPerRow = imageSize.width * bytesPerPixel;
    self.totalBytes = (UInt64)bytesPerPixel * (UInt64)bytesPerRow;

Where's imageSize.height?

@cnoon
Copy link
Member

cnoon commented Feb 23, 2016

Doh, sometimes you look at something way too many times. Thanks @tewha!

@cnoon cnoon reopened this Feb 23, 2016
@cnoon cnoon added the bug label Feb 23, 2016
@cnoon cnoon added this to the 3.1.0 milestone Feb 23, 2016
cnoon added a commit that referenced this pull request Feb 23, 2016
@cnoon cnoon merged commit 5883c54 into AFNetworking:master Feb 23, 2016
@kcharwood
Copy link
Contributor

Thanks for merging this in @cnoon!

Do you recall if there were issues with tests here? I think I recall the original PR failing tests.

@cnoon
Copy link
Member

cnoon commented Feb 23, 2016

Hmmmm...let me take a look. Travis has been so messed up over the past two weeks on AF that I've stopped paying attention.

@cnoon cnoon mentioned this pull request Feb 23, 2016
@YasinZhou
Copy link
Author

我感觉totalBytes的计算方式不是最好的,而且dispatch_barrier_async的性能很低,我会继续优化这部分代码,非常高兴能为AF贡献

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants