Skip to content

Commit

Permalink
Address CR Feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
MSFTFox committed Nov 4, 2016
1 parent 5f79b50 commit 8aa78df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Frameworks/CoreGraphics/CGContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1648,9 +1648,9 @@ void CGContextFillRects(CGContextRef context, const CGRect* rects, size_t count)
void CGContextDrawPath(CGContextRef context, CGPathDrawingMode mode) {
NOISY_RETURN_IF_NULL(context);
if (context->HasPath()) {
ID2D1Geometry* pGeometry;
ComPtr<ID2D1Geometry> pGeometry;
FAIL_FAST_IF_FAILED(_CGPathGetGeometry(context->Path(), &pGeometry));
__CGContextDrawGeometry(context, pGeometry, mode);
FAIL_FAST_IF_FAILED(__CGContextDrawGeometry(context, pGeometry.Get(), mode));
context->ClearPath();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/CoreGraphics/CGPath.mm
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ HRESULT InitializeGeometries() {
HRESULT _CGPathGetGeometry(CGPathRef path, ID2D1Geometry** pGeometry) {
if (path && pGeometry) {
RETURN_IF_FAILED(path->ClosePath());
*pGeometry = path->GetPathGeometry().Get();
path->GetPathGeometry().CopyTo(pGeometry);
}
return S_OK;
}
Expand Down
12 changes: 3 additions & 9 deletions Frameworks/CoreGraphics/D2DWrapper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,16 @@

using namespace Microsoft::WRL;

// Private helper for creating a D2DFactory
static HRESULT __createD2DFactory(ID2D1Factory** factory) {
return D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, factory);
}

HRESULT _CGGetD2DFactory(ID2D1Factory** factory) {
static ComPtr<ID2D1Factory> sFactory;
static HRESULT sHr;
static dispatch_once_t dispatchToken;
static HRESULT sHr = __createD2DFactory(&sFactory);

dispatch_once(&dispatchToken, ^{
sHr = __createD2DFactory(&sFactory);
});
sFactory.Get()->AddRef();
*factory = sFactory.Get();
return sHr;
sFactory.CopyTo(factory);
RETURN_HR(sHr);
}

static ComPtr<IWICImagingFactory> __createWICFactory() {
Expand Down

0 comments on commit 8aa78df

Please sign in to comment.