浏览代码

fix pixelsPerPoint.

/main
kg 6 年前
当前提交
5442870e
共有 4 个文件被更改,包括 8 次插入15 次删除
  1. 3
      Assets/UIWidgets/editor/editor_window.cs
  2. 4
      Assets/UIWidgets/rendering/layer.cs
  3. 3
      Assets/UIWidgets/rendering/view.cs
  4. 13
      Assets/UIWidgets/ui/painting/canvas_impl.cs

3
Assets/UIWidgets/editor/editor_window.cs


this._lastPosition.width * EditorGUIUtility.pixelsPerPoint,
this._lastPosition.height * EditorGUIUtility.pixelsPerPoint);
instance = this;
try {
this._binding = new WidgetsBinding();

canvas = new CanvasImpl()
};
layer.paint(paintContext);
this._rasterCache.sweepAfterFrame();
}

4
Assets/UIWidgets/rendering/layer.cs


}
public class TransformLayer : OffsetLayer {
public TransformLayer(Matrix4x4 transform = default(Matrix4x4), Offset offset = null) : base(offset) {
this._transform = transform;
public TransformLayer(Matrix4x4? transform = null, Offset offset = null) : base(offset) {
this._transform = transform ?? Matrix4x4.identity;
}
public Matrix4x4 transform {

3
Assets/UIWidgets/rendering/view.cs


public readonly double devicePixelRatio;
public Matrix4x4 toMatrix() {
return Matrix4x4.Scale(new Vector3(
(float) this.devicePixelRatio, (float) this.devicePixelRatio, 1));
return Matrix4x4.identity;
}
public override string ToString() {

13
Assets/UIWidgets/ui/painting/canvas_impl.cs


}
public CanvasImpl() {
this._transform = Matrix4x4.Scale(new Vector3(
1.0f / EditorGUIUtility.pixelsPerPoint,
1.0f / EditorGUIUtility.pixelsPerPoint,
1.0f));
this._transform = Matrix4x4.identity;
this._defaultTexture = RenderTexture.active;
}

var drawPicture = (DrawPicture) drawCmd;
this.drawPicture(drawPicture.picture);
} else if (drawCmd is DrawConcat) {
var drawConcat = (DrawConcat) drawCmd;
var drawConcat = (DrawConcat) drawCmd;
this.concat(drawConcat.transform);
} else if (drawCmd is DrawSetMatrix) {
var drawSetMatrix = (DrawSetMatrix) drawCmd;

this.pushClipRRect(rect, this._transform);
}
public void drawTextBlob(TextBlob textBlob, Offset offset)
{
public void drawTextBlob(TextBlob textBlob, Offset offset) {
var mesh = MeshGenrator.generateMesh(textBlob);
var font = FontManager.instance.getOrCreate(textBlob.style.fontFamily).font;
prepareGL(font.material);

}
var textBlobOffset = textBlob.positions[textBlob.start];
Graphics.DrawMeshNow(mesh, this._transform * Matrix4x4.Translate(
new Vector3((float) Utils.PixelCorrectRound(offset.dx + textBlobOffset.x),
(float) Utils.PixelCorrectRound(offset.dy + textBlobOffset.y), 0)));

正在加载...
取消
保存