From 2bb56fcd286973aee1f22a7e9937270ce13d4f15 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Tue, 3 Mar 2026 22:23:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`SaveAsImage`=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E7=9A=84=E5=9B=BE=E7=89=87=E5=9C=A8PC=E5=92=8C?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E4=B8=8A=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Internal/Utilities/ChartHelper.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Runtime/Internal/Utilities/ChartHelper.cs b/Runtime/Internal/Utilities/ChartHelper.cs index 9b4f5b63..7ff966f7 100644 --- a/Runtime/Internal/Utilities/ChartHelper.cs +++ b/Runtime/Internal/Utilities/ChartHelper.cs @@ -1290,8 +1290,7 @@ namespace XCharts.Runtime return null; var clampedExportScale = Mathf.Max(1f, exportScale); - var scaleFactor = canvas.scaleFactor <= 0 ? 1f : canvas.scaleFactor; - var outputScaleFactor = scaleFactor * clampedExportScale; + var outputScaleFactor = clampedExportScale; var width = Mathf.Max(1, Mathf.CeilToInt(rectTransform.rect.width * outputScaleFactor)); var height = Mathf.Max(1, Mathf.CeilToInt(rectTransform.rect.height * outputScaleFactor)); var chart = rectTransform.GetComponent(); @@ -1404,8 +1403,8 @@ namespace XCharts.Runtime // so the saved image has original width/height but higher quality. if (clampedExportScale > 1f) { - var targetWidth = Mathf.Max(1, Mathf.CeilToInt(rectTransform.rect.width * scaleFactor)); - var targetHeight = Mathf.Max(1, Mathf.CeilToInt(rectTransform.rect.height * scaleFactor)); + var targetWidth = Mathf.Max(1, Mathf.CeilToInt(rectTransform.rect.width)); + var targetHeight = Mathf.Max(1, Mathf.CeilToInt(rectTransform.rect.height)); var smallRT = RenderTexture.GetTemporary(targetWidth, targetHeight, 0, rt.format); Graphics.Blit(rt, smallRT); @@ -1416,7 +1415,7 @@ namespace XCharts.Runtime tex.Apply(); RenderTexture.ReleaseTemporary(smallRT); - var cornerRadiiFinal = GetChartCornerRadius(chart, rectTransform.rect.width, rectTransform.rect.height, scaleFactor); + var cornerRadiiFinal = GetChartCornerRadius(chart, rectTransform.rect.width, rectTransform.rect.height, 1f); ApplyRoundedCornerClip(tex, cornerRadiiFinal); } else