Exemple #1
0
        public viz.D3DImageContext GetImageContext(EventType eventType)
        {
            DebugHelper.AssertUIThread();

            viz.D3DImageContext value = null;

            switch (eventType)
            {
            case EventType.Monitor:
                Debug.Assert(this.monitorData != null);
                value = this.monitorData.imageContext;
                break;

            case EventType.Inspection:
                Debug.Assert(this.inspectionData != null);
                value = this.inspectionData.imageContext;
                break;
            }

            return(value);
        }
        private void FixRenderTargetSize(uint w, uint h)
        {
            DebugHelper.AssertUIThread();

            if ((this.renderTargetWidth != w) || (this.renderTargetHeight != h))
            {
                if (this.image != null)
                {
                    this.image.Source = null;
                }

                if (this.renderTarget != null)
                {
                    this.renderTarget.Dispose();
                    this.renderTarget       = null;
                    this.renderTargetWidth  = 0;
                    this.renderTargetHeight = 0;
                }

                if ((this.PluginService != null) && (this.imageHost != null) && (w > 0) && (h > 0))
                {
                    viz.Context         context      = this.PluginService.GetContext(this.EventType);
                    viz.D3DImageContext imageContext = this.PluginService.GetImageContext(this.EventType);
                    if ((context != null) && (imageContext != null))
                    {
#if LOG_INFO
                        string str = String.Format("{0:10} {1}: {2}", this.GetHashCode(), "RNDRTARG ", this.stopwatch.ElapsedMilliseconds);
                        Trace.WriteLine(str);
#endif // LOG_INFO
                        this.renderTarget       = new viz.D3DImageTexture(context, imageContext, w, h);
                        this.renderTargetWidth  = w;
                        this.renderTargetHeight = h;
                    }
                }

                this.OnRenderTargetChanged(this.renderTarget);
            }
        }