Example #1
0
		protected virtual bool CurrentScreenClipping(out RectangleDouble screenClippingRect)
		{
			if (screenClipping.NeedRebuild)
			{
				DrawCount++;
				screenClipping.screenClippingRect = TransformToScreenSpace(LocalBounds);

				if (Parent != null)
				{
					RectangleDouble screenParentClipping;
					if (Parent.CurrentScreenClipping(out screenParentClipping))
					{
						RectangleDouble intersectionRect = new RectangleDouble();
						if (intersectionRect.IntersectRectangles(screenClipping.screenClippingRect, screenParentClipping))
						{
							screenClipping.screenClippingRect = intersectionRect;
							screenClipping.visibleAfterClipping = true;
						}
						else
						{
							// this rect is clipped away by the parent rect so return false.
							screenClipping.visibleAfterClipping = false;
						}
					}
					else
					{
						// the parent is completely clipped away, so this is too.
						screenClipping.visibleAfterClipping = false;
					}
				}
				screenClipping.NeedRebuild = false;
			}

			screenClippingRect = screenClipping.screenClippingRect;
			return screenClipping.visibleAfterClipping;
		}