浏览代码

code style

/main
xingwei.zhu 5 年前
当前提交
b5bed52d
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 14
      Runtime/painting/image_cache.cs

14
Runtime/painting/image_cache.cs


this._cache.Clear();
this._pendingImages.Clear();
this._currentSizeBytes = 0;
this._lruKeys.Clear();
}

this._lruKeys.Remove(image.node);
return true;
}
public ImageStreamCompleter putIfAbsent(object key, Func<ImageStreamCompleter> loader, ImageErrorListener onError = null) {
public ImageStreamCompleter putIfAbsent(object key, Func<ImageStreamCompleter> loader,
ImageErrorListener onError = null) {
D.assert(key != null);
D.assert(loader != null);

void listener(ImageInfo info, bool syncCall) {
int imageSize = info?.image == null ? 0 : info.image.height * info.image.width * 4;
_CachedImage cachedImage = new _CachedImage(result, imageSize);
this._currentSizeBytes += imageSize;
if (this._pendingImages.TryGetValue(key, out var loadedPendingImage)) {

D.assert(!this._cache.ContainsKey(key));
this._cache[key] = cachedImage;
cachedImage.node = this._lruKeys.AddLast(key);

this.completer = completer;
this.sizeBytes = sizeBytes;
}
public ImageStreamCompleter completer;
public int sizeBytes;
public LinkedListNode<object> node;

正在加载...
取消
保存