Exemplo n.º 1
0
void VGraphicPath::Outline()
{
	End();

	if (fPathD2D != NULL)
	{
		ID2D1Geometry *oldPath = fPathD2D;

		//create new path
		ID2D1PathGeometry *newPath = NULL;
		VWinD2DGraphicContext::GetMutexFactory().Lock();
		HRESULT hr = VWinD2DGraphicContext::GetFactory()->CreatePathGeometry( &newPath);
		xbox_assert(SUCCEEDED(hr));
		VWinD2DGraphicContext::GetMutexFactory().Unlock();

		//outline current path
		CComPtr<ID2D1GeometrySink> thisGeomSink;
		if (SUCCEEDED(newPath->Open(&thisGeomSink)))
		{
			thisGeomSink->SetFillMode( fFillMode == FILLRULE_EVENODD ? D2D1_FILL_MODE_ALTERNATE : D2D1_FILL_MODE_WINDING);

			if (!SUCCEEDED(oldPath->Outline(
							NULL,
							0.0f,
							thisGeomSink)))
			{
				newPath->Release();
				return;
			}
			thisGeomSink->Close();
		}

		fPathD2D = newPath;
		oldPath->Release();

		fCreateStorageForCrispEdges = false;
		fHasBezier = false;
		fDrawCmds.clear();
		fCurTransform.MakeIdentity();
	}
}