Skip to content

Commit

Permalink
Merge commit 'ef0bceeaf5a3c5c765a84f5956af873abb035107' into develop-1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
香風智乃 authored and 香風智乃 committed Jan 27, 2019
2 parents 8d244ec + ef0bcee commit 5ac7c02
Show file tree
Hide file tree
Showing 34 changed files with 683 additions and 470 deletions.
28 changes: 28 additions & 0 deletions Dependencies/SDWebImage-master/.github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- important
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs.
If this is still an issue, please make sure it is up to date and if so,
add a comment that this is still an issue to keep it open.
Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
pulls:
daysUntilStale: 60
markComment: >
This pull request has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs.
If this is still applicable, please make sure it is up to date and if so,
add a comment that this is still an issue to keep it open.
Thank you for your contributions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

#import "SDWebImageCompat.h"

@interface UIImage (MemoryCacheCost)

/**
The memory cache cost for specify image used by image cache. The cost function is the pixles count held in memory.
If you set some associated object to `UIImage`, you can set the custom value to indicate the memory cost.
For `UIImage`, this method return the single frame pixles count when `image.images` is nil for static image. Retuen full frame pixels count when `image.images` is not nil for animated image.
For `NSImage`, this method return the single frame pixels count because `NSImage` does not store all frames in memory.
@note Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods.
*/
@property (assign, nonatomic) NSUInteger sd_memoryCost;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

#import "UIImage+MemoryCacheCost.h"
#import "objc/runtime.h"

FOUNDATION_STATIC_INLINE NSUInteger SDMemoryCacheCostForImage(UIImage *image) {
#if SD_MAC
return image.size.height * image.size.width;
#elif SD_UIKIT || SD_WATCH
NSUInteger imageSize = image.size.height * image.size.width * image.scale * image.scale;
return image.images ? (imageSize * image.images.count) : imageSize;
#endif
}

@implementation UIImage (MemoryCacheCost)

- (NSUInteger)sd_memoryCost {
NSNumber *value = objc_getAssociatedObject(self, @selector(sd_memoryCost));
NSUInteger memoryCost;
if (value != nil) {
memoryCost = [value unsignedIntegerValue];
} else {
memoryCost = SDMemoryCacheCostForImage(self);
}
return memoryCost;
}

- (void)setSd_memoryCost:(NSUInteger)sd_memoryCost {
objc_setAssociatedObject(self, @selector(sd_memoryCost), @(sd_memoryCost), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

@end
4 changes: 2 additions & 2 deletions Dependencies/SDWebImage-master/WebImage/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.4.2</string>
<string>4.4.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>4.4.2</string>
<string>4.4.3</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
1 change: 1 addition & 0 deletions Dependencies/SDWebImage-master/WebImage/SDWebImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ FOUNDATION_EXPORT const unsigned char WebImageVersionString[];
#import <SDWebImage/SDWebImagePrefetcher.h>
#import <SDWebImage/UIView+WebCacheOperation.h>
#import <SDWebImage/UIImage+MultiFormat.h>
#import <SDWebImage/UIImage+MemoryCacheCost.h>
#import <SDWebImage/SDWebImageOperation.h>
#import <SDWebImage/SDWebImageDownloader.h>
#import <SDWebImage/SDWebImageTransition.h>
Expand Down
Loading

0 comments on commit 5ac7c02

Please sign in to comment.