浏览代码

minor fix

/main
xingwei.zhu 6 年前
当前提交
2ddd909d
共有 5 个文件被更改,包括 50 次插入70 次删除
  1. 95
      Runtime/flow/physical_shape_layer.cs
  2. 2
      Runtime/material/list_tile.cs
  3. 2
      Runtime/material/scaffold.cs
  4. 15
      Runtime/ui/compositing.cs
  5. 6
      Runtime/widgets/perferred_size.cs

95
Runtime/flow/physical_shape_layer.cs


public class PhysicalShapeLayer : ContainerLayer {
public PhysicalShapeLayer(
Clip clipBehavior) {
this.isRect_ = false;
this.clip_behavior_ = clipBehavior;
this._isRect = false;
this._clip_behavior = clipBehavior;
float elevation_;
Color color_;
Color shadow_color_;
float device_pixel_ratio_;
Path path_;
bool isRect_;
Rect frameRRect_;
Clip clip_behavior_;
float _elevation;
Color _color;
Color _shadow_color;
float _device_pixel_ratio;
Path _path;
bool _isRect;
Rect _frameRRect;
Clip _clip_behavior;
public void set_path(Path path) {
//todo: xingwei.zhu : try to do path => rect transfer
this.path_ = path;
this.isRect_ = false;
this.frameRRect_ = path.getBounds();
public Path path {
set {
//todo: xingwei.zhu : try to do path => rect transfer
this._path = value;
this._isRect = false;
this._frameRRect = value.getBounds();
}
public void set_elevation(float elevation) {
this.elevation_ = elevation;
public float elevation {
set { this._elevation = value; }
public void set_color(Color color) {
this.color_ = color;
public Color color {
set { this._color = value; }
public void set_shadow_color(Color shadowColor) {
this.shadow_color_ = shadowColor;
public Color shadowColor {
set { this._shadow_color = value; }
public void set_device_pixel_ratio(float dpr) {
this.device_pixel_ratio_ = dpr;
public float devicePixelRatio {
set { this._device_pixel_ratio = value; }
}
public override void preroll(PrerollContext context, Matrix3 matrix) {

if (this.elevation_ == 0) {
this.paintBounds = this.path_.getBounds();
if (this._elevation == 0) {
this.paintBounds = this._path.getBounds();
Rect bounds = this.path_.getBounds();
Rect bounds = this._path.getBounds();
//todo xingwei.zhu: outter set shadow
//bounds.outset(20.0f, 20.0f);
this.paintBounds = bounds;

public override void paint(PaintContext context) {
if (this.elevation_ != 0) {
this.drawShadow(context.canvas, this.path_, this.shadow_color_, this.elevation_,
this.color_.alpha != 255, this.device_pixel_ratio_);
if (this._elevation != 0) {
this.drawShadow(context.canvas, this._path, this._shadow_color, this._elevation,
this._color.alpha != 255, this._device_pixel_ratio);
Paint paint = new Paint {color = this.color_};
if (this.clip_behavior_ != Clip.antiAliasWithSaveLayer) {
context.canvas.drawPath(this.path_, paint);
}
Paint paint = new Paint {color = this._color};
//todo: xingwei.zhu: process according to different clipBehavior, currently use antiAlias as default
context.canvas.drawPath(this._path, paint);
int saveCount = 1;
switch (this.clip_behavior_) {
case Clip.hardEdge:
context.canvas.clipPath(this.path_);
break;
case Clip.antiAlias:
context.canvas.clipPath(this.path_);
break;
case Clip.antiAliasWithSaveLayer:
context.canvas.clipPath(this.path_);
context.canvas.saveLayer(this.paintBounds, null);
saveCount++;
break;
case Clip.none:
break;
}
if (this.clip_behavior_ == Clip.antiAliasWithSaveLayer) {
//todo xingwei.zhu: drawPaint
context.canvas.drawPath(this.path_, paint);
}
context.canvas.clipPath(this._path);
for (int i = 0; i < saveCount; i++) {
context.canvas.restore();
}
context.canvas.restore();
}

2
Runtime/material/list_tile.cs


}
void _mountChild(Widget widget, _ListTileSlot slot) {
Element oldChild = this.slotToChild.ContainsKey(slot) ? this.slotToChild[slot] : null;
Element oldChild = this.slotToChild.getOrDefault(slot);
Element newChild = this.updateChild(oldChild, widget, slot);
if (oldChild != null) {
this.slotToChild.Remove(slot);

2
Runtime/material/scaffold.cs


FloatingActionButtonAnimator.scaling;
}
public enum _ScaffoldSlot {
enum _ScaffoldSlot {
body,
appBar,
bottomSheet,

15
Runtime/ui/compositing.cs


if (this._currentLayer == null) {
return;
}
var layer = new TextureLayer();
layer.offset = offset;
layer.size = new Size(width, height);

}
public void addPerformanceOverlay(int enabledOptions, Rect bounds) {
if (this._currentLayer == null) {
return;

public Layer pushPhysicalShape(Path path, float elevation, Color color, Color shadowColor, Clip clipBehavior) {
var layer = new PhysicalShapeLayer(clipBehavior);
layer.set_path(path);
layer.set_elevation(elevation);
layer.set_color(color);
layer.set_shadow_color(shadowColor);
layer.set_device_pixel_ratio(Window.instance.devicePixelRatio);
layer.path = path;
layer.elevation = elevation;
layer.color = color;
layer.shadowColor = shadowColor;
layer.devicePixelRatio = Window.instance.devicePixelRatio;
this._pushLayer(layer);
return layer;
}

6
Runtime/widgets/perferred_size.cs


using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.widgets {
public interface IPreferredSizeWidget {
public interface SizePreferred {
public abstract class PreferredSizeWidget : StatefulWidget, IPreferredSizeWidget {
public abstract class PreferredSizeWidget : StatefulWidget, SizePreferred {
protected PreferredSizeWidget(Key key = null) : base(key: key) {
}

public class PreferredSize : StatelessWidget, IPreferredSizeWidget {
public class PreferredSize : StatelessWidget, SizePreferred {
public PreferredSize(
Key key = null,
Widget child = null,

正在加载...
取消
保存