diff --git a/Source/ASImageNode.mm b/Source/ASImageNode.mm index ed56c9ceb8..b1a561eeaa 100644 --- a/Source/ASImageNode.mm +++ b/Source/ASImageNode.mm @@ -522,10 +522,9 @@ static ASDN::StaticMutex& cacheLock = *new ASDN::StaticMutex; key.didDisplayNodeContentWithRenderingContext(context, drawParameters); } - // The following `UIGraphicsGetImageFromCurrentImageContext` call will commonly take more than 20ms on an - // A5 processor. Check for cancellation before we call it. + // Check cancellation one last time before forming image. if (isCancelled()) { - UIGraphicsEndImageContext(); + ASGraphicsEndImageContext(); return nil; } diff --git a/Source/Details/ASGraphicsContext.h b/Source/Details/ASGraphicsContext.h index 0a1c80fc4b..26183d5951 100644 --- a/Source/Details/ASGraphicsContext.h +++ b/Source/Details/ASGraphicsContext.h @@ -23,6 +23,9 @@ * * The API mirrors the UIGraphics API, with the exception that forming an image * ends the context as well. + * + * Note: You must not mix-and-match between ASGraphics* and UIGraphics* functions + * within the same drawing operation. */ NS_ASSUME_NONNULL_BEGIN