diff options
author | Ben Murdoch <benm@google.com> | 2010-10-22 13:02:20 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-10-26 15:21:41 +0100 |
commit | a94275402997c11dd2e778633dacf4b7e630a35d (patch) | |
tree | e66f56c67e3b01f22c9c23cd932271ee9ac558ed /WebCore/platform/graphics/mac/GraphicsContextMac.mm | |
parent | 09e26c78506587b3f5d930d7bc72a23287ffbec0 (diff) | |
download | external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.zip external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.gz external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.bz2 |
Merge WebKit at r70209: Initial merge by Git
Change-Id: Id23a68efa36e9d1126bcce0b137872db00892c8e
Diffstat (limited to 'WebCore/platform/graphics/mac/GraphicsContextMac.mm')
-rw-r--r-- | WebCore/platform/graphics/mac/GraphicsContextMac.mm | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/WebCore/platform/graphics/mac/GraphicsContextMac.mm b/WebCore/platform/graphics/mac/GraphicsContextMac.mm index f3301d8..aa754f2 100644 --- a/WebCore/platform/graphics/mac/GraphicsContextMac.mm +++ b/WebCore/platform/graphics/mac/GraphicsContextMac.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2003, 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,6 +30,7 @@ #import <AppKit/AppKit.h> #import <wtf/StdLibExtras.h> +#import "LocalCurrentGraphicsContext.h" #import "WebCoreSystemInterface.h" @class NSColor; @@ -43,14 +44,14 @@ namespace WebCore { // calls in this file are all exception-safe, so we don't block // exceptions for those. -static void drawFocusRingToContext(CGContextRef context, RetainPtr<CGPathRef> focusRingPath, RetainPtr<CGColorRef> colorRef, int radius) +static void drawFocusRingToContext(CGContextRef context, CGPathRef focusRingPath, CGColorRef color, int radius) { #ifdef BUILDING_ON_TIGER CGContextBeginTransparencyLayer(context, 0); #endif CGContextBeginPath(context); - CGContextAddPath(context, focusRingPath.get()); - wkDrawFocusRing(context, colorRef.get(), radius); + CGContextAddPath(context, focusRingPath); + wkDrawFocusRing(context, color, radius); #ifdef BUILDING_ON_TIGER CGContextEndTransparencyLayer(context); #endif @@ -63,16 +64,14 @@ void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int of int radius = (width - 1) / 2; offset += radius; - RetainPtr<CGColorRef> colorRef; - if (color.isValid()) - colorRef.adoptCF(createCGColor(color)); - + CGColorRef colorRef = color.isValid() ? cachedCGColor(color, ColorSpaceDeviceRGB) : 0; + RetainPtr<CGMutablePathRef> focusRingPath(AdoptCF, CGPathCreateMutable()); unsigned pathCount = paths.size(); for (unsigned i = 0; i < pathCount; i++) CGPathAddPath(focusRingPath.get(), 0, paths[i].platformPath()); - drawFocusRingToContext(platformContext(), focusRingPath, colorRef, radius); + drawFocusRingToContext(platformContext(), focusRingPath.get(), colorRef, radius); } void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color) @@ -82,16 +81,14 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int int radius = (width - 1) / 2; offset += radius; - RetainPtr<CGColorRef> colorRef; - if (color.isValid()) - colorRef.adoptCF(createCGColor(color)); + CGColorRef colorRef = color.isValid() ? cachedCGColor(color, ColorSpaceDeviceRGB) : 0; RetainPtr<CGMutablePathRef> focusRingPath(AdoptCF, CGPathCreateMutable()); unsigned rectCount = rects.size(); for (unsigned i = 0; i < rectCount; i++) CGPathAddRect(focusRingPath.get(), 0, CGRectInset(rects[i], -offset, -offset)); - drawFocusRingToContext(platformContext(), focusRingPath, colorRef, radius); + drawFocusRingToContext(platformContext(), focusRingPath.get(), colorRef, radius); } #ifdef BUILDING_ON_TIGER // Post-Tiger's setCompositeOperation() is defined in GraphicsContextCG.cpp. @@ -182,6 +179,7 @@ void GraphicsContext::drawLineForTextChecking(const IntPoint& point, int width, // for transforms. // Draw underline. + LocalCurrentGraphicsContext localContext(this); NSGraphicsContext *currentContext = [NSGraphicsContext currentContext]; CGContextRef context = (CGContextRef)[currentContext graphicsPort]; CGContextSaveGState(context); |