From 3454bed22b058c330eb3b06b02c177d0fb057875 Mon Sep 17 00:00:00 2001 From: Hank Fox Date: Thu, 3 Nov 2016 17:22:38 -0700 Subject: [PATCH] Address CR Feedback. --- Frameworks/CoreGraphics/CGContext.mm | 2 +- Frameworks/CoreGraphics/D2DWrapper.mm | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Frameworks/CoreGraphics/CGContext.mm b/Frameworks/CoreGraphics/CGContext.mm index 68b78cb0eb..dace77b3bb 100644 --- a/Frameworks/CoreGraphics/CGContext.mm +++ b/Frameworks/CoreGraphics/CGContext.mm @@ -1650,7 +1650,7 @@ void CGContextDrawPath(CGContextRef context, CGPathDrawingMode mode) { if (context->HasPath()) { ID2D1Geometry* pGeometry; FAIL_FAST_IF_FAILED(_CGPathGetGeometry(context->Path(), &pGeometry)); - __CGContextDrawGeometry(context, pGeometry, mode); + FAIL_FAST_IF_FAILED(__CGContextDrawGeometry(context, pGeometry, mode)); context->ClearPath(); } } diff --git a/Frameworks/CoreGraphics/D2DWrapper.mm b/Frameworks/CoreGraphics/D2DWrapper.mm index 6685509c84..0db34a48db 100644 --- a/Frameworks/CoreGraphics/D2DWrapper.mm +++ b/Frameworks/CoreGraphics/D2DWrapper.mm @@ -19,21 +19,17 @@ 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 sFactory; static HRESULT sHr; static dispatch_once_t dispatchToken; dispatch_once(&dispatchToken, ^{ - sHr = __createD2DFactory(&sFactory); + sHr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &sFactory); }); + sFactory.Get()->AddRef(); - *factory = sFactory.Get(); + sFactory.CopyTo(factory); return sHr; }