コード例 #1
0
void CRevisionGraphWnd::DrawStripes (GraphicsDevice& graphics, const CSize& offset)
{
	// we need to fill this visible area of the the screen
	// (even if there is graph in that part)

	RectF clipRect;
	if (graphics.graphics)
		graphics.graphics->GetVisibleClipBounds (&clipRect);

	// don't show stripes if we don't have multiple roots

	CSyncPointer<const ILayoutRectList> trees (m_state.GetTrees());
	if (trees->GetCount() < 2)
		return;

	// iterate over all trees

	for ( index_t i = 0, count = trees->GetCount(); i < count; ++i)
	{
		// screen coordinates covered by the tree

		CRect tree = trees->GetRect(i);
		REAL left = tree.left * m_fZoomFactor;
		REAL right = tree.right * m_fZoomFactor;
		RectF rect ( left - offset.cx
					, clipRect.Y
					, i+1 == count ? clipRect.Width : right - left
					, clipRect.Height);

		// relevant?

		if (rect.IntersectsWith (clipRect))
		{
			// draw the background stripe

			Color color (  (i & 1) == 0
						? m_Colors.GetColor (CColors::gdpStripeColor1)
						: m_Colors.GetColor (CColors::gdpStripeColor2));
			if (graphics.graphics)
			{
				SolidBrush brush (color);
				graphics.graphics->FillRectangle (&brush, rect);
			}
			else if (graphics.pSVG)
				graphics.pSVG->RoundedRectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height,
												color, 1, color);
		}
	}
}
コード例 #2
0
size_t CRevisionGraphState::GetTreeCount() const
{
    CSingleLock lock (&mutex);

    if (layout.get() == NULL)
        return 0;

    CSyncPointer<const ILayoutRectList> trees
        ( &mutex
        , layout->GetTrees()
        , true);
    return trees->GetCount();
}