| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 if (layerContents && layerContents->client()) { | 47 if (layerContents && layerContents->client()) { |
| 48 [NSGraphicsContext saveGraphicsState]; | 48 [NSGraphicsContext saveGraphicsState]; |
| 49 | 49 |
| 50 // Set up an NSGraphicsContext for the context, so that parts of AppKit
that rely on | 50 // Set up an NSGraphicsContext for the context, so that parts of AppKit
that rely on |
| 51 // the current NSGraphicsContext (e.g. NSCell drawing) get the right one
. | 51 // the current NSGraphicsContext (e.g. NSCell drawing) get the right one
. |
| 52 NSGraphicsContext* layerContext = [NSGraphicsContext graphicsContextWith
GraphicsPort:context flipped:YES]; | 52 NSGraphicsContext* layerContext = [NSGraphicsContext graphicsContextWith
GraphicsPort:context flipped:YES]; |
| 53 [NSGraphicsContext setCurrentContext:layerContext]; | 53 [NSGraphicsContext setCurrentContext:layerContext]; |
| 54 | 54 |
| 55 GraphicsContext graphicsContext(context); | 55 GraphicsContext graphicsContext(context); |
| 56 | 56 |
| 57 // When drawing into CALayers, we need to turn off font smoothing (aka L
CD antialiasing). | |
| 58 bool wasSmoothing = graphicsContext.usingFontSmoothing(); | |
| 59 graphicsContext.setUseFontSmoothing(false); | |
| 60 | |
| 61 // It's important to get the clip from the context, because it may be si
gnificantly | 57 // It's important to get the clip from the context, because it may be si
gnificantly |
| 62 // smaller than the layer bounds (e.g. tiled layers) | 58 // smaller than the layer bounds (e.g. tiled layers) |
| 63 CGRect clipBounds = CGContextGetClipBoundingBox(context); | 59 CGRect clipBounds = CGContextGetClipBoundingBox(context); |
| 64 IntRect clip(enclosingIntRect(clipBounds)); | 60 IntRect clip(enclosingIntRect(clipBounds)); |
| 65 layerContents->paintGraphicsLayerContents(graphicsContext, clip); | 61 layerContents->paintGraphicsLayerContents(graphicsContext, clip); |
| 66 | 62 |
| 67 graphicsContext.setUseFontSmoothing(wasSmoothing); | |
| 68 | |
| 69 [NSGraphicsContext restoreGraphicsState]; | 63 [NSGraphicsContext restoreGraphicsState]; |
| 70 } | 64 } |
| 71 #ifndef NDEBUG | 65 #ifndef NDEBUG |
| 72 else { | 66 else { |
| 73 ASSERT_NOT_REACHED(); | 67 ASSERT_NOT_REACHED(); |
| 74 | 68 |
| 75 // FIXME: ideally we'd avoid calling -setNeedsDisplay on a layer that is
a plain color, | 69 // FIXME: ideally we'd avoid calling -setNeedsDisplay on a layer that is
a plain color, |
| 76 // so CA never makes backing store for it (which is what -setNeedsDispla
y will do above). | 70 // so CA never makes backing store for it (which is what -setNeedsDispla
y will do above). |
| 77 CGContextSetRGBFillColor(context, 0.0f, 1.0f, 0.0f, 1.0f); | 71 CGContextSetRGBFillColor(context, 0.0f, 1.0f, 0.0f, 1.0f); |
| 78 CGRect aBounds = [layer bounds]; | 72 CGRect aBounds = [layer bounds]; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 - (NSString*)extendedDescription | 210 - (NSString*)extendedDescription |
| 217 { | 211 { |
| 218 return [self _descriptionWithPrefix:@""]; | 212 return [self _descriptionWithPrefix:@""]; |
| 219 } | 213 } |
| 220 | 214 |
| 221 @end // implementation WebLayer(ExtendedDescription) | 215 @end // implementation WebLayer(ExtendedDescription) |
| 222 | 216 |
| 223 #endif // NDEBUG | 217 #endif // NDEBUG |
| 224 | 218 |
| 225 #endif // USE(ACCELERATED_COMPOSITING) | 219 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |