コード例 #1
0
 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);
 }
コード例 #2
0
        public BackgroundEffectRenderer(
            Effect effect,
            EffectConfigToken effectToken,
            RenderArgs dstArgs,
            RenderArgs srcArgs,
            PdnRegion renderRegion,
            IRenderer <ColorAlpha8> clipMaskRenderer, // may be null
            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.Options.RenderingSchedule == EffectRenderingSchedule.None)
            {
                this.tileCount = 1;
            }

            tileRegions = SliceUpRegion(renderRegion, this.tileCount, dstArgs.Bounds);

            tilePdnRegions = new PdnRegion[tileRegions.Length];
            for (int i = 0; i < tileRegions.Length; ++i)
            {
                PdnRegion pdnRegion = PdnRegion.FromRectangles(tileRegions[i]);
                tilePdnRegions[i] = pdnRegion;
            }

            this.workerThreads = workerThreads;
            if (effect.Options.Flags.HasFlag(EffectFlags.SingleThreaded))
            {
                this.workerThreads = 1;
            }

            this.clipMaskRenderer = clipMaskRenderer;

            threadPool = new PrivateThreadPool(this.workerThreads, false);
        }