Skip to content

Commit

Permalink
Fix the wrong flipping rendering on macOS because of CoreGraphics/App…
Browse files Browse the repository at this point in the history
…Kit differences
  • Loading branch information
dreampiggy committed Jan 11, 2024
1 parent 43fa043 commit 5785d55
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions SDWebImageSVGNativeCoder/Classes/SDImageSVGNativeCoder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ - (nullable UIImage *)decodedImageWithData:(nullable NSData *)data options:(null

renderer->SetGraphicsContext(ctx);

#if SD_MAC
// Core Graphics Coordinate System convert. SDWebImage use's non-flipped one
// See: [NSGraphicsContext graphicsContextWithCGContext:context flipped:NO];
CGContextScaleCTM(ctx, 1, -1);
CGContextTranslateCTM(ctx, 0, -svgSize.height);
#endif

doc->Render(svgSize.width, svgSize.height);

renderer->ReleaseGraphicsContext();
Expand Down

0 comments on commit 5785d55

Please sign in to comment.