浏览代码

small updates.

/main
kg 6 年前
当前提交
40787cae
共有 3 个文件被更改,包括 15 次插入8 次删除
  1. 2
      Runtime/flow/opacity_layer.cs
  2. 2
      Runtime/flow/picture_layer.cs
  3. 19
      Runtime/flow/raster_cache.cs

2
Runtime/flow/opacity_layer.cs


public override void preroll(PrerollContext context, Matrix3 matrix) {
var childMatrix = new Matrix3(matrix);
childMatrix.postTranslate(this._offset.dx, this._offset.dy); // TOOD: pre or post? https://github.com/flutter/engine/pull/7945
childMatrix.preTranslate(this._offset.dx, this._offset.dy); // TOOD: pre or post? https://github.com/flutter/engine/pull/7945
base.preroll(context, childMatrix);

2
Runtime/flow/picture_layer.cs


public override void preroll(PrerollContext context, Matrix3 matrix) {
if (context.rasterCache != null) {
Matrix3 ctm = new Matrix3(matrix);
ctm.postTranslate(this._offset.dx, this._offset.dy); // TOOD: pre or post? https://github.com/flutter/engine/pull/7945
ctm.preTranslate(this._offset.dx, this._offset.dy); // TOOD: pre or post? https://github.com/flutter/engine/pull/7945
ctm[2] = ctm[2].alignToPixel(context.devicePixelRatio);
ctm[5] = ctm[5].alignToPixel(context.devicePixelRatio);

19
Runtime/flow/raster_cache.cs


D.assert(matrix != null);
this.picture = picture;
this.matrix = new Matrix3(matrix);
var x = this.matrix[2] * devicePixelRatio;
var y = this.matrix[5] * devicePixelRatio;
this.matrix[2] = (x - (int) x) / devicePixelRatio; // x
this.matrix[5] = (y - (int) y) / devicePixelRatio; // y
D.assert(this.matrix[2] == 0);
D.assert(this.matrix[5] == 0);
D.assert(() => {
var x = this.matrix[2] * devicePixelRatio;
var y = this.matrix[5] * devicePixelRatio;
this.matrix[2] = (x - (int) x) / devicePixelRatio; // x
this.matrix[5] = (y - (int) y) / devicePixelRatio; // y
D.assert(Mathf.Abs(this.matrix[2]) <= 1e-5);
D.assert(Mathf.Abs(this.matrix[5]) <= 1e-5);
return true;
});
this.matrix[2] = 0.0f;
this.matrix[5] = 0.0f;
this.devicePixelRatio = devicePixelRatio;
}

正在加载...
取消
保存