Beispiel #1
0
        // this is intended to be run while layout is running (ie in parallel)
        public void GatherBoxDataParallel()
        {
            UIElement root = view.dummyRoot;

            int frameId = root.application.frameId;

            int idx = 0;

            wrapperList.QuickClear();

            elemRefStack.array[elemRefStack.size++].element = root;

            while (elemRefStack.size > 0)
            {
                UIElement currentElement = elemRefStack.array[--elemRefStack.size].element;
                RenderBox renderBox      = currentElement.renderBox;

                renderBox.culled         = renderBox.element.layoutResult.isCulled;
                renderBox.clipper        = currentElement.layoutResult.clipper;
                renderBox.traversalIndex = idx++;

                if (wrapperList.size + (currentElement.children.size * 2) >= wrapperList.array.Length)
                {
                    wrapperList.EnsureAdditionalCapacity(currentElement.children.size * 2);
                }

                if (elemRefStack.size + currentElement.children.size >= elemRefStack.array.Length)
                {
                    elemRefStack.EnsureAdditionalCapacity(currentElement.children.size);
                }

                if (!renderBox.culled && renderBox.visibility != Visibility.Hidden)
                {
                    ref RenderOperationWrapper backgroundOp = ref wrapperList.array[wrapperList.size++];
                    backgroundOp.renderBox       = renderBox;
                    backgroundOp.renderOperation = DrawCommandType.BackgroundTransparent;

                    if (renderBox.hasForeground)
                    {
                        ref RenderOperationWrapper foreground = ref wrapperList.array[wrapperList.size++];
                        foreground.renderBox       = renderBox;
                        foreground.renderOperation = DrawCommandType.ForegroundTransparent;
                    }
                }
Beispiel #2
0
        public void GatherBoxData(IList <UIView> views)
        {
            int idx = 0;

            wrapperList.QuickClear();

            for (int viewIdx = 0; viewIdx < views.Count; ++viewIdx)
            {
                UIView    view      = views[viewIdx];
                UIElement dummyRoot = view.dummyRoot;
                int       frameId   = view.application.frameId;

                if (dummyRoot.renderBox == null)
                {
                    dummyRoot.renderBox         = new RootRenderBox();
                    dummyRoot.renderBox.element = dummyRoot;
                }

                elemRefStack.array[elemRefStack.size++].element = dummyRoot;

                while (elemRefStack.size > 0)
                {
                    UIElement currentElement = elemRefStack.array[--elemRefStack.size].element;
                    RenderBox renderBox      = currentElement.renderBox;

                    renderBox.culled         = renderBox.element.layoutResult.isCulled;
                    renderBox.clipper        = currentElement.layoutResult.clipper;
                    renderBox.traversalIndex = idx++;
                    renderBox.viewDepthIdx   = viewIdx;

                    if (wrapperList.size + 2 + (currentElement.children.size * 2) >= wrapperList.array.Length)
                    {
                        wrapperList.EnsureAdditionalCapacity(2 + (currentElement.children.size * 2));
                    }

                    if (elemRefStack.size + 2 + currentElement.children.size >= elemRefStack.array.Length)
                    {
                        elemRefStack.EnsureAdditionalCapacity(2 + (currentElement.children.size * 2));
                    }

                    if (!renderBox.culled && renderBox.visibility != Visibility.Hidden)
                    {
                        ref RenderOperationWrapper backgroundOp = ref wrapperList.array[wrapperList.size++];
                        backgroundOp.renderBox       = renderBox;
                        backgroundOp.renderOperation = DrawCommandType.BackgroundTransparent;

                        if (renderBox.hasForeground)
                        {
                            ref RenderOperationWrapper foreground = ref wrapperList.array[wrapperList.size++];
                            foreground.renderBox       = renderBox;
                            foreground.renderOperation = DrawCommandType.ForegroundTransparent;
                        }
                    }

                    for (int i = currentElement.children.size - 1; i >= 0; i--)
                    {
                        UIElement child = currentElement.children.array[i];
                        if ((child.flags & UIElementFlags.EnabledFlagSet) == UIElementFlags.EnabledFlagSet)
                        {
                            // todo change check on painter
                            if (child.renderBox == null)
                            {
                                CreateRenderBox(child);
                                Debug.Assert(child.renderBox != null, "child.renderBox != null");
                                child.renderBox.Enable();
                            }
                            else if (child.enableStateChangedFrameId == frameId)
                            {
                                UpdateRenderBox(child);
                                child.renderBox.Enable();
                            }

                            if (child.renderBox.scrollFix == 1)
                            {
                                elemRefStack.array[elemRefStack.size++].element = child;
                            }
                        }
                    }

                    for (int i = currentElement.children.size - 1; i >= 0; i--)
                    {
                        UIElement child = currentElement.children.array[i];
                        if ((child.flags & UIElementFlags.EnabledFlagSet) == UIElementFlags.EnabledFlagSet)
                        {
                            if (child.renderBox.scrollFix == 0)
                            {
                                elemRefStack.array[elemRefStack.size++].element = child;
                            }
                        }
                    }
                }