浏览代码

fix image loading error: when an image fails to be loaded and initiated correctly, we should Assert the error in debug Mode and handle this situation by workaround in release Mode

/main
xingwei.zhu 5 年前
当前提交
f50875b3
共有 2 个文件被更改,包括 19 次插入3 次删除
  1. 4
      Runtime/ui/painting/image.cs
  2. 18
      Runtime/ui/renderer/cmdbufferCanvas/rendering/canvas_impl.cs

4
Runtime/ui/painting/image.cs


this._isDynamic = isDynamic;
}
public bool valid {
get { return this._texture != null; }
}
public int width {
get { return this._texture != null ? this._texture.width : 0; }
}

18
Runtime/ui/renderer/cmdbufferCanvas/rendering/canvas_impl.cs


}
void _drawImage(Image image, uiOffset offset, uiPaint paint) {
D.assert(image != null);
D.assert(image != null && image.valid);
if (image == null || !image.valid) {
return;
}
this._drawImageRect(image,
null,

}
void _drawImageRect(Image image, uiRect? src, uiRect dst, uiPaint paint) {
D.assert(image != null);
D.assert(image != null && image.valid);
if (image == null || !image.valid) {
return;
}
if (src == null) {
src = uiRectHelper.one;

}
void _drawImageNine(Image image, uiRect? src, uiRect center, uiRect dst, uiPaint paint) {
D.assert(image != null);
D.assert(image != null && image.valid);
if (image == null || !image.valid) {
return;
}
var scaleX = 1f / image.width;
var scaleY = 1f / image.height;

正在加载...
取消
保存