summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.mm
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
commit8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch)
tree17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebCore/platform/mac/LocalCurrentGraphicsContext.mm
parentb9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff)
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well as the previously cherry-picked changes
Diffstat (limited to 'Source/WebCore/platform/mac/LocalCurrentGraphicsContext.mm')
-rw-r--r--Source/WebCore/platform/mac/LocalCurrentGraphicsContext.mm12
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.mm b/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.mm
index 5f1d07c67..f033df32c 100644
--- a/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.mm
+++ b/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.mm
@@ -30,8 +30,9 @@
namespace WebCore {
LocalCurrentGraphicsContext::LocalCurrentGraphicsContext(GraphicsContext* graphicsContext)
+ : m_didSetGraphicsContext(false)
#if USE(SKIA)
- : m_skiaBitLocker(graphicsContext->platformContext()->canvas())
+ , m_skiaBitLocker(graphicsContext->platformContext()->canvas())
#endif
{
m_savedGraphicsContext = graphicsContext;
@@ -42,20 +43,21 @@ LocalCurrentGraphicsContext::LocalCurrentGraphicsContext(GraphicsContext* graphi
m_savedNSGraphicsContext = 0;
return;
}
-
+
m_savedNSGraphicsContext = [[NSGraphicsContext currentContext] retain];
NSGraphicsContext* newContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:YES];
[NSGraphicsContext setCurrentContext:newContext];
+ m_didSetGraphicsContext = true;
}
LocalCurrentGraphicsContext::~LocalCurrentGraphicsContext()
{
- m_savedGraphicsContext->restore();
-
- if (m_savedNSGraphicsContext) {
+ if (m_didSetGraphicsContext) {
[NSGraphicsContext setCurrentContext:m_savedNSGraphicsContext];
[m_savedNSGraphicsContext release];
}
+
+ m_savedGraphicsContext->restore();
}
CGContextRef LocalCurrentGraphicsContext::cgContext()