浏览代码

Merge branch 'dev' of github.com:UnityTech/UIWidgets into dev

/main
xingwei.zhu 5 年前
当前提交
69d78627
共有 3 个文件被更改,包括 12 次插入9 次删除
  1. 10
      Runtime/ui/renderer/cmdbufferCanvas/rendering/canvas_impl.cs
  2. 5
      Runtime/ui/renderer/common/geometry/rect.cs
  3. 6
      Runtime/ui/renderer/common/picture.cs

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


void _clipRect(Rect rect) {
var path = uiPath.create();
path.addRect(uiRectHelper.fromRect(rect));
path.addRect(uiRectHelper.fromRect(rect).Value);
this._clipPath(path);
uiPathCacheManager.putToCache(path);
}

break;
case DrawSaveLayer cmd: {
saveCount++;
this._saveLayer(uiRectHelper.fromRect(cmd.rect), uiPaint.fromPaint(cmd.paint));
this._saveLayer(uiRectHelper.fromRect(cmd.rect).Value, uiPaint.fromPaint(cmd.paint));
break;
}

}
case DrawImageRect cmd: {
this._drawImageRect(cmd.image, uiRectHelper.fromRect(cmd.src), uiRectHelper.fromRect(cmd.dst),
this._drawImageRect(cmd.image, uiRectHelper.fromRect(cmd.src), uiRectHelper.fromRect(cmd.dst).Value,
uiPaint.fromPaint(cmd.paint));
break;
}

uiRectHelper.fromRect(cmd.center), uiRectHelper.fromRect(cmd.dst),
uiRectHelper.fromRect(cmd.center).Value, uiRectHelper.fromRect(cmd.dst).Value,
uiPaint.fromPaint(cmd.paint));
break;
}

matrix.preTranslate(offset.dx, offset.dy);
var mesh = TextBlobMesh.create(textBlob.Value, scale, matrix);
var textBlobBounds = matrix.mapRect(uiRectHelper.fromRect(textBlob.Value.boundsInText));
var textBlobBounds = matrix.mapRect(uiRectHelper.fromRect(textBlob.Value.boundsInText).Value);
// request font texture so text mesh could be generated correctly
var style = textBlob.Value.style;

5
Runtime/ui/renderer/common/geometry/rect.cs


}
public static class uiRectHelper {
public static uiRect fromRect(Rect rect) {
public static uiRect? fromRect(Rect rect) {
if (rect == null) {
return null;
}
return new uiRect(rect.left, rect.top, rect.right, rect.bottom);
}

6
Runtime/ui/renderer/common/picture.cs


case uiDrawClipRRect cmd: {
var state = this._getState();
var rect = state.xform.mapRect(uiRectHelper.fromRect(cmd.rrect.outerRect));
var rect = state.xform.mapRect(uiRectHelper.fromRect(cmd.rrect.outerRect).Value);
state.scissor = state.scissor == null ? rect : state.scissor.Value.intersect(rect);
this._setState(state);
break;

}
case uiDrawPicture cmd: {
var state = this._getState();
var rect = state.xform.mapRect(uiRectHelper.fromRect(cmd.picture.paintBounds));
var rect = state.xform.mapRect(uiRectHelper.fromRect(cmd.picture.paintBounds).Value);
this._addPaintBounds(rect);
break;
}

var rect = uiRectHelper.fromRect(
cmd.textBlob.Value.shiftedBoundsInText(cmd.offset.Value.dx, cmd.offset.Value.dy));
cmd.textBlob.Value.shiftedBoundsInText(cmd.offset.Value.dx, cmd.offset.Value.dy)).Value;
rect = state.xform.mapRect(rect);
var paint = cmd.paint;

正在加载...
取消
保存