浏览代码

Merge pull request #16 from Unity-Technologies/zxw/skiaBase

Fix compilation errors in rendering
/siyaoH-1.17-PlatformMessage
GitHub 4 年前
当前提交
ffeb157f
共有 30 个文件被更改,包括 523 次插入320 次删除
  1. 8
      com.unity.uiwidgets/Runtime/animation/animation_controller.cs
  2. 6
      com.unity.uiwidgets/Runtime/foundation/debug.cs
  3. 14
      com.unity.uiwidgets/Runtime/gestures/binding.cs
  4. 8
      com.unity.uiwidgets/Runtime/gestures/mouse_tracking.cs
  5. 20
      com.unity.uiwidgets/Runtime/painting/binding.cs
  6. 2
      com.unity.uiwidgets/Runtime/painting/image_stream.cs
  7. 2
      com.unity.uiwidgets/Runtime/rendering/animated_size.cs
  8. 2
      com.unity.uiwidgets/Runtime/rendering/box.cs
  9. 6
      com.unity.uiwidgets/Runtime/rendering/debug_overflow_indicator.cs
  10. 119
      com.unity.uiwidgets/Runtime/rendering/editable.cs
  11. 18
      com.unity.uiwidgets/Runtime/rendering/image.cs
  12. 216
      com.unity.uiwidgets/Runtime/rendering/layer.cs
  13. 4
      com.unity.uiwidgets/Runtime/rendering/object.cs
  14. 19
      com.unity.uiwidgets/Runtime/rendering/paragraph.cs
  15. 8
      com.unity.uiwidgets/Runtime/rendering/proxy_box.cs
  16. 2
      com.unity.uiwidgets/Runtime/rendering/sliver_persistent_header.cs
  17. 20
      com.unity.uiwidgets/Runtime/rendering/texture.cs
  18. 5
      com.unity.uiwidgets/Runtime/rendering/viewport_offset.cs
  19. 5
      com.unity.uiwidgets/Runtime/scheduler/binding.cs
  20. 3
      com.unity.uiwidgets/Runtime/scheduler/ticker.cs
  21. 138
      com.unity.uiwidgets/Runtime/ui2/compositing.cs
  22. 160
      com.unity.uiwidgets/Runtime/ui2/painting.cs
  23. 2
      com.unity.uiwidgets/Runtime/ui2/text.cs
  24. 8
      Samples/UIWidgetsSamples_2019_4/Assets/Resources.meta
  25. 8
      Samples/UIWidgetsSamples_2019_4/Assets/Scenes.meta
  26. 8
      com.unity.uiwidgets/Runtime/debugger.meta
  27. 8
      com.unity.uiwidgets/Runtime/editor.meta
  28. 8
      com.unity.uiwidgets/Runtime/promise.meta
  29. 8
      com.unity.uiwidgets/Runtime/redux.meta
  30. 8
      com.unity.uiwidgets/Runtime/cupertino.meta

8
com.unity.uiwidgets/Runtime/animation/animation_controller.cs


using System;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.physics;
using Unity.UIWidgets.scheduler;
using Ticker = Unity.UIWidgets.scheduler.Ticker;
using Ticker = Unity.UIWidgets.scheduler2.Ticker;
using TickerProvider = Unity.UIWidgets.scheduler.TickerProvider;
using TickerProvider = Unity.UIWidgets.scheduler2.TickerProvider;
namespace Unity.UIWidgets.animation {
enum _AnimationDirection {

? AnimationStatus.completed
: AnimationStatus.dismissed;
_checkStatusChanged();
return TickerFutureImpl.complete();
return TickerFuture.complete();
}
D.assert(simulationDuration > TimeSpan.Zero);

return true;
});
_ticker.dispose();
_ticker = null;
base.dispose();
}

6
com.unity.uiwidgets/Runtime/foundation/debug.cs


public static bool debugDisableOpacityLayers = false;
public static bool debugDisablePhysicalShapeLayers = false;
public static bool debugPrintMarkNeedsPaintStacks = false;
public static bool debugCheckIntrinsicSizes = false;

}
if (needRepaint) {
foreach (var adapter in WindowAdapter.windowAdapters) {
/*foreach (var adapter in WindowAdapter.windowAdapters) {
}
}*/
}
}
}

14
com.unity.uiwidgets/Runtime/gestures/binding.cs


using System.Collections.Generic;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
public new static GestureBinding instance {
get { return (GestureBinding) SchedulerBinding.instance; }
set { SchedulerBinding.instance = value; }
protected override void initInstances() {
base.initInstances();
instance = this;
}
public static GestureBinding instance {
get { return (GestureBinding) Window.instance._binding; }
private set { Window.instance._binding = value; }
}
public GestureBinding() {

8
com.unity.uiwidgets/Runtime/gestures/mouse_tracking.cs


using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.gestures {

_scheduleMousePositionCheck();
#if UNITY_EDITOR
_scheduleDragFromEditorMousePositionCheck();
//_scheduleDragFromEditorMousePositionCheck();
#endif
}

PointerExitEvent.fromMouseEvent(_lastMouseEvent[deviceId]));
}
#if UNITY_EDITOR
detachDragFromEditorAnnotation(annotation, deviceId);
//detachDragFromEditorAnnotation(annotation, deviceId);
#endif
}

}
#if UNITY_EDITOR
_handleDragFromEditorEvent(evt, deviceId);
//_handleDragFromEditorEvent(evt, deviceId);
#endif
}

