Skip to content

Commit 64cb539

Browse files
committed
v1.0.246 release
1 parent ade6b46 commit 64cb539

3 files changed

Lines changed: 28 additions & 8 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Id": "",
3-
"Version": "v1.0.245",
3+
"Version": "v1.0.246",
44
"Type": 0,
55
"AccessRight": 0,
66
"Status": 30,
@@ -12,10 +12,10 @@
1212
],
1313
"DocUrl": "https://liangxiegame.com",
1414
"Readme": {
15-
"version": "v1.0.245",
16-
"content": "内置文档: 引入 System.md 使用新版概念交互图&错别字修复",
15+
"version": "v1.0.246",
16+
"content": "修复(Unity):打开包工具面板时避免DX12崩溃(感谢 SoGameStudio 的 PR)",
1717
"author": "liangxie",
18-
"date": "2026 年 013014:16",
18+
"date": "2026 年 052710:52",
1919
"PackageId": ""
2020
}
2121
}

QFramework.Unity2018+/Assets/QFramework/Toolkits/_CoreKit/PackageKit/Markdown/MDHandlerImages.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public AnimatedTexture GetAnimatedTexture()
9595

9696
while (img != null)
9797
{
98-
anim.Add(img.CreateTexture(), img.Delay / 1000.0f);
98+
anim.Add(img.CreateTexture(), img.Delay > 0 ? img.Delay / 1000.0f : 0.1f);
9999
img = decoder.NextImage();
100100
}
101101

QFramework.Unity2018+/Assets/QFramework/Toolkits/_CoreKit/PackageKit/Markdown/MDMGGifs.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace QFramework
1010
{
1111
////////////////////////////////////////////////////////////////////////////////
12-
1312
public class MDGifImage : ICloneable
1413
{
1514
public int Width;
@@ -36,13 +35,34 @@ public object Clone()
3635

3736
public Texture2D CreateTexture()
3837
{
39-
var tex = new Texture2D(Width, Height, TextureFormat.ARGB32, false)
38+
if (Width <= 0 || Height <= 0)
39+
{
40+
return Texture2D.blackTexture;
41+
}
42+
43+
var expectedPixelCount = Width * Height;
44+
var pixels = RawImage;
45+
46+
if (pixels == null || pixels.Length != expectedPixelCount)
47+
{
48+
var sanitizedPixels = new Color32[expectedPixelCount];
49+
50+
if (pixels != null && pixels.Length > 0)
51+
{
52+
Array.Copy(pixels, sanitizedPixels, Math.Min(pixels.Length, sanitizedPixels.Length));
53+
}
54+
55+
pixels = sanitizedPixels;
56+
}
57+
58+
// DX12 下 ARGB32 在部分 Unity 版本会触发底层纹理上传问题,RGBA32 更稳定。
59+
var tex = new Texture2D(Width, Height, TextureFormat.RGBA32, false)
4060
{
4161
filterMode = FilterMode.Point,
4262
wrapMode = TextureWrapMode.Clamp
4363
};
4464

45-
tex.SetPixels32(RawImage);
65+
tex.SetPixels32(pixels);
4666
tex.Apply();
4767

4868
return tex;

0 commit comments

Comments
 (0)