internal void NotifyTileCacheFinishedRendering <TEnumerable>(TEnumerable finishedTileOffsets) where TEnumerable : IEnumerable <PointInt32> { base.VerifyAccess(); if (this.IsActive) { RectInt32 num = this.canvasView.GetVisibleCanvasBounds().Int32Bound; RectInt32?nullable = null; foreach (PointInt32 num3 in finishedTileOffsets) { this.isDeviceBitmapCurrent[num3.Y][num3.X] = false; RectInt32 tileSourceRect = this.tileMathHelper.GetTileSourceRect(num3); if (num.IntersectsWith(tileSourceRect)) { nullable = new RectInt32?(RectInt32Util.Union(nullable, tileSourceRect)); } else { this.ReleaseDeviceBitmap(num3); } this.nonCurrentTileOffsets.TryEnqueue(num3, QueueSide.Back); } if (nullable.HasValue) { this.canvasView.Invalidate(nullable.Value); } } else { foreach (PointInt32 num5 in finishedTileOffsets) { this.ReleaseDeviceBitmap(num5); } } }
public void ReplaceLayerOverlay(Layer layer, DocumentLayerOverlay oldOverlay, DocumentLayerOverlay newOverlay, RectInt32?invalidateRect) { DocumentLayerOverlay overlay; base.VerifyAccess(); if ((oldOverlay == null) && (newOverlay == null)) { throw new ArgumentNullException(); } this.overlays.TryGetValue(layer, out overlay); if (overlay != oldOverlay) { throw new InvalidOperationException(); } if ((oldOverlay == null) && (newOverlay != null)) { this.SetLayerOverlay(layer, newOverlay, invalidateRect); } else if (newOverlay == null) { this.RemoveLayerOverlay(layer, overlay, invalidateRect); } else { if (newOverlay.IsCancellationRequested) { throw new InvalidOperationException("Cannot set an overlay which is already cancelled"); } this.overlays[layer] = newOverlay; this.documentRenderer.ReplaceLayerOverlay(layer, newOverlay); oldOverlay.Cancel(); if (invalidateRect.HasValue) { if (invalidateRect.Value.HasPositiveArea) { layer.Invalidate(invalidateRect.Value); } } else { RectInt32?nullable = (oldOverlay == null) ? null : new RectInt32?(oldOverlay.AffectedBounds); RectInt32?nullable2 = (newOverlay == null) ? null : new RectInt32?(newOverlay.AffectedBounds); RectInt32?nullable3 = RectInt32Util.Union(nullable, nullable2); if (nullable3.HasValue && nullable3.Value.HasPositiveArea) { layer.Invalidate(nullable3.Value); } } } }
private void ProcessInvalidationQueue() { if (!base.IsDisposed) { RectInt32 num2; base.VerifyAccess(); int count = this.invalidationQueue.Count; RectInt32?nullable = null; while ((count > 0) && this.invalidationQueue.TryDequeue(out num2)) { nullable = new RectInt32?(RectInt32Util.Union(nullable, num2)); count--; } if (nullable.HasValue) { RectInt32 invalidRect = RectInt32.Intersect(this.Document.Bounds(), nullable.Value); this.InvalidateCore(invalidRect); } } }