Changeset 191117 in webkit
- Timestamp:
- Oct 15, 2015, 10:20:10 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r191114 r191117 1 2015-10-14 Simon Fraser <simon.fraser@apple.com> 2 3 Move ImageBuffer:clip() into GraphicsContextCG 4 https://bugs.webkit.org/show_bug.cgi?id=150140 5 6 Reviewed by Zalan Bujtas. 7 8 Move the guts of CG's ImageBuffer:clip() into GraphicsContextCG. 9 10 * platform/graphics/GraphicsContext.h: 11 * platform/graphics/cg/GraphicsContextCG.cpp: 12 (WebCore::GraphicsContext::clipToNativeImage): 13 * platform/graphics/cg/ImageBufferCG.cpp: 14 (WebCore::ImageBuffer::clip): 15 1 16 2015-10-14 Brady Eidson <beidson@apple.com> 2 17 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r191049 r191117 263 263 WEBCORE_EXPORT void drawNativeImage(PassNativeImagePtr, const FloatSize& selfSize, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, ImageOrientation = DefaultImageOrientation); 264 264 265 void clipToNativeImage(PassNativeImagePtr, const FloatRect& destRect, const FloatSize& bufferSize); 266 265 267 // Allow font smoothing (LCD antialiasing). Not part of the graphics state. 266 268 void setAllowsFontSmoothing(bool); -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r191000 r191117 346 346 } 347 347 348 void GraphicsContext::clipToNativeImage(PassNativeImagePtr image, const FloatRect& destRect, const FloatSize& bufferSize) 349 { 350 CGContextRef context = platformContext(); 351 // FIXME: This image needs to be grayscale to be used as an alpha mask here. 352 CGContextTranslateCTM(context, destRect.x(), destRect.y() + bufferSize.height()); 353 CGContextScaleCTM(context, 1, -1); 354 CGContextClipToRect(context, FloatRect(FloatPoint(0, bufferSize.height() - destRect.height()), destRect.size())); 355 CGContextClipToMask(context, FloatRect(FloatPoint(), bufferSize), image); 356 CGContextScaleCTM(context, 1, -1); 357 CGContextTranslateCTM(context, -destRect.x(), -destRect.y() - destRect.height()); 358 } 359 348 360 // Draws a filled rectangle with a stroked border. 349 361 void GraphicsContext::drawRect(const FloatRect& rect, float borderThickness) -
trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
r190910 r191117 267 267 { 268 268 FloatSize backingStoreSizeInUserSpace = scaleSizeToUserSpace(rect.size(), m_data.backingStoreSize, internalSize()); 269 270 CGContextRef platformContextToClip = contextToClip.platformContext();271 // FIXME: This image needs to be grayscale to be used as an alpha mask here.272 269 RetainPtr<CGImageRef> image = copyNativeImage(DontCopyBackingStore); 273 CGContextTranslateCTM(platformContextToClip, rect.x(), rect.y() + backingStoreSizeInUserSpace.height()); 274 CGContextScaleCTM(platformContextToClip, 1, -1); 275 CGContextClipToRect(platformContextToClip, FloatRect(FloatPoint(0, backingStoreSizeInUserSpace.height() - rect.height()), rect.size())); 276 CGContextClipToMask(platformContextToClip, FloatRect(FloatPoint(), backingStoreSizeInUserSpace), image.get()); 277 CGContextScaleCTM(platformContextToClip, 1, -1); 278 CGContextTranslateCTM(platformContextToClip, -rect.x(), -rect.y() - rect.height()); 270 contextToClip.clipToNativeImage(image.get(), rect, backingStoreSizeInUserSpace); 279 271 } 280 272
Note:
See TracChangeset
for help on using the changeset viewer.