[Webkit-unassigned] [Bug 211274] New: Refactor LocalCurrentGraphicsContext to save/restore NSGraphicsContext

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 30 20:05:22 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=211274

            Bug ID: 211274
           Summary: Refactor LocalCurrentGraphicsContext to save/restore
                    NSGraphicsContext
           Product: WebKit
           Version: Other
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore Misc.
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ddkilzer at webkit.org
                CC: darin at apple.com, thorton at apple.com

Refactor LocalCurrentGraphicsContext to save/restore NSGraphicsContext.

In Bug 211160, there was some discussion about using LocalCurrentGraphicsContext with, "a tiny bit of refactoring," [Bug 211160 Comment #11] could be used to save/restore NSGraphicsContext.

However, I don't see how reusing that class would be a good design since I don't need (a) the CGContextRef or (b) the WebCore::GraphicsContext.  Or is the consensus that it's okay to add the nullptr checks and change m_savedGraphicsContext to a RefPtr<GraphicsContext>?


I really just need a LocalCurrentNSGraphicsContext:

class LocalCurrentNSGraphicsContext {
    WTF_MAKE_NONCOPYABLE(LocalCurrentNSGraphicsContext);
public:
    LocalCurrentNSGraphicsContext(NSGraphicsContext *newContext);
    ~LocalCurrentNSGraphicsContext();
private:
    RetainPtr<NSGraphicsContext> m_savedContext;
};

And:

LocalCurrentNSGraphicsContext::LocalCurrentNSGraphicsContext(NSGraphicsContext *newContext)
    : m_savedContext([NSGraphicsContext currentContext])
{
    NSGraphicsContext.currentContext = newContext;
}

LocalCurrentNSGraphicsContext::~LocalCurrentNSGraphicsContext()
{
    NSGraphicsContext.currentContext = m_savedContext.get();
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200501/b60ef1e7/attachment-0001.htm>


More information about the webkit-unassigned mailing list