public override void OnInitialize() { base.OnInitialize(); textSpan = ((UITextElement)element).textSpan; lastGeometryVersion = -1; geometry.Clear(); ranges.Clear(); }
public void Clear() { _content.Clear(); _mappings.Clear(); _sources.Clear(); _lastSourceIndex = 0; _lastSourceLine = 0; _lastSourceCol = 0; }
public void Indent() { _lineSink.Print(_main !); foreach (var propLine in _propLines) { _lineSink.Print(propLine); } _propLines.Clear(); _indent++; }
public static bool ParseSignature(TokenStream tokenStream, StructList <LambdaArgument> signature) { ExpressionParser parser = new ExpressionParser(tokenStream); bool retn = parser.ParseLambdaSignature(ref signature); parser.Release(); if (!retn) { signature.Clear(); } return(retn); }
private void ResetSharedStyles(LightList <UIStyleGroupContainer> updatedStyles) { int count = updatedStyles.Count; UIStyleGroupContainer[] updatedStyleArray = updatedStyles.array; for (int i = 0; i < styleGroupContainers.size; i++) { if (!updatedStyles.Contains(styleGroupContainers.array[i])) { for (int j = 0; j < styleGroupContainers.array[i].groups.Length; j++) { RunCommands(styleGroupContainers.array[i].groups[j].normal.runCommands, false); } } } availableStyles.Clear(); styleGroupContainers.Clear(); isInheritedMap = 0; propertyMap.Clear(); styleGroupContainers.EnsureCapacity(updatedStyles.size); containedStates = 0; hasAttributeStyles = false; LightList <StylePropertyId> toUpdate = LightList <StylePropertyId> .Get(); if (instanceStyle != null) { CreateStyleEntry(toUpdate, instanceStyle, instanceStyle.normal, StyleType.Instance, StyleState.Normal, 0); CreateStyleEntry(toUpdate, instanceStyle, instanceStyle.hover, StyleType.Instance, StyleState.Hover, 0); CreateStyleEntry(toUpdate, instanceStyle, instanceStyle.focused, StyleType.Instance, StyleState.Focused, 0); CreateStyleEntry(toUpdate, instanceStyle, instanceStyle.active, StyleType.Instance, StyleState.Active, 0); } for (int i = 0; i < count; i++) { CreateStyleGroups(updatedStyleArray[i], toUpdate); styleGroupContainers.array[i] = updatedStyleArray[i]; } styleGroupContainers.size = count; SortStyles(); UpdatePropertyMap(toUpdate); LightList <StylePropertyId> .Release(ref toUpdate); }
public bool Deserialize(out object? @object, ByteBuffer buffer) { lock (_lock) { _reader.Restart(buffer); @object = null; try { @object = LoadObject(); } catch (BtdbMissingMetadataException) { return(false); } finally { _visited.Clear(); } _reader.Restart(ByteBuffer.NewEmpty()); return(true); } }
public void ClearDiagnostics() { _diagnostics.Clear(); }
public void ProcessMetadataLog(ByteBuffer buffer) { lock (_lock) { var reader = new ByteBufferReader(buffer); var typeId = reader.ReadVInt32(); while (typeId != 0) { var typeCategory = (TypeCategory)reader.ReadUInt8(); ITypeDescriptor descriptor; switch (typeCategory) { case TypeCategory.BuildIn: throw new ArgumentOutOfRangeException(); case TypeCategory.Class: descriptor = new ObjectTypeDescriptor(this, reader, NestedDescriptorReader); break; case TypeCategory.List: descriptor = new ListTypeDescriptor(this, reader, NestedDescriptorReader); break; case TypeCategory.Dictionary: descriptor = new DictionaryTypeDescriptor(this, reader, NestedDescriptorReader); break; case TypeCategory.Enum: descriptor = new EnumTypeDescriptor(this, reader); break; case TypeCategory.Nullable: descriptor = new NullableTypeDescriptor(this, reader, NestedDescriptorReader); break; default: throw new ArgumentOutOfRangeException(); } while (-typeId - 1 >= _id2InfoNew.Count) { _id2InfoNew.Add(null); } if (_id2InfoNew[-typeId - 1] == null) { _id2InfoNew[-typeId - 1] = new DeserializerTypeInfo { Id = typeId, Descriptor = descriptor } } ; typeId = reader.ReadVInt32(); } for (var i = 0; i < _id2InfoNew.Count; i++) { _id2InfoNew[i] !.Descriptor !.MapNestedTypes(d => d is PlaceHolderDescriptor placeHolderDescriptor ? _id2InfoNew[-placeHolderDescriptor.TypeId - 1] !.Descriptor : d); } // This additional cycle is needed to fill names of recursive structures for (var i = 0; i < _id2InfoNew.Count; i++) { _id2InfoNew[i] !.Descriptor !.MapNestedTypes(d => d); } for (var i = 0; i < _id2InfoNew.Count; i++) { var infoForType = _id2InfoNew[i]; for (var j = ReservedBuildinTypes; j < _id2Info.Count; j++) { if (infoForType.Descriptor.Equals(_id2Info[j].Descriptor)) { _remapToOld[infoForType.Descriptor] = _id2Info[j].Descriptor; _id2InfoNew[i] = _id2Info[j]; infoForType = _id2InfoNew[i]; break; } } if (infoForType.Id < 0) { infoForType.Id = (int)_id2Info.Count; _id2Info.Add(infoForType); _typeOrDescriptor2Info[infoForType.Descriptor] = infoForType; } } for (var i = 0; i < _id2InfoNew.Count; i++) { _id2InfoNew[i] !.Descriptor !.MapNestedTypes(d => _remapToOld.TryGetValue(d, out var res) ? res : d); } _id2InfoNew.Clear(); _remapToOld.Clear(); } } Func <AbstractBufferedReader, ITypeBinaryDeserializerContext, ITypeDescriptor, object> LoaderFactory( ITypeDescriptor descriptor) { var loadAsType = LoadAsType(descriptor); var methodBuilder = ILBuilder.Instance .NewMethod <Func <AbstractBufferedReader, ITypeBinaryDeserializerContext, ITypeDescriptor, object> >( "DeserializerFor" + descriptor.Name); var il = methodBuilder.Generator; try { descriptor.GenerateLoad(il, ilGen => ilGen.Ldarg(0), ilGen => ilGen.Ldarg(1), ilGen => ilGen.Ldarg(2), loadAsType); } catch (BTDBException ex) { throw new BTDBException("Deserialization of type " + loadAsType.FullName, ex); } if (loadAsType.IsValueType) { il.Box(loadAsType); } else if (loadAsType != typeof(object)) { il.Castclass(typeof(object)); } il.Ret(); return(methodBuilder.Create()); }
// depth buffer means our regions are locked per channel // 2 options: 1. each channel is its own set of draw calls, this is easy but maybe not as fast. do this as a first pass // 2. try to re-use regions for different channels, almost certainly leads to less throughput but faster since we don't need extra draw calls // probably means we have sub-sorting regions, ie large packers would have sub-packers // would definitely want to sort by size in that case and first try to pack larger regions into themselves // would likely update rect packer to be channel aware, when trying to place next item instead of moving over try colliding a different channel instead public void Clip(Camera camera, CommandBuffer commandBuffer) { // breaks on refresh if we don't do this :( this.clearMaterial.SetColor(s_Color, Color.white); this.clearCountMaterial.SetColor(s_Color, new Color(0, 0, 0, 0)); requireRegionCounting = false; for (int i = 0; i < batchesToRender.size; i++) { batchesToRender[i].pooledMesh.Release(); StructList <Matrix4x4> .Release(ref batchesToRender.array[i].transforms); StructList <Vector4> .Release(ref batchesToRender.array[i].objectData); StructList <Vector4> .Release(ref batchesToRender.array[i].colorData); } batchesToRender.Clear(); Gather(); Vector3 cameraOrigin = camera.transform.position; cameraOrigin.x -= 0.5f * Screen.width; cameraOrigin.y += (0.5f * Screen.height); cameraOrigin.z += 2; Matrix4x4 origin = Matrix4x4.TRS(cameraOrigin, Quaternion.identity, Vector3.one); LightList <ClipData> texturedClippers = LightList <ClipData> .Get(); regionMesh?.Release(); regionMesh = GetRegionMesh(out requireRegionCounting); clipTexture = RenderTexture.GetTemporary(Screen.width, Screen.height, 24, RenderTextureFormat.Default); // todo -- use lower resolution #if DEBUG commandBuffer.BeginSample("UIFora Clip Draw"); #endif commandBuffer.SetRenderTarget(clipTexture); // probably don't need this actually, can bake it into clear. keep for debugging commandBuffer.ClearRenderTarget(true, true, Color.black); commandBuffer.DrawMesh(regionMesh.mesh, origin, clearMaterial, 0, 0); // todo -- handle multiple shapes from one path ClipBatch batch = new ClipBatch(); batch.transforms = StructList <Matrix4x4> .Get(); batch.colorData = StructList <Vector4> .Get(); batch.objectData = StructList <Vector4> .Get(); for (int i = 0; i < clippers.size; i++) { ClipData clipData = clippers[i]; Path2D clipPath = clipData.clipPath; if (clipPath == null) { // todo if transform is not identity we need to generate a rotated or skewed rect for the clip shape continue; } clipPath.UpdateGeometry(); // should early out if no update required if (AnyShapeUsesTextures(clipPath)) { // todo -- handle textures // todo -- handle text continue; } batch = DrawShapesInPath(batch, clipPath, clipData, clipData); for (int j = 0; j < clipData.dependents.size; j++) { batch = DrawShapesInPath(batch, clipPath, clipData, clipData.dependents[j]); } } FinalizeBatch(batch, false); for (int i = 0; i < batchesToRender.size; i++) { ref ClipBatch clipBatch = ref batchesToRender.array[i]; ClipPropertyBlock propertyBlock = clipMaterialPool.GetPropertyBlock(clipBatch.transforms.size); propertyBlock.SetData(clipBatch); commandBuffer.DrawMesh(clipBatch.pooledMesh.mesh, origin, clipDrawMaterial, 0, 0, propertyBlock.matBlock); }
public void Reset() { _id2DescriptorMap.Clear(); _typeOrDescriptor2Info.Clear(); AddBuildInTypes(); }
public bool ParseLambdaSignature(ref StructList <LambdaArgument> signature) { tokenStream.Save(); while (tokenStream.HasMoreTokens) { // can be either just names or type specifier and then names. can probably also be aliases TypeLookup typeLookup = default; LambdaArgument argument = default; // should parse a path even if only an identifier is present if (ParseTypePath(ref typeLookup)) { argument.type = typeLookup; } else { tokenStream.Restore(); return(false); } if (!tokenStream.HasMoreTokens) { if (typeLookup.generics != null || !string.IsNullOrEmpty(typeLookup.namespaceName)) { tokenStream.Restore(); return(false); } argument.identifier = typeLookup.typeName; argument.type = null; signature.Add(argument); return(true); } if (tokenStream.Current == ExpressionTokenType.Identifier) { argument.identifier = tokenStream.Current; tokenStream.Advance(); signature.Add(argument); } else if (tokenStream.Current == ExpressionTokenType.Comma) { argument.identifier = typeLookup.typeName; argument.type = null; signature.Add(argument); } if (!tokenStream.HasMoreTokens) { return(true); } // better be a comma or end if have more tokens if (tokenStream.Current != ExpressionTokenType.Comma) { signature.Clear(); Abort($"Failed parse LambdaExpression signature because we expected a comma and we hit {tokenStream.Current} instead."); return(false); } tokenStream.Advance(); } return(true); }
public void ApproveFieldHandlerLoggerMessages([CallerMemberName] string?testName = null) { Assent.Extensions.Assent(this, string.Join('\n', _fieldHandlerLoggerMessages) + "\n", null, testName); _fieldHandlerLoggerMessages.Clear(); }