20
com.unity.uiwidgets/Runtime/painting/binding.cs


namespace Unity.UIWidgets.painting {
public class PaintingBinding : GestureBinding {
// protected override void initInstances() {
// base.initInstances();
// instance = this;
// _imageCache = createImageCache();
//
// if (shaderWarmUp != null) {
// shaderWarmUp.execute();
// }
// }
protected override void initInstances() {
base.initInstances();
instance = this;
_imageCache = createImageCache();
if (shaderWarmUp != null) {
shaderWarmUp.execute();
}
}
set { GestureBinding.instance = value; }
set { Window.instance._binding = value; }
}
public static ShaderWarmUp shaderWarmUp = new DefaultShaderWarmUp();

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


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
using SchedulerBinding = Unity.UIWidgets.scheduler.SchedulerBinding;
using SchedulerBinding = Unity.UIWidgets.scheduler2.SchedulerBinding;
namespace Unity.UIWidgets.painting {
public class ImageInfo : IEquatable<ImageInfo> {

2
com.unity.uiwidgets/Runtime/rendering/animated_size.cs


using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
namespace Unity.UIWidgets.rendering {

2
com.unity.uiwidgets/Runtime/rendering/box.cs


D.assert(() => {
if (_debugActivePointers > 0) {
var paint = new Paint {
color = new Color(0x00BBBB | ((0x04000000 * depth) & 0xFF000000)),
color = new Color((uint)(0x00BBBB | ((0x04000000 * depth) & 0xFF000000))),
};
context.canvas.drawRect(offset & size, paint);
}

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


);
_labelBackgroundPaint.color = new Color(0xFFFFFFFF);
for (int i = 0; i < 4; i++) {
_indicatorLabel.Add(new TextPainter(new TextSpan(""), textDirection: TextDirection.ltr));
_indicatorLabel.Add(new TextPainter(textDirection: TextDirection.ltr));
}
}

List<_OverflowRegionData> overflowRegions = _calculateOverflowRegions(overflow, containerRect);
foreach (_OverflowRegionData region in overflowRegions) {
context.canvas.drawRect(region.rect.shift(offset), _indicatorPaint);
TextSpan textSpan = _indicatorLabel[(int) region.side].text as TextSpan;
if (_indicatorLabel[(int) region.side].text?.text != region.label) {
if (textSpan?.text != region.label) {
_indicatorLabel[(int) region.side].text = new TextSpan(
text: region.label,
style: _indicatorTextStyle

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


TextPainter _textPainter;
public TextSpan text {
get { return _textPainter.text; }
get { return _textPainter.text as TextSpan; }
set {
if (_textPainter.text == value) {
return;

return rect.shift(_getPixelPerfectCursorOffset(rect));
}
public TextPosition getPositionDown(TextPosition position) {
return _textPainter.getPositionVerticalMove(position, 1);
}
public TextPosition getPositionUp(TextPosition position) {
return _textPainter.getPositionVerticalMove(position, -1);
}
public TextPosition getLineStartPosition(TextPosition position, TextAffinity? affinity = null) {
var line = _textPainter.getLineRange(position);
return new TextPosition(offset: line.start, affinity: affinity ?? position.affinity);
}
public bool isLineEndOrStart(int offset) {
int lineCount = _textPainter.getLineCount();
for (int i = 0; i < lineCount; i++) {
var line = _textPainter.getLineRange(i);
if (line.start == offset || line.endIncludingNewLine == offset) {
return true;
}
}
return false;
}
public TextPosition getLineEndPosition(TextPosition position, TextAffinity? affinity = null) {
var line = _textPainter.getLineRange(position);
return new TextPosition(offset: line.endIncludingNewLine, affinity: affinity ?? position.affinity);
}
public TextPosition getWordRight(TextPosition position) {
return _textPainter.getWordRight(position);
}
public TextPosition getWordLeft(TextPosition position) {
return _textPainter.getWordLeft(position);
}
public TextPosition getParagraphStart(TextPosition position, TextAffinity? affinity = null) {
D.assert(!_needsLayout);
int lineIndex = _textPainter.getLineIndex(position);
while (lineIndex - 1 >= 0) {
var preLine = _textPainter.getLineRange(lineIndex - 1);
if (preLine.hardBreak) {
break;
}
lineIndex--;
}
var line = _textPainter.getLineRange(lineIndex);
return new TextPosition(offset: line.start, affinity: affinity ?? position.affinity);
}
public TextPosition getParagraphEnd(TextPosition position, TextAffinity? affinity = null) {
D.assert(!_needsLayout);
int lineIndex = _textPainter.getLineIndex(position);
int maxLine = _textPainter.getLineCount();
while (lineIndex < maxLine) {
var line = _textPainter.getLineRange(lineIndex);
if (line.hardBreak) {
break;
}
lineIndex++;
}
return new TextPosition(offset: _textPainter.getLineRange(lineIndex).endIncludingNewLine,
affinity: affinity ?? position.affinity);
}
public TextPosition getParagraphForward(TextPosition position, TextAffinity? affinity = null) {
var lineCount = _textPainter.getLineCount();
Paragraph.LineRange? line = null;
for (int i = 0; i < lineCount; ++i) {
line = _textPainter.getLineRange(i);
if (!line.Value.hardBreak) {
continue;
}
if (line.Value.end > position.offset) {
break;
}
}
if (line == null) {
return new TextPosition(position.offset, affinity ?? position.affinity);
}
return new TextPosition(line.Value.end, affinity ?? position.affinity);
}
public TextPosition getParagraphBackward(TextPosition position, TextAffinity? affinity = null) {
var lineCount = _textPainter.getLineCount();
Paragraph.LineRange? line = null;
for (int i = lineCount - 1; i >= 0; --i) {
line = _textPainter.getLineRange(i);
if (i != 0 && !_textPainter.getLineRange(i - 1).hardBreak) {
continue;
}
if (line.Value.start < position.offset) {
break;
}
}
if (line == null) {
return new TextPosition(position.offset, affinity ?? position.affinity);
}
return new TextPosition(line.Value.start, affinity ?? position.affinity);
}
protected override float computeMinIntrinsicWidth(float height) {
_layoutText(float.PositiveInfinity);
return _textPainter.minIntrinsicWidth;

}
if (!width.isFinite()) {
var text = _textPainter.text.text;
var text = _textPainter.text.toPlainText();
int lines = 1;
for (int index = 0; index < text.Length; ++index) {
if (text[index] == 0x0A) {

18
com.unity.uiwidgets/Runtime/rendering/image.cs


ImageRepeat repeat = ImageRepeat.noRepeat,
Rect centerSlice = null,
bool invertColors = false,
FilterMode filterMode = FilterMode.Bilinear
FilterQuality filterQuality = FilterQuality.low
) {
_image = image;
_width = width;

_centerSlice = centerSlice;
_alignment = alignment ?? Alignment.center;
_invertColors = invertColors;
_filterMode = filterMode;
_filterQuality = filterQuality;
_updateColorFilter();
}

}
}
FilterMode _filterMode;
FilterQuality _filterQuality;
public FilterMode filterMode {
get { return _filterMode; }
public FilterQuality filterQuality {
get { return _filterQuality; }
if (value == _filterMode) {
if (value == _filterQuality) {
_filterMode = value;
_filterQuality = value;
markNeedsPaint();
}
}

centerSlice: _centerSlice,
repeat: _repeat,
invertColors: _invertColors,
filterMode: _filterMode
filterQuality: _filterQuality
);
}

properties.add(new DiagnosticsProperty<Rect>("centerSlice", centerSlice,
defaultValue: foundation_.kNullDefaultValue));
properties.add(new DiagnosticsProperty<bool>("invertColors", invertColors));
properties.add(new EnumProperty<FilterMode>("filterMode", filterMode));
properties.add(new EnumProperty<FilterQuality>("filterMode", filterQuality));
}
}
}

216
com.unity.uiwidgets/Runtime/rendering/layer.cs


using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using UnityEngine;
using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;

get { return (ContainerLayer) base.parent; }
}
bool _needsAddToScene = true;
public bool _needsAddToScene = true;
if (_needsAddToScene) {
return;
}
_needsAddToScene = true;
}

internal bool _subtreeNeedsAddToScene;
flow.Layer _engineLayer;
protected EngineLayer engineLayer {
get { return _engineLayer; }
set {
_engineLayer = value;
if (!alwaysNeedsAddToScene) {
if (parent != null && !parent.alwaysNeedsAddToScene) {
parent.markNeedsAddToScene();
}
}
}
}
EngineLayer _engineLayer;
_subtreeNeedsAddToScene = _needsAddToScene || alwaysNeedsAddToScene;
_needsAddToScene = _needsAddToScene || alwaysNeedsAddToScene;
}
public Layer nextSibling {

internal Layer _previousSibling;
protected override void dropChild(AbstractNodeMixinDiagnosticableTree child) {
markNeedsAddToScene();
if (!alwaysNeedsAddToScene) {
markNeedsAddToScene();
}
markNeedsAddToScene();
if (!alwaysNeedsAddToScene) {
markNeedsAddToScene();
}
base.adoptChild(child);
}

internal abstract S find<S>(Offset regionOffset) where S : class;
internal abstract flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null);
internal abstract void addToScene(SceneBuilder builder, Offset layerOffset = null);
if (!_subtreeNeedsAddToScene && _engineLayer != null) {
if (!_needsAddToScene && _engineLayer != null) {
_engineLayer = addToScene(builder);
addToScene(builder);
_needsAddToScene = false;
}

return null;
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
return null;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

public class TextureLayer : Layer {
public TextureLayer(
Rect rect,
Texture texture,
int textureId,
D.assert(texture != null);
this.texture = texture;
this.textureId = textureId;
public readonly Texture texture;
public readonly int textureId;
public readonly bool freeze;

internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
texture,
textureId,
return null;
}
}

PictureLayer _highlightConflictingLayer(PhysicalModelLayer child) {
PictureRecorder recorder = new PictureRecorder();
var canvas = new RecorderCanvas(recorder);
var canvas = new Canvas(recorder);
canvas.drawPath(child.clipPath, new Paint() {
color = new Color(0xFFAA0000),
style = PaintingStyle.stroke,

Layer child = firstChild;
while (child != null) {
child.updateSubtreeNeedsAddToScene();
_subtreeNeedsAddToScene = _subtreeNeedsAddToScene || child._subtreeNeedsAddToScene;
_needsAddToScene = _needsAddToScene || child._needsAddToScene;
child = child.nextSibling;
}
}

_lastChild = null;
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
return null;
}
public void addChildrenToScene(SceneBuilder builder, Offset childOffset = null) {

return scene;
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
var engineLayer = builder.pushOffset(
engineLayer = builder.pushOffset(
(float) (layerOffset.dy + offset.dy));
(float) (layerOffset.dy + offset.dy),
oldLayer: engineLayer as OffsetEngineLayer);
return engineLayer;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

return base.find<S>(regionOffset);
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
bool enabled = true;

});
if (enabled) {
builder.pushClipRect(clipRect.shift(layerOffset));
var shiftedClipRect = layerOffset == Offset.zero ? clipRect : clipRect.shift(layerOffset);
engineLayer = builder.pushClipRect(
rect: shiftedClipRect,
clipBehavior: clipBehavior,
oldLayer: engineLayer as ClipRectEngineLayer);
}
else {
engineLayer = null;
}
addChildrenToScene(builder, layerOffset);

}
return null;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

return base.find<S>(regionOffset);
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
bool enabled = true;

});
if (enabled) {
builder.pushClipRRect(clipRRect.shift(layerOffset));
var shiftedClipRRect = layerOffset == Offset.zero ? clipRRect : clipRRect.shift(layerOffset);
engineLayer = builder.pushClipRRect(
shiftedClipRRect,
clipBehavior: clipBehavior,
oldLayer: engineLayer as ClipRRectEngineLayer
);
}
else {
engineLayer = null;
}
addChildrenToScene(builder, layerOffset);

}
return null;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

return base.find<S>(regionOffset);
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
bool enabled = true;

});
if (enabled) {
builder.pushClipPath(clipPath.shift(layerOffset));
var shiftedPath = layerOffset == Offset.zero ? clipPath : clipPath.shift(layerOffset);
engineLayer = builder.pushClipPath(
shiftedPath,
clipBehavior: clipBehavior,
oldLayer: engineLayer as ClipPathEngineLayer);
}
else {
engineLayer = null;
}
addChildrenToScene(builder, layerOffset);

}
return null;
}
}

