void VGraphicPath::AddOval(const VRect& inBounds) { #if !GRAPHIC_MIXED_GDIPLUS_D2D if (!VWinD2DGraphicContext::IsAvailable()) { #endif Gdiplus::RectF rect(inBounds.GetLeft(), inBounds.GetTop(), inBounds.GetWidth(), inBounds.GetHeight()); fPath->AddEllipse(rect); #if !GRAPHIC_MIXED_GDIPLUS_D2D } #endif #if ENABLE_D2D if (VWinD2DGraphicContext::IsAvailable()) { if (!fGeomSink) { Begin(); if (!fGeomSink) return; } if (!fFigureIsClosed) fGeomSink->EndFigure( D2D1_FIGURE_END_OPEN); fFigureIsClosed = true; GReal radiusX = inBounds.GetWidth()*0.5f; GReal radiusY = inBounds.GetHeight()*0.5f; D2D1_POINT_2F center = D2D1::Point2F( inBounds.GetLeft()+radiusX, inBounds.GetTop()+radiusY); D2D1_POINT_2F s = D2D1::Point2F(center.x-radiusX, center.y); D2D1_POINT_2F d = D2D1::Point2F(center.x+radiusX, center.y); fGeomSink->BeginFigure( s, D2D1_FIGURE_BEGIN_FILLED); fGeomSink->AddArc( D2D1::ArcSegment( d, D2D1::SizeF(radiusX, radiusY), 0.0f, D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_ARC_SIZE_SMALL)); fGeomSink->AddArc( D2D1::ArcSegment( s, D2D1::SizeF(radiusX, radiusY), 0.0f, D2D1_SWEEP_DIRECTION_CLOCKWISE, D2D1_ARC_SIZE_SMALL)); fGeomSink->EndFigure( D2D1_FIGURE_END_OPEN); } #endif fPolygon.AddPoint(inBounds.GetTopLeft()); fPolygon.AddPoint(inBounds.GetTopRight()); fPolygon.AddPoint(inBounds.GetBotRight()); fPolygon.AddPoint(inBounds.GetBotLeft()); if (fComputeBoundsAccurate) _addRectToBounds( inBounds); _ComputeBounds(); if (fCreateStorageForCrispEdges) fDrawCmds.push_back( VGraphicPathDrawCmd( GPDCT_ADD_OVAL, inBounds)); }
bool VRect::Contains (const VRect& inRect) const { return ((inRect.GetLeft() - GetLeft()) > -kREAL_PIXEL_PRECISION && (inRect.GetRight() - GetRight()) < kREAL_PIXEL_PRECISION && (inRect.GetTop() - GetTop()) > -kREAL_PIXEL_PRECISION && (inRect.GetBottom() - GetBottom()) < kREAL_PIXEL_PRECISION); }