浏览代码

Merge pull request #356 from UnityTech/master

hotfix merges
/main
GitHub 5 年前
当前提交
2a0547d7
共有 3 个文件被更改,包括 21 次插入15 次删除
  1. 10
      Runtime/material/date_picker.cs
  2. 10
      Runtime/ui/geometry.cs
  3. 16
      Runtime/ui/renderer/compositeCanvas/flow/raster_cache.cs

10
Runtime/material/date_picker.cs


void _updateCurrentDate() {
this._todayDate = DateTime.Now;
DateTime tomorrow = new DateTime(this._todayDate.Year, this._todayDate.Month, this._todayDate.Day + 1);
DateTime tomorrow = this._todayDate.AddDays(1);
TimeSpan timeUntilTomorrow = tomorrow.TimeOfDay - this._todayDate.TimeOfDay;
this._timer?.cancel();
this._timer = Window.instance.run(timeUntilTomorrow,

}
DateTime _addMonthsToMonthDate(DateTime monthDate, int monthsToAdd) {
if (monthsToAdd < 0) {
var monthsToAddAfterMod = monthsToAdd % 12 + 12;
return new DateTime(monthDate.Year + (monthsToAdd / 12), monthDate.Month + monthsToAddAfterMod, 1);
}
else {
return new DateTime(monthDate.Year + (monthsToAdd / 12), monthDate.Month + monthsToAdd % 12, 1);
}
return monthDate.AddMonths(monthsToAdd);
}
Widget _buildItems(BuildContext context, int index) {

10
Runtime/ui/geometry.cs


Mathf.Ceil(this.right), Mathf.Ceil(this.bottom));
}
public Rect roundOut(float devicePixelRatio) {
public Rect roundOutScale(float scale) {
return fromLTRB(
Mathf.Floor(this.left * scale),
Mathf.Floor(this.top * scale),
Mathf.Ceil(this.right * scale),
Mathf.Ceil(this.bottom * scale));
}
public Rect withDevicePixelRatio(float devicePixelRatio) {
return fromLTRB(
Mathf.Floor(this.left * devicePixelRatio) / devicePixelRatio,
Mathf.Floor(this.top * devicePixelRatio) / devicePixelRatio,

16
Runtime/ui/renderer/compositeCanvas/flow/raster_cache.cs


public readonly float devicePixelRatio;
public void draw(Canvas canvas) {
var bounds = canvas.getTotalMatrix().mapRect(this.logicalRect).roundOut(this.devicePixelRatio);
var boundRect = canvas.getTotalMatrix().mapRect(this.logicalRect);
var bounds = boundRect.withDevicePixelRatio(this.devicePixelRatio);
var textureWidth = Mathf.CeilToInt(bounds.width * this.devicePixelRatio);
var textureHeight = Mathf.CeilToInt(bounds.height * this.devicePixelRatio);
var boundsInPixel = boundRect.roundOutScale(this.devicePixelRatio);
var textureWidth = Mathf.CeilToInt(boundsInPixel.width);
var textureHeight = Mathf.CeilToInt(boundsInPixel.height);
//it is possible that there is a minor difference between the bound size and the image size (1 pixel at
//most) due to the roundOut operation when calculating the bounds if the elements in the canvas transform

RasterCacheResult _rasterizePicture(Picture picture, Matrix3 transform, float devicePixelRatio,
int antiAliasing, MeshPool meshPool) {
var bounds = transform.mapRect(picture.paintBounds).roundOut(devicePixelRatio);
var boundRect = transform.mapRect(picture.paintBounds);
var bounds = boundRect.withDevicePixelRatio(devicePixelRatio);
var boundsInPixel = boundRect.roundOutScale(devicePixelRatio);
Mathf.CeilToInt((bounds.width * devicePixelRatio)),
Mathf.CeilToInt((bounds.height * devicePixelRatio)),
Mathf.CeilToInt(boundsInPixel.width),
Mathf.CeilToInt(boundsInPixel.height),
RenderTextureFormat.Default, 24) {
useMipMap = false,
autoGenerateMips = false,

正在加载...
取消
保存