return base.find<S>(new Offset(result[0], result[1]));
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
_lastEffectiveTransform = _transform;

_lastEffectiveTransform.multiply(transform);
}
builder.pushTransform(_lastEffectiveTransform.toMatrix3());
engineLayer = builder.pushTransform(
_lastEffectiveTransform._m4storage,
oldLayer: engineLayer as TransformEngineLayer);
return null;
}
public override void applyTransform(Layer child, Matrix4 transform) {

}
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
bool enabled = true;

});
builder.pushOpacity(alpha, offset: offset + layerOffset);
engineLayer = builder.pushOpacity(
alpha,
offset: offset + layerOffset,
oldLayer: engineLayer as OpacityEngineLayer);
}
else {
engineLayer = null;
}
addChildrenToScene(builder, layerOffset);

return null;
}
public override void debugFillProperties(DiagnosticPropertiesBuilder properties) {

}
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
builder.pushBackdropFilter(filter);
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
D.assert(filter != null);
engineLayer = builder.pushBackdropFilter(
filter: filter,
oldLayer: engineLayer as BackdropFilterEngineLayer);
return null;
}
}

return base.find<S>(regionOffset - offset);
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
builder.pushTransform(new Matrix4()
engineLayer = builder.pushTransform(
new Matrix4()
.toMatrix3());
._m4storage,
oldLayer: engineLayer as TransformEngineLayer);
}
addChildrenToScene(builder, Offset.zero);

return null;
}
public override void applyTransform(Layer child, Matrix4 transform) {

}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
D.assert(link != null);

_inverseDirty = true;
return null;
engineLayer = null;
builder.pushTransform(_lastTransform.toMatrix3());
engineLayer = builder.pushTransform(
_lastTransform._m4storage,
oldLayer: engineLayer as TransformEngineLayer);
addChildrenToScene(builder);
builder.pop();
_lastOffset = unlinkedOffset + layerOffset;

var matrix = new Matrix4().translationValues(unlinkedOffset.dx, unlinkedOffset.dy, 0);
builder.pushTransform(matrix.toMatrix3());
engineLayer = builder.pushTransform(
matrix._m4storage,
oldLayer: engineLayer as TransformEngineLayer);
return null;
}
public override void applyTransform(Layer child, Matrix4 transform) {

return null;
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
layerOffset = layerOffset ?? Offset.zero;
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
D.assert(optionsMask != null);
builder.addPerformanceOverlay(optionsMask, overlayRect.shift(layerOffset));
return null;
layerOffset = layerOffset ?? Offset.zero;
var shiftedOverlayRect = layerOffset == Offset.zero ? overlayRect : overlayRect.shift(layerOffset);
builder.addPerformanceOverlay(optionsMask, shiftedOverlayRect);
//TODO: add implementations
//builder.setRasterizerTracingThreshold(rasterizerThreshold);
//builder.setCheckerboardRasterCacheImages(checkerboardRasterCacheImages);
//builder.setCheckerboardOffscreenLayers(checkerboardOffscreenLayers);
}
}

ancestor = ancestor.parent;
}
return clipPath.transform(matrix.toMatrix3());
return clipPath.transform(matrix._m4storage);
}
}

return base.find<S>(regionOffset);
}
internal override flow.Layer addToScene(SceneBuilder builder, Offset layerOffset = null) {
internal override void addToScene(SceneBuilder builder, Offset layerOffset = null) {
D.assert(clipPath != null);
D.assert(color != null);
D.assert(shadowColor != null);
builder.pushPhysicalShape(
path: clipPath.shift(layerOffset),
elevation: elevation,
color: color,
shadowColor: shadowColor,
clipBehavior: clipBehavior);
bool enabled = true;
D.assert(() => {
enabled = !D.debugDisablePhysicalShapeLayers;
return true;
});
if (enabled) {
engineLayer = builder.pushPhysicalShape(
path: layerOffset == Offset.zero ? clipPath : clipPath.shift(layerOffset),
elevation: elevation,
color: color,
shadowColor: shadowColor,
clipBehavior: clipBehavior,
oldLayer: engineLayer as PhysicalShapeEngineLayer);
}
else {
engineLayer = null;
}
builder.pop();
return null;
if (enabled) {
builder.pop();
}
}

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


_currentLayer = new PictureLayer(estimatedBounds);
_recorder = new PictureRecorder();
_canvas = new RecorderCanvas(_recorder);
_canvas = new Canvas(_recorder);
_containerLayer.append(_currentLayer);
}

}
else {
canvas.save();
canvas.concat(effectiveTransform.toMatrix3());
canvas.transform(effectiveTransform._m4storage);
painter(this, offset);
canvas.restore();
}

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


using Canvas = Unity.UIWidgets.ui.Canvas;
using Color = Unity.UIWidgets.ui.Color;
using Rect = Unity.UIWidgets.ui.Rect;
using StrutStyle = Unity.UIWidgets.painting.StrutStyle;
namespace Unity.UIWidgets.rendering {
public enum TextOverflow {

}
}
public TextSpan text {
public InlineSpan text {
get { return _textPainter.text; }
set {

}
}
TextSpan _previousHoverSpan;
InlineSpan _previousHoverSpan;
#pragma warning disable 0414
bool _pointerHoverInside;

void _resetHoverHandler() {
_hasHoverRecognizer = _textPainter.text.hasHoverRecognizer;
_hasHoverRecognizer = (_textPainter.text as TextSpan)?.hasHoverRecognizer ?? false;
_previousHoverSpan = null;
_pointerHoverInside = false;

void _onPointerExit(PointerEvent evt) {
_pointerHoverInside = false;
_previousHoverSpan?.hoverRecognizer?.OnPointerLeave?.Invoke();
(_previousHoverSpan as TextSpan)?.hoverRecognizer?.OnPointerLeave?.Invoke();
_previousHoverSpan = null;
}

TextPosition position = _textPainter.getPositionForOffset(offset);
TextSpan span = _textPainter.text.getSpanForPosition(position);
InlineSpan span = _textPainter.text.getSpanForPosition(position);
_previousHoverSpan?.hoverRecognizer?.OnPointerLeave?.Invoke();
span?.hoverRecognizer?.OnPointerEnter?.Invoke((PointerHoverEvent) evt);
(_previousHoverSpan as TextSpan)?.hoverRecognizer?.OnPointerLeave?.Invoke();
(span as TextSpan)?.hoverRecognizer?.OnPointerEnter?.Invoke((PointerHoverEvent) evt);
_previousHoverSpan = span;
}
}

_layoutTextWithConstraints(constraints);
Offset offset = ((BoxHitTestEntry) entry).localPosition;
TextPosition position = _textPainter.getPositionForOffset(offset);
TextSpan span = _textPainter.text.getSpanForPosition(position);
span?.recognizer?.addPointer((PointerDownEvent) evt);
InlineSpan span = _textPainter.text.getSpanForPosition(position);
(span as TextSpan)?.recognizer?.addPointer((PointerDownEvent) evt);
}
protected override void performLayout() {

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


D.assert(() => {
if (child != null) {
base.debugPaintSize(context, offset);
Path offsetPath = new Path();
offsetPath.addPath(_clip, offset);
context.canvas.drawPath(offsetPath, _debugPaint);
context.canvas.drawPath(_clip.shift(offset), _debugPaint);
_debugText.paint(context.canvas, offset);
}

if (child != null) {
_updateClip();
Rect offsetBounds = offset & size;
Path offsetPath = new Path();
offsetPath.addPath(_clip, offset);
Path offsetPath = _clip.shift(offset);
PhysicalModelLayer physicalModel = new PhysicalModelLayer(
clipPath: offsetPath,

shadowColor: shadowColor);
context.pushLayer(physicalModel, base.paint, offset, childPaintBounds: offsetBounds);
}
}

2
com.unity.uiwidgets/Runtime/rendering/sliver_persistent_header.cs


using Unity.UIWidgets.foundation;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.scheduler;
using Unity.UIWidgets.scheduler2;
using Unity.UIWidgets.ui;
using UnityEngine;

20
com.unity.uiwidgets/Runtime/rendering/texture.cs


namespace Unity.UIWidgets.rendering {
public class TextureBox : RenderBox {
public TextureBox(Texture texture = null) {
D.assert(texture != null);
_texture = texture;
public TextureBox(int textureId) {
D.assert(textureId != null);
_textureId = textureId;
public Texture texture {
get { return _texture; }
public int textureId {
get { return _textureId; }
if (value != _texture) {
_texture = value;
if (value != _textureId) {
_textureId = value;
Texture _texture;
int _textureId;
protected override bool sizedByParent {
get { return true; }

}
public override void paint(PaintingContext context, Offset offset) {
if (_texture == null) {
if (_textureId == null) {
texture: _texture
textureId: _textureId
));
}
}

5
com.unity.uiwidgets/Runtime/rendering/viewport_offset.cs


using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.async2;
using Unity.UIWidgets.foundation;

public virtual Future moveTo(float to, TimeSpan? duration, Curve curve = null, bool clamp = true) {
if (duration == null || duration.Value == TimeSpan.Zero) {
jumpTo(to);
return Promise.Resolved();
return Future.value();
} else {
return animateTo(to, duration: duration??TimeSpan.Zero , curve: curve ?? Curves.ease);
}

}
public override Future animateTo(float to, TimeSpan duration, Curve curve) {
return Promise.Resolved();
return Future.value();
}
public override ScrollDirection userScrollDirection {

5
com.unity.uiwidgets/Runtime/scheduler/binding.cs


using System;
/*
using System;
using System.Collections.Generic;
using System.Text;
using RSG.Promises;

});
}
}
}
}*/

3
com.unity.uiwidgets/Runtime/scheduler/ticker.cs


/*
using System;
using System.Text;
using RSG;

return "The ticker was canceled before the \"orCancel\" property was first used.";
}
}
}
}*/

138
com.unity.uiwidgets/Runtime/ui2/compositing.cs


return layer;
}
public ClipRectEngineLayer pushClipRect(
Rect rect,
Clip clipBehavior = Clip.antiAlias,
ClipRectEngineLayer oldLayer = null) {
D.assert(clipBehavior != Clip.none);
D.assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, "pushClipRect"));
ClipRectEngineLayer layer = new ClipRectEngineLayer(SceneBuilder_pushClipRect(_ptr, rect.left, rect.right, rect.top, rect.bottom, (int)clipBehavior));
D.assert(_debugPushLayer(layer));
return layer;
}
public unsafe ClipRRectEngineLayer pushClipRRect(
RRect rrect,
Clip clipBehavior = Clip.antiAlias,
ClipRRectEngineLayer oldLayer = null) {
D.assert(clipBehavior != Clip.none);
D.assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, "pushClipRRect"));
fixed (float* rrectPtr = rrect._value32) {
ClipRRectEngineLayer layer =
new ClipRRectEngineLayer(SceneBuilder_pushClipRRect(_ptr, rrectPtr, (int) clipBehavior));
D.assert(_debugPushLayer(layer));
return layer;
}
}
public ClipPathEngineLayer pushClipPath(
Path path,
Clip clipBehavior = Clip.antiAlias,
ClipPathEngineLayer oldLayer = null) {
D.assert(clipBehavior != Clip.none);
D.assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, "pushClipPath"));
ClipPathEngineLayer layer = new ClipPathEngineLayer(SceneBuilder_pushClipPath(_ptr, path._ptr, (int)clipBehavior));
D.assert(_debugPushLayer(layer));
return layer;
}
public OpacityEngineLayer pushOpacity(
int alpha,
Offset offset = null,
OpacityEngineLayer oldLayer = null) {
offset = offset ?? Offset.zero;
D.assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, "pushOpacity"));
OpacityEngineLayer layer = new OpacityEngineLayer(SceneBuilder_pushOpacity(_ptr, alpha, offset.dx, offset.dy));
D.assert(_debugPushLayer(layer));
return layer;
}
public BackdropFilterEngineLayer pushBackdropFilter(
ImageFilter filter,
BackdropFilterEngineLayer oldLayer = null) {
D.assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, "pushBackdropFilter"));
BackdropFilterEngineLayer layer = new BackdropFilterEngineLayer(SceneBuilder_pushBackdropFilter(_ptr, filter._toNativeImageFilter()._ptr));
D.assert(_debugPushLayer(layer));
return layer;
}
public PhysicalShapeEngineLayer pushPhysicalShape(
Path path,
float elevation,
Color color,
Color shadowColor,
Clip clipBehavior = Clip.none,
PhysicalShapeEngineLayer oldLayer = null) {
D.assert(_debugCheckCanBeUsedAsOldLayer(oldLayer, "PhysicalShapeEngineLayer"));
PhysicalShapeEngineLayer layer = new PhysicalShapeEngineLayer(SceneBuilder_pushPhysicalShape(_ptr, path._ptr, elevation, color.value, shadowColor?.value ?? 0xFF000000, (int)clipBehavior));
D.assert(_debugPushLayer(layer));
return layer;
}
public void pop() {
if (_layerStack.isNotEmpty()) {
_layerStack.removeLast();

SceneBuilder_addRetained(_ptr, wrapper._ptr);
}
public void addPerformanceOverlay(int enabledOptions, Rect bounds) {
SceneBuilder_addPerformanceOverlay(enabledOptions, bounds.left, bounds.right, bounds.top, bounds.bottom);
}
public void addPicture(
Offset offset,
Picture picture,

[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushOffset(IntPtr ptr, float dx, float dy);
/*
[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushClipRect(IntPtr ptr, float left, float right, float top, float bottom,
int clipBehavior);*/
static IntPtr SceneBuilder_pushClipRect(IntPtr ptr, float left, float right, float top, float bottom,
int clipBehavior) {
D.assert(false, () => "SceneBuilder_pushClipRect is not implemented yet!");
return IntPtr.Zero;
}
/*
[DllImport(NativeBindings.dllName)]
static extern unsafe IntPtr SceneBuilder_pushClipRRect(IntPtr ptr, float* rrect, int clipBehavior);*/
static unsafe IntPtr SceneBuilder_pushClipRRect(IntPtr ptr, float* rrect, int clipBehavior) {
D.assert(false, () => "SceneBuilder_pushClipRRect is not implemented yet!");
return IntPtr.Zero;
}
/*
[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushClipPath(IntPtr ptr, IntPtr path, int clipBehavior);*/
static unsafe IntPtr SceneBuilder_pushClipPath(IntPtr ptr, IntPtr path, int clipBehavior) {
D.assert(false, () => "SceneBuilder_pushClipPath is not implemented yet!");
return IntPtr.Zero;
}
/*
[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushOpacity(IntPtr ptr, int alpha, float dx, float dy);*/
static IntPtr SceneBuilder_pushOpacity(IntPtr ptr, int alpha, float dx, float dy) {
D.assert(false, () => "SceneBuilder_pushOpacity is not implemented yet!");
return IntPtr.Zero;
}
/*
[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushBackdropFilter(IntPtr ptr, IntPtr filter);*/
static IntPtr SceneBuilder_pushBackdropFilter(IntPtr ptr, IntPtr filter) {
D.assert(false, () => "SceneBuilder_pushBackdropFilter is not implemented yet!");
return IntPtr.Zero;
}
/*
[DllImport(NativeBindings.dllName)]
static extern void SceneBuilder_addPerformanceOverlay(int enabledOptions, float left, float right, float top,
float bottom);*/
static void SceneBuilder_addPerformanceOverlay(int enabledOptions, float left, float right, float top,
float bottom) {
D.assert(false, () => "SceneBuilder_addPerformanceOverlay is not implemented yet!");
}
/*
[DllImport(NativeBindings.dllName)]
static extern IntPtr SceneBuilder_pushPhysicalShape(IntPtr ptr, IntPtr path, float evelation, uint color,
uint shadowColor, int clipBehavior);*/
static IntPtr SceneBuilder_pushPhysicalShape(IntPtr ptr, IntPtr path, float elevation, uint color,
uint shadowColor, int clipBehavior) {
D.assert(false, () => "SceneBuilder_pushPhysicalShape is not implemented yet!");
return IntPtr.Zero;
}
[DllImport(NativeBindings.dllName)]
static extern void SceneBuilder_pop(IntPtr ptr);

160
com.unity.uiwidgets/Runtime/ui2/painting.cs


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;

"Path.combine() failed. This may be due an invalid path; in particular, check for NaN values.");
}
public PathMetrics computeMetrics(bool forceClose = false) {
return new PathMetrics(this, forceClose);
}
[DllImport(NativeBindings.dllName)]
static extern IntPtr Path_constructor();

}
}
public class PathMetrics : IEnumerable<PathMetric> {
public PathMetrics(Path path, bool forceClosed) {
_iterator = new PathMetricIterator(new _PathMeasure(path, forceClosed));
}
readonly IEnumerator<PathMetric> _iterator;
public IEnumerator<PathMetric> GetEnumerator() {
return _iterator;
}
IEnumerator IEnumerable.GetEnumerator() {
return GetEnumerator();
}
}
public class PathMetricIterator : IEnumerator<PathMetric> {
public PathMetricIterator(_PathMeasure pathMeasure) {
D.assert(pathMeasure != null);
_pathMeasure = pathMeasure;
}
PathMetric _pathMetric;
readonly _PathMeasure _pathMeasure;
public bool MoveNext() {
if (_pathMeasure._nextContour()) {
_pathMetric = new PathMetric(_pathMeasure);
return true;
}
_pathMetric = null;
return false;
}
public void Reset() {
D.assert(false, () => "PathMetricIterator.Reset is not implemented yet !");
}
public PathMetric Current {
get {
PathMetric currentMetric = _pathMetric;
if (currentMetric == null) {
throw new Exception("PathMetricIterator is not pointing to a PathMetric. This can happen in two situations:\n" +
"- The iteration has not started yet. If so, call \"moveNext\" to start iteration." +
"- The iterator ran out of elements. If so, check that \"moveNext\" returns true prior to calling \"current\".");
}
return currentMetric;
}
}
object IEnumerator.Current {
get { return Current; }
}
public void Dispose() {
}
}
public class PathMetric {
public PathMetric(_PathMeasure measure) {
D.assert(measure != null);
_measure = measure;
length = _measure.length(_measure.currentContourIndex);
isClosed = _measure.isClosed(_measure.currentContourIndex);
contourIndex = _measure.currentContourIndex;
}
public readonly float length;
public readonly bool isClosed;
public readonly int contourIndex;
readonly _PathMeasure _measure;
}
public class _PathMeasure : NativeWrapper {
public _PathMeasure(Path path, bool forceClosed) : base(PathMeasure_constructor(path._ptr, forceClosed)) {
}
protected override void DisposePtr(IntPtr ptr) {
PathMeasure_dispose(ptr);
}
public int currentContourIndex = -1;
public float length(int contourIndex) {
D.assert(contourIndex <= currentContourIndex, () => $"Iterator must be advanced before index {contourIndex} can be used.");
return PathMeasure_length(contourIndex);
}
public bool isClosed(int contourIndex) {
D.assert(contourIndex <= currentContourIndex, () => $"Iterator must be advanced before index {contourIndex} can be used.");
return PathMeasure_isClosed(contourIndex);
}
public bool _nextContour() {
bool next = PathMeasure_nativeNextContour();
if (next) {
currentContourIndex++;
}
return next;
}
/*
[DllImport(NativeBindings.dllName)]
static extern IntPtr PathMeasure_constructor(IntPtr path, bool forcedClosed);*/
static IntPtr PathMeasure_constructor(IntPtr path, bool forcedClosed) {
D.assert(false, () => "PathMeasure_constructor is not implemented yet!");
return IntPtr.Zero;
}
/*
[DllImport(NativeBindings.dllName)]
static extern void PathMeasure_dispose(IntPtr ptr);*/
static void PathMeasure_dispose(IntPtr ptr) {
D.assert(false, () => "PathMeasure_dispose is not implemented yet!");
}
/*
[DllImport(NativeBindings.dllName)]
static extern float PathMeasure_length(int contourIndex);*/
static float PathMeasure_length(int contourIndex) {
D.assert(false, () => "PathMeasure_length is not implemented yet!");
return 0;
}
/*
[DllImport(NativeBindings.dllName)]
static extern bool PathMeasure_isClosed(int contourIndex);*/
static bool PathMeasure_isClosed(int contourIndex) {
D.assert(false, () => "PathMeasure_isClosed is not implemented yet!");
return true;
}
/*
[DllImport(NativeBindings.dllName)]
static extern bool PathMeasure_nativeNextContour();*/
static bool PathMeasure_nativeNextContour() {
D.assert(false, () => "PathMeasure_nativeNextContour is not implemented yet!");
return false;
}
}
public class ColorFilter : IEquatable<ColorFilter> {
ColorFilter(Color color, BlendMode? blendMode, float[] matrix, int type) {
_color = color;

}
}
class _ImageFilter : NativeWrapper {
internal class _ImageFilter : NativeWrapper {
_ImageFilter(IntPtr ptr, ImageFilter creator) : base(ptr) {
this.creator = creator;
}

2
com.unity.uiwidgets/Runtime/ui2/text.cs


public readonly TextDirection direction;
Rect toRect() => Rect.fromLTRB((float) left, (float) top, (float) right, (float) bottom);
public Rect toRect() => Rect.fromLTRB((float) left, (float) top, (float) right, (float) bottom);
public float start {
get { return (direction == TextDirection.ltr) ? left : right; }

8
Samples/UIWidgetsSamples_2019_4/Assets/Resources.meta


fileFormatVersion: 2
guid: 77196fe8699ab4d4ebcdcd40d51ad725
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Samples/UIWidgetsSamples_2019_4/Assets/Scenes.meta


fileFormatVersion: 2
guid: 1bcee10b13adf455985ead00596cf877
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
com.unity.uiwidgets/Runtime/debugger.meta


fileFormatVersion: 2
guid: c0866eca57e1b4131977c85fa974ce37
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
com.unity.uiwidgets/Runtime/editor.meta


fileFormatVersion: 2
guid: a9499ff15faa04b8cb4281fab5a966f1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
com.unity.uiwidgets/Runtime/promise.meta


fileFormatVersion: 2
guid: bec4d0b4a41b94eb49b1912f962f12fc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
com.unity.uiwidgets/Runtime/redux.meta


fileFormatVersion: 2
guid: 3a7bb5e4fb043482e8bf223c2d3fa76c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
com.unity.uiwidgets/Runtime/cupertino.meta


fileFormatVersion: 2
guid: 30914a0a38eca48bfa7c425f084a3684
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存