浏览代码

Merge branch 'shiyun/skia' into shiyun/cupertino/skia

/siyaoH-1.17-PlatformMessage
Shiyun Wen 4 年前
当前提交
5295a2ad
共有 11 个文件被更改,包括 257 次插入97 次删除
  1. 2
      com.unity.uiwidgets/Runtime/painting/box_decoration.cs
  2. 2
      com.unity.uiwidgets/Runtime/painting/decoration.cs
  3. 4
      com.unity.uiwidgets/Runtime/painting/shape_decoration.cs
  4. 18
      com.unity.uiwidgets/Runtime/rendering/box.mixin.gen.cs
  5. 1
      com.unity.uiwidgets/Runtime/rendering/editable.cs
  6. 6
      com.unity.uiwidgets/Runtime/rendering/object.cs
  7. 112
      com.unity.uiwidgets/Runtime/rendering/object.mixin.gen.cs
  8. 113
      com.unity.uiwidgets/Runtime/rendering/object.mixin.njk
  9. 57
      com.unity.uiwidgets/Runtime/rendering/paragraph.cs
  10. 28
      com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
  11. 11
      com.unity.uiwidgets/Runtime/rendering/proxy_box.mixin.gen.cs

2
com.unity.uiwidgets/Runtime/painting/box_decoration.cs


properties.add(new DiagnosticsProperty<BoxShape>("shape", shape, defaultValue: BoxShape.rectangle));
}
public override bool hitTest(Size size, Offset position) {
public override bool hitTest(Size size, Offset position, TextDirection textDirection) {
D.assert((Offset.zero & size).contains(position));
switch (shape) {
case BoxShape.rectangle:

2
com.unity.uiwidgets/Runtime/painting/decoration.cs


?? (t < 0.5 ? (a.lerpTo(null, t * 2.0f) ?? a) : (b.lerpFrom(null, (t - 0.5f) * 2.0f) ?? b));
}
public virtual bool hitTest(Size size, Offset position) {
public virtual bool hitTest(Size size, Offset position, TextDirection textDirection) {
return true;
}

4
com.unity.uiwidgets/Runtime/painting/shape_decoration.cs


properties.add(new DiagnosticsProperty<ShapeBorder>("shape", shape));
}
public override bool hitTest(Size size, Offset position) {
return shape.getOuterPath(Offset.zero & size).contains(position);
public override bool hitTest(Size size, Offset position, TextDirection textDirection) {
return shape.getOuterPath(Offset.zero & size, textDirection: textDirection).contains(position);
}
public override BoxPainter createBoxPainter(VoidCallback onChanged = null) {

18
com.unity.uiwidgets/Runtime/rendering/box.mixin.gen.cs


using System;
using UnityEngine;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.foundation;
using UnityEngine;
namespace Unity.UIWidgets.rendering {

}
}
public bool defaultHitTestChildren(BoxHitTestResult result, Offset position) {
ChildType child = lastChild;
while (child != null) {

position: position,
hitTest: (BoxHitTestResult boxHitTestResult, Offset transformed) => {
D.assert(transformed == position - childParentData.offset);
return child.hitTest(boxHitTestResult, position: transformed);
}
hitTest: (boxHitTestResult, transformed) => {
D.assert(transformed == position - childParentData.offset);
return child.hitTest(boxHitTestResult, position: transformed);
}
}
}
return false;
}

1
com.unity.uiwidgets/Runtime/rendering/editable.cs


}
public void systemFontsDidChange() {
base.systemFontsDidChange();
_textPainter.markNeedsLayout();
_textLayoutLastMaxWidth = null;
_textLayoutLastMinWidth = null;

6
com.unity.uiwidgets/Runtime/rendering/object.cs


RenderObject childAfter(RenderObject child);
}
public interface RelayoutWhenSystemFontsChangeMixin {
void systemFontsDidChange();
void attach(object owner);
void detach();
}
public class UIWidgetsErrorDetailsForRendering : UIWidgetsErrorDetails {
public UIWidgetsErrorDetailsForRendering(
Exception exception = null,

112
com.unity.uiwidgets/Runtime/rendering/object.mixin.gen.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;

public abstract class RelayoutWhenSystemFontsChangeMixinRenderBox : RenderBox {
public abstract class RelayoutWhenSystemFontsChangeMixinRenderBox : RenderBox, RelayoutWhenSystemFontsChangeMixin {
protected void systemFontsDidChange() {
public void systemFontsDidChange() {
markNeedsLayout();
}

}
public abstract class
RelayoutWhenSystemFontsChangeMixinRenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<ChildType, ParentDataType>
: RenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<ChildType, ParentDataType>
where ChildType : RenderBox
where ParentDataType : ContainerParentDataMixinBoxParentData<ChildType> {
public float? defaultComputeDistanceToFirstActualBaseline(TextBaseline baseline) {
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
float? result = child.getDistanceToActualBaseline(baseline);
if (result != null) {
return result.Value + childParentData.offset.dy;
}
child = childParentData.nextSibling;
}
return null;
}
public float? defaultComputeDistanceToHighestActualBaseline(TextBaseline baseline) {
float? result = null;
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
float? candidate = child.getDistanceToActualBaseline(baseline);
if (candidate != null) {
candidate += childParentData.offset.dy;
if (result != null) {
result = Mathf.Min(result.Value, candidate.Value);
} else {
result = candidate;
}
}
child = childParentData.nextSibling;
}
return result;
}
public void defaultPaint(PaintingContext context, Offset offset) {
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
context.paintChild(child, childParentData.offset + offset);
child = childParentData.nextSibling;
}
}
public bool defaultHitTestChildren(BoxHitTestResult result, Offset position) {
ChildType child = lastChild;
while (child != null) {
ParentDataType childParentData = child.parentData as ParentDataType;
bool isHit = result.addWithPaintOffset(
offset: childParentData.offset,
position: position,
hitTest: (BoxHitTestResult boxHitTestResult, Offset transformed) => {
D.assert(transformed == position - childParentData.offset);
return child.hitTest(boxHitTestResult, position: transformed);
}
);
if (isHit)
return true;
child = childParentData.previousSibling;
}
return false;
}
public List<ChildType> getChildrenAsList() {
var result = new List<ChildType>();
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
result.Add(child);
child = childParentData.nextSibling;
}
return result;
}
public void systemFontsDidChange() {
markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
PaintingBinding.instance.systemFonts.addListener(systemFontsDidChange);
}
public override void detach() {
PaintingBinding.instance.systemFonts.removeListener(systemFontsDidChange);
base.detach();
}
}
}

113
com.unity.uiwidgets/Runtime/rendering/object.mixin.njk


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEngine;

{{ RenderConstrainedLayoutBuilderMixin('abstract', 'RenderSliver', 'SliverConstraints') }}
{% macro RelayoutWhenSystemFontsChangeMixin(with) %}
public abstract class RelayoutWhenSystemFontsChangeMixin{{with}} : {{with}} {
public abstract class RelayoutWhenSystemFontsChangeMixin{{with}} : {{with}}, RelayoutWhenSystemFontsChangeMixin {
protected void systemFontsDidChange() {
public void systemFontsDidChange() {
markNeedsLayout();
}

{% endmacro %}
{{ RelayoutWhenSystemFontsChangeMixin('RenderBox') }}
{% macro RelayoutWhenSystemFontsChangeMixin(with) %}
public abstract class
RelayoutWhenSystemFontsChangeMixin{{with | safe}}
: {{with | safe}}
where ChildType : RenderBox
where ParentDataType : ContainerParentDataMixinBoxParentData<ChildType> {
public float? defaultComputeDistanceToFirstActualBaseline(TextBaseline baseline) {
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
float? result = child.getDistanceToActualBaseline(baseline);
if (result != null) {
return result.Value + childParentData.offset.dy;
}
child = childParentData.nextSibling;
}
return null;
}
public float? defaultComputeDistanceToHighestActualBaseline(TextBaseline baseline) {
float? result = null;
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
float? candidate = child.getDistanceToActualBaseline(baseline);
if (candidate != null) {
candidate += childParentData.offset.dy;
if (result != null) {
result = Mathf.Min(result.Value, candidate.Value);
} else {
result = candidate;
}
}
child = childParentData.nextSibling;
}
return result;
}
public void defaultPaint(PaintingContext context, Offset offset) {
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
context.paintChild(child, childParentData.offset + offset);
child = childParentData.nextSibling;
}
}
public bool defaultHitTestChildren(BoxHitTestResult result, Offset position) {
ChildType child = lastChild;
while (child != null) {
ParentDataType childParentData = child.parentData as ParentDataType;
bool isHit = result.addWithPaintOffset(
offset: childParentData.offset,
position: position,
hitTest: (BoxHitTestResult boxHitTestResult, Offset transformed) => {
D.assert(transformed == position - childParentData.offset);
return child.hitTest(boxHitTestResult, position: transformed);
}
);
if (isHit)
return true;
child = childParentData.previousSibling;
}
return false;
}
public List<ChildType> getChildrenAsList() {
var result = new List<ChildType>();
var child = firstChild;
while (child != null) {
var childParentData = (ParentDataType) child.parentData;
result.Add(child);
child = childParentData.nextSibling;
}
return result;
}
public void systemFontsDidChange() {
markNeedsLayout();
}
public override void attach(object owner) {
base.attach(owner);
PaintingBinding.instance.systemFonts.addListener(systemFontsDidChange);
}
public override void detach() {
PaintingBinding.instance.systemFonts.removeListener(systemFontsDidChange);
base.detach();
}
}
{% endmacro %}
{{ RelayoutWhenSystemFontsChangeMixin('RenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<ChildType, ParentDataType>')}}
}

57
com.unity.uiwidgets/Runtime/rendering/paragraph.cs


return string.Join("; ", values);
}
}
public class RenderParagraph : RenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<RenderBox, TextParentData> {
public class RenderParagraph : RelayoutWhenSystemFontsChangeMixinRenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<RenderBox, TextParentData> {
static readonly string _kEllipsis = "\u2026";
bool _softWrap;

}
}
public override void attach(object owner) {
public void attach(object owner) {
base.attach(owner);
/*if (_hoverAnnotation != null) {
RendererBinding.instance.mouseTracker.attachAnnotation(_hoverAnnotation);

var didOverflowWidth = size.width < textSize.width;
var hasVisualOverflow = didOverflowWidth || didOverflowHeight;
if (hasVisualOverflow) {
/*switch (_overflow) {
case TextOverflow.visible:
_needsClipping = false;
break;
case TextOverflow.clip:
case TextOverflow.ellipsis:
case TextOverflow.fade:
_needsClipping = true;
break;
}*/
//[!!!]need to replace it?
switch (_overflow) {
case TextOverflow.visible:
_needsClipping = false;

_overflowShader = null;
}
}
/*void paintParagraph(PaintingContext context, Offset offset) {
_layoutTextWithConstraints(constraints);
var canvas = context.canvas;
if (_needsClipping) {
var bounds = offset & size;
canvas.save();
canvas.clipRect(bounds);
}
if (_selection != null && selectionColor != null && _selection.isValid) {
if (!_selection.isCollapsed) {
_selectionRects =
_selectionRects ?? _textPainter.getBoxesForSelection(_selection);
_paintSelection(canvas, offset);
}
}
_textPainter.paint(canvas, offset);
if (_needsClipping) {
canvas.restore();
}
}
public override void paint(PaintingContext context, Offset offset) {
if (_hoverAnnotation != null) {
AnnotatedRegionLayer<MouseTrackerAnnotation> layer = new AnnotatedRegionLayer<MouseTrackerAnnotation>(
_hoverAnnotation, size: size, offset: offset);
context.pushLayer(layer, paintParagraph, offset);
}
else {
paintParagraph(context, offset);
}
} */
// [!!!]need to replace it?
public override void paint(PaintingContext context, Offset offset) {
_layoutTextWithConstraints(constraints);

_textPainter.layout(minWidth, widthMatters ? maxWidth : float.PositiveInfinity);
}
/*public override void systemFontsDidChange() {
public void systemFontsDidChange() {
}*/
}
List<PlaceholderDimensions> _placeholderDimensions;

28
com.unity.uiwidgets/Runtime/rendering/proxy_box.cs


}
protected override bool hitTestSelf(Offset position) {
return _decoration.hitTest(size, position);
// [!!!] function hitTest has no textDirection parameter, if add this parameter, another two function under
// painting folder have to change, too. I'm not sure if we need to add this.
// return _decoration.hitTest(size, position, textDirection: configuration.textDirection);
return _decoration.hitTest(size, position, textDirection: configuration.textDirection);
}
public override void paint(PaintingContext context, Offset offset) {

}
}
void _paintChildWithTransform(PaintingContext context, Offset offset) {
Offset childOffset = _transform.getAsTranslation();
if (childOffset == null) {
context.pushTransform(needsCompositing, offset, _transform, base.paint,
oldLayer: layer is TransformLayer ? layer as TransformLayer : null);
}
else {
base.paint(context, offset + childOffset);
}
}
/*TransformLayer _paintChildWithTransform(PaintingContext context, Offset offset) {
TransformLayer _paintChildWithTransform(PaintingContext context, Offset offset) {
Offset childOffset = _transform.getAsTranslation();
if (childOffset == null) {
return context.pushTransform(needsCompositing, offset, _transform, base.paint,

base.paint(context, offset + childOffset);
return null;
}
}*/
// [!!!] unable to change this function type from void to TransformLayer, context.pushClipRect() at line 2054
// Expected a method with 'void _paintChildWithTransform(PaintingContext, Offset)' signature
}
public override void paint(PaintingContext context, Offset offset) {
if (size.isEmpty || child.size.isEmpty) {
return;

if (child != null) {
if (_hasVisualOverflow == true) {
context.pushClipRect(needsCompositing, offset, Offset.zero & size,
painter: _paintChildWithTransform,
layer = context.pushClipRect(needsCompositing, offset, Offset.zero & size,
painter: (PaintingContext subContext, Offset subOffset) => { _paintChildWithTransform(subContext, subOffset); },
oldLayer: layer is ClipRectLayer ? layer as ClipRectLayer : null);
}
else{

11
com.unity.uiwidgets/Runtime/rendering/proxy_box.mixin.gen.cs


using Unity.UIWidgets.ui;
using Unity.UIWidgets.gestures;
using UnityEngine;
namespace Unity.UIWidgets.rendering {

child.parentData = new ParentData();
}
}
}
return 0.0f;

if (child != null) {
return child.getMinIntrinsicHeight(width);
}
}
return 0.0f;
}

protected override bool hitTestChildren(BoxHitTestResult result, Offset position = null) {
if (child != null) {
return child.hitTest(result, position);
}
return false;

正在加载...
取消
保存