public BackgroundEffectRenderer(Effect effect, EffectConfigToken effectToken, RenderArgs dstArgs, RenderArgs srcArgs, PdnRegion renderRegion, IRenderer <ColorAlpha8> clipMaskRenderer, int tileCount, int workerThreads) { this.effect = effect; this.effectToken = effectToken; this.dstArgs = dstArgs; this.srcArgs = srcArgs; this.renderRegion = renderRegion; this.renderRegion.Intersect(dstArgs.Bounds); this.tileCount = tileCount; if (effect.CheckForEffectFlags(EffectFlags.None | EffectFlags.SingleRenderCall)) { this.tileCount = 1; } this.tileRegions = this.SliceUpRegion(renderRegion, this.tileCount, dstArgs.Bounds); this.tilePdnRegions = new PdnRegion[this.tileRegions.Length]; for (int i = 0; i < this.tileRegions.Length; i++) { this.tilePdnRegions[i] = PdnRegion.FromRectangles(this.tileRegions[i]); } this.workerThreads = workerThreads; if (effect.CheckForEffectFlags(EffectFlags.None | EffectFlags.SingleThreaded)) { this.workerThreads = 1; } this.clipMaskRenderer = clipMaskRenderer; this.threadPool = new EffectRendererWorkItemQueue(WorkItemDispatcher.Default, WorkItemQueuePriority.Normal, workerThreads); }
public BackgroundEffectRenderer(Effect effect, EffectConfigToken effectToken, RenderArgs dstArgs, RenderArgs srcArgs, PdnRegion renderRegion, int tileCount, int workerThreads) { this.effect = effect; this.effectToken = effectToken; this.dstArgs = dstArgs; this.srcArgs = srcArgs; this.renderRegion = renderRegion; this.renderRegion.Intersect(dstArgs.Bounds); this.tileRegions = SliceUpRegion(renderRegion, tileCount, dstArgs.Bounds); this.tilePdnRegions = new PdnRegion[this.tileRegions.Length]; for (int i = 0; i < this.tileRegions.Length; ++i) { PdnRegion pdnRegion = Utility.RectanglesToRegion(this.tileRegions[i]); this.tilePdnRegions[i] = pdnRegion; } this.tileCount = tileCount; this.workerThreads = workerThreads; if (effect.CheckForEffectFlags(EffectFlags.SingleThreaded)) { this.workerThreads = 1; } this.threadPool = new Threading.ThreadPool(this.workerThreads, false); }
private void AddEffectToMenu(Effect effect, bool withShortcut) { if (!FilterEffects(effect)) { return; } string name = effect.Name; if (effect.CheckForEffectFlags(EffectFlags.Configurable)) { string configurableFormat = PdnResources.GetString("Effects.Name.Format.Configurable"); name = string.Format(configurableFormat, name); } PdnMenuItem mi = new PdnMenuItem(name, effect.Image, EffectMenuItem_Click); if (withShortcut) { mi.ShortcutKeys = GetEffectShortcutKeys(effect); } else { mi.ShortcutKeys = Keys.None; } mi.Tag = (object)effect.GetType(); mi.Name = "Effect(" + effect.GetType().FullName + ")"; PdnMenuItem addEffectHere = this; if (effect.SubMenuName != null) { PdnMenuItem subMenu = null; // search for this subMenu foreach (ToolStripItem sub in this.DropDownItems) { PdnMenuItem subpmi = sub as PdnMenuItem; if (subpmi != null) { if (subpmi.Text == effect.SubMenuName) { subMenu = subpmi; break; } } } if (subMenu == null) { subMenu = new PdnMenuItem(effect.SubMenuName, null, null); this.DropDownItems.Add(subMenu); } addEffectHere = subMenu; } addEffectHere.DropDownItems.Add(mi); }