Skip to content

Commit

Permalink
microsoft#1733 Support to clear rect if clipping is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
msft-Jeyaram committed Jan 19, 2017
1 parent 92ed07c commit dac1070
Show file tree
Hide file tree
Showing 4 changed files with 2,945 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Frameworks/CoreGraphics/CGContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2068,14 +2068,19 @@ void CGContextShowGlyphsWithAdvances(CGContextRef context, const CGGlyph* glyphs

#pragma region Drawing Operations - Basic Shapes
/**
@Status Interoperable
@Status Caveat
@Notes only supports the scenario where clipping is not set.
*/
void CGContextClearRect(CGContextRef context, CGRect rect) {
NOISY_RETURN_IF_NULL(context);
ComPtr<ID2D1DeviceContext> deviceContext = context->DeviceContext();
deviceContext->PushAxisAlignedClip(__CGRectToD2D_F(rect), D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
deviceContext->Clear(nullptr); // transparent black clear
deviceContext->PopAxisAlignedClip();
if (!context->CurrentGState().clippingGeometry) {
deviceContext->BeginDraw();
deviceContext->PushAxisAlignedClip(__CGRectToD2D_F(rect), D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
deviceContext->Clear(nullptr); // transparent black clear
deviceContext->PopAxisAlignedClip();
deviceContext->EndDraw();
}
}

HRESULT __CGContext::_CreateShadowEffect(ID2D1Image* inputImage, ID2D1Effect** outShadowEffect) {
Expand Down
Loading

0 comments on commit dac1070

Please sign in to comment.