<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[194025] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/194025">194025</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-12-13 21:27:45 -0800 (Sun, 13 Dec 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Adopt CGIOSurfaceContextCreateImageReference to avoid unnecessary readback
https://bugs.webkit.org/show_bug.cgi?id=150988
<rdar://problem/18993594>
Reviewed by Darin Adler.
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawConsumingImageBuffer):
* platform/graphics/GraphicsContext.h:
* platform/graphics/ImageBuffer.h:
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::createBitmapImageAfterScalingIfNeeded):
(WebCore::ImageBuffer::copyImage):
(WebCore::ImageBuffer::sinkIntoImage):
(WebCore::ImageBuffer::sinkIntoNativeImage):
(WebCore::ImageBuffer::drawConsuming):
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
(IOSurface::createFromImageBuffer):
(IOSurface::sinkIntoImage):
Add sinkIntoImage, sinkIntoNativeImage, and drawConsuming to ImageBuffer,
which all consume the ImageBuffer and allow us to tell the system to
make a CGImage that references the IOSurface, which is in many cases
more efficient than making an image with a "copy" of the IOSurface.
(The copy is done lazily, but we often hit a corner case that causes
it to happen unnecessarily.)
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
* page/TextIndicator.cpp:
(WebCore::takeSnapshot):
* platform/DragImage.cpp:
(WebCore::createDragImageFromSnapshot):
* platform/graphics/filters/FETile.cpp:
(WebCore::FETile::platformApplySoftware):
* platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::currentFrameImage):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintProgressBar):
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::buildPattern):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::drawPatternForContainer):
Adopt sinkIntoImage and drawConsumingImageBuffer in a few places.
* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::imageForCurrentSharingServicePickerItem):
Adopt sinkIntoImage and drawConsumingImageBuffer in a few places.
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createSelectionSnapshot):
Adopt sinkIntoImage and drawConsumingImageBuffer in a few places.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowMediaControlElementscpp">trunk/Source/WebCore/html/shadow/MediaControlElements.cpp</a></li>
<li><a href="#trunkSourceWebCorepageTextIndicatorcpp">trunk/Source/WebCore/page/TextIndicator.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformDragImagecpp">trunk/Source/WebCore/platform/DragImage.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContextcpp">trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContexth">trunk/Source/WebCore/platform/graphics/GraphicsContext.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsImageBufferh">trunk/Source/WebCore/platform/graphics/ImageBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscairoImageBufferCairocpp">trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgImageBufferCGcpp">trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaIOSurfaceh">trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaIOSurfacemm">trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsfiltersFETilecpp">trunk/Source/WebCore/platform/graphics/filters/FETile.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmacThemeMacmm">trunk/Source/WebCore/platform/mac/ThemeMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreammacAVVideoCaptureSourcemm">trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjectcpp">trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeMacmm">trunk/Source/WebCore/rendering/RenderThemeMac.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGResourcePatterncpp">trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp</a></li>
<li><a href="#trunkSourceWebCoresvggraphicsSVGImagecpp">trunk/Source/WebCore/svg/graphics/SVGImage.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebContextMenuClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebFramecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/ChangeLog        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2015-12-13 Tim Horton <timothy_horton@apple.com>
+
+ Adopt CGIOSurfaceContextCreateImageReference to avoid unnecessary readback
+ https://bugs.webkit.org/show_bug.cgi?id=150988
+ <rdar://problem/18993594>
+
+ Reviewed by Darin Adler.
+
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::drawConsumingImageBuffer):
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/ImageBuffer.h:
+ * platform/graphics/cg/ImageBufferCG.cpp:
+ (WebCore::createBitmapImageAfterScalingIfNeeded):
+ (WebCore::ImageBuffer::copyImage):
+ (WebCore::ImageBuffer::sinkIntoImage):
+ (WebCore::ImageBuffer::sinkIntoNativeImage):
+ (WebCore::ImageBuffer::drawConsuming):
+ * platform/graphics/cocoa/IOSurface.h:
+ * platform/graphics/cocoa/IOSurface.mm:
+ (IOSurface::createFromImageBuffer):
+ (IOSurface::sinkIntoImage):
+ Add sinkIntoImage, sinkIntoNativeImage, and drawConsuming to ImageBuffer,
+ which all consume the ImageBuffer and allow us to tell the system to
+ make a CGImage that references the IOSurface, which is in many cases
+ more efficient than making an image with a "copy" of the IOSurface.
+ (The copy is done lazily, but we often hit a corner case that causes
+ it to happen unnecessarily.)
+
+ * html/shadow/MediaControlElements.cpp:
+ (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
+ * page/TextIndicator.cpp:
+ (WebCore::takeSnapshot):
+ * platform/DragImage.cpp:
+ (WebCore::createDragImageFromSnapshot):
+ * platform/graphics/filters/FETile.cpp:
+ (WebCore::FETile::platformApplySoftware):
+ * platform/mac/ThemeMac.mm:
+ (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
+ * platform/mediastream/mac/AVVideoCaptureSource.mm:
+ (WebCore::AVVideoCaptureSource::currentFrameImage):
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::paintProgressBar):
+ * rendering/svg/RenderSVGResourcePattern.cpp:
+ (WebCore::RenderSVGResourcePattern::buildPattern):
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::drawPatternForContainer):
+ Adopt sinkIntoImage and drawConsumingImageBuffer in a few places.
+
</ins><span class="cx"> 2015-12-13 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> CachedScript could have a copy-free path for all-ASCII scripts.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowMediaControlElementscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -1374,7 +1374,7 @@
</span><span class="cx">
</span><span class="cx"> layer->paint(buffer->context(), paintingRect, LayoutSize(), PaintBehaviorFlattenCompositingLayers, nullptr, RenderLayer::PaintLayerPaintingCompositingAllPhases);
</span><span class="cx">
</span><del>- return buffer->copyImage();
</del><ins>+ return ImageBuffer::sinkIntoImage(WTF::move(buffer));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MediaControlTextTrackContainerElement::textTrackRepresentationBoundsChanged(const IntRect&)
</span></span></pre></div>
<a id="trunkSourceWebCorepageTextIndicatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/TextIndicator.cpp (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/TextIndicator.cpp        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/page/TextIndicator.cpp        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx"> if (!buffer)
</span><span class="cx"> return nullptr;
</span><span class="cx"> scaleFactor = buffer->resolutionScale();
</span><del>- return buffer->copyImage(CopyBackingStore, Unscaled);
</del><ins>+ return ImageBuffer::sinkIntoImage(WTF::move(buffer), Unscaled);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static bool takeSnapshots(TextIndicatorData& data, Frame& frame, IntRect snapshotRect)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformDragImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/DragImage.cpp (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/DragImage.cpp        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/platform/DragImage.cpp        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(node);
</span><span class="cx"> #endif
</span><del>- RefPtr<Image> image = snapshot->copyImage(ImageBuffer::fastCopyImageMode(), Unscaled);
</del><ins>+ RefPtr<Image> image = ImageBuffer::sinkIntoImage(WTF::move(snapshot), Unscaled);
</ins><span class="cx"> if (!image)
</span><span class="cx"> return nullptr;
</span><span class="cx"> return createDragImageFromImage(image.get(), orientation);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -443,6 +443,33 @@
</span><span class="cx"> image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_useLowQualityScale);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void GraphicsContext::drawConsumingImageBuffer(std::unique_ptr<ImageBuffer> image, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions)
+{
+ if (!image)
+ return;
+ IntSize imageLogicalSize = image->logicalSize();
+ drawConsumingImageBuffer(WTF::move(image), FloatRect(destination, imageLogicalSize), FloatRect(FloatPoint(), imageLogicalSize), imagePaintingOptions);
+}
+
+void GraphicsContext::drawConsumingImageBuffer(std::unique_ptr<ImageBuffer> image, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions)
+{
+ if (!image)
+ return;
+ IntSize imageLogicalSize = image->logicalSize();
+ drawConsumingImageBuffer(WTF::move(image), destination, FloatRect(FloatPoint(), FloatSize(imageLogicalSize)), imagePaintingOptions);
+}
+
+void GraphicsContext::drawConsumingImageBuffer(std::unique_ptr<ImageBuffer> image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions)
+{
+ if (paintingDisabled() || !image)
+ return;
+
+ // FIXME (49002): Should be InterpolationLow
+ InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationNone : imageInterpolationQuality());
+
+ ImageBuffer::drawConsuming(WTF::move(image), *this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_useLowQualityScale);
+}
+
</ins><span class="cx"> void GraphicsContext::clip(const IntRect& rect)
</span><span class="cx"> {
</span><span class="cx"> clip(FloatRect(rect));
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -315,6 +315,10 @@
</span><span class="cx">
</span><span class="cx"> void drawPattern(Image&, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal);
</span><span class="cx">
</span><ins>+ WEBCORE_EXPORT void drawConsumingImageBuffer(std::unique_ptr<ImageBuffer>, const FloatPoint& destination, const ImagePaintingOptions& = ImagePaintingOptions());
+ void drawConsumingImageBuffer(std::unique_ptr<ImageBuffer>, const FloatRect& destination, const ImagePaintingOptions& = ImagePaintingOptions());
+ void drawConsumingImageBuffer(std::unique_ptr<ImageBuffer>, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = ImagePaintingOptions());
+
</ins><span class="cx"> WEBCORE_EXPORT void setImageInterpolationQuality(InterpolationQuality);
</span><span class="cx"> InterpolationQuality imageInterpolationQuality() const { return m_state.imageInterpolationQuality; }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsImageBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -67,6 +67,7 @@
</span><span class="cx">
</span><span class="cx"> class ImageBuffer {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(ImageBuffer); WTF_MAKE_FAST_ALLOCATED;
</span><ins>+ friend class IOSurface;
</ins><span class="cx"> public:
</span><span class="cx"> // Will return a null pointer on allocation failure.
</span><span class="cx"> static std::unique_ptr<ImageBuffer> create(const FloatSize& size, RenderingMode renderingMode, float resolutionScale = 1, ColorSpace colorSpace = ColorSpaceSRGB)
</span><span class="lines">@@ -91,6 +92,7 @@
</span><span class="cx"> WEBCORE_EXPORT GraphicsContext& context() const;
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT RefPtr<Image> copyImage(BackingStoreCopy = CopyBackingStore, ScaleBehavior = Scaled) const;
</span><ins>+ WEBCORE_EXPORT static RefPtr<Image> sinkIntoImage(std::unique_ptr<ImageBuffer>, ScaleBehavior = Scaled);
</ins><span class="cx"> // Give hints on the faster copyImage Mode, return DontCopyBackingStore if it supports the DontCopyBackingStore behavior
</span><span class="cx"> // or return CopyBackingStore if it doesn't.
</span><span class="cx"> static BackingStoreCopy fastCopyImageMode();
</span><span class="lines">@@ -130,6 +132,7 @@
</span><span class="cx"> // The returned image might be larger than the internalSize(). If you want the smaller
</span><span class="cx"> // image, crop the result.
</span><span class="cx"> RetainPtr<CGImageRef> copyNativeImage(BackingStoreCopy = CopyBackingStore) const;
</span><ins>+ static RetainPtr<CGImageRef> sinkIntoNativeImage(std::unique_ptr<ImageBuffer>);
</ins><span class="cx"> void flushContext() const;
</span><span class="cx"> #endif
</span><span class="cx"> void clip(GraphicsContext&, const FloatRect&) const;
</span><span class="lines">@@ -137,6 +140,8 @@
</span><span class="cx"> void draw(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false);
</span><span class="cx"> void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal);
</span><span class="cx">
</span><ins>+ static void drawConsuming(std::unique_ptr<ImageBuffer>, GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false);
+
</ins><span class="cx"> inline void genericConvertToLuminanceMask();
</span><span class="cx">
</span><span class="cx"> friend class GraphicsContext;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscairoImageBufferCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -195,6 +195,11 @@
</span><span class="cx"> return *m_data.m_context;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RefPtr<Image> ImageBuffer::sinkIntoImage(std::unique_ptr<ImageBuffer> imageBuffer, ScaleBehavior scaleBehavior)
+{
+ return imageBuffer->copyImage(DontCopyBackingStore, scaleBehavior);
+}
+
</ins><span class="cx"> RefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, ScaleBehavior) const
</span><span class="cx"> {
</span><span class="cx"> if (copyBehavior == CopyBackingStore)
</span><span class="lines">@@ -214,6 +219,11 @@
</span><span class="cx"> context.platformContext()->pushImageMask(m_data.m_surface.get(), maskRect);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ImageBuffer::drawConsuming(std::unique_ptr<ImageBuffer> imageBuffer, GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
+{
+ imageBuffer->draw(destContext, destRect, srcRect, op, blendMode, useLowQualityScale);
+}
+
</ins><span class="cx"> void ImageBuffer::draw(GraphicsContext& destinationContext, const FloatRect& destRect, const FloatRect& srcRect,
</span><span class="cx"> CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgImageBufferCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="cx"> #include <wtf/text/Base64.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><ins>+
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> #include "WebCoreSystemInterface.h"
</span><span class="cx"> #endif
</span><span class="lines">@@ -177,18 +178,15 @@
</span><span class="cx"> return image;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, ScaleBehavior scaleBehavior) const
</del><ins>+static RefPtr<Image> createBitmapImageAfterScalingIfNeeded(RetainPtr<CGImageRef>&& image, IntSize internalSize, IntSize logicalSize, IntSize backingStoreSize, float resolutionScale, ScaleBehavior scaleBehavior)
</ins><span class="cx"> {
</span><del>- RetainPtr<CGImageRef> image;
- if (m_resolutionScale == 1 || scaleBehavior == Unscaled) {
- image = copyNativeImage(copyBehavior);
- image = createCroppedImageIfNecessary(image.get(), internalSize());
- } else {
- image = copyNativeImage(DontCopyBackingStore);
- RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(0, logicalSize().width(), logicalSize().height(), 8, 4 * logicalSize().width(), sRGBColorSpaceRef(), kCGImageAlphaPremultipliedLast));
</del><ins>+ if (resolutionScale == 1 || scaleBehavior == Unscaled)
+ image = createCroppedImageIfNecessary(image.get(), internalSize);
+ else {
+ RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(0, logicalSize.width(), logicalSize.height(), 8, 4 * logicalSize.width(), sRGBColorSpaceRef(), kCGImageAlphaPremultipliedLast));
</ins><span class="cx"> CGContextSetBlendMode(context.get(), kCGBlendModeCopy);
</span><del>- CGContextClipToRect(context.get(), FloatRect(FloatPoint::zero(), logicalSize()));
- FloatSize imageSizeInUserSpace = scaleSizeToUserSpace(logicalSize(), m_data.backingStoreSize, internalSize());
</del><ins>+ CGContextClipToRect(context.get(), FloatRect(FloatPoint::zero(), logicalSize));
+ FloatSize imageSizeInUserSpace = scaleSizeToUserSpace(logicalSize, backingStoreSize, internalSize);
</ins><span class="cx"> CGContextDrawImage(context.get(), FloatRect(FloatPoint::zero(), imageSizeInUserSpace), image.get());
</span><span class="cx"> image = adoptCF(CGBitmapContextCreateImage(context.get()));
</span><span class="cx"> }
</span><span class="lines">@@ -199,11 +197,44 @@
</span><span class="cx"> return BitmapImage::create(image.get());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, ScaleBehavior scaleBehavior) const
+{
+ RetainPtr<CGImageRef> image;
+ if (m_resolutionScale == 1 || scaleBehavior == Unscaled)
+ image = copyNativeImage(copyBehavior);
+ else
+ image = copyNativeImage(DontCopyBackingStore);
+
+ return createBitmapImageAfterScalingIfNeeded(WTF::move(image), internalSize(), logicalSize(), m_data.backingStoreSize, m_resolutionScale, scaleBehavior);
+}
+
+RefPtr<Image> ImageBuffer::sinkIntoImage(std::unique_ptr<ImageBuffer> imageBuffer, ScaleBehavior scaleBehavior)
+{
+ IntSize internalSize = imageBuffer->internalSize();
+ IntSize logicalSize = imageBuffer->logicalSize();
+ IntSize backingStoreSize = imageBuffer->m_data.backingStoreSize;
+ float resolutionScale = imageBuffer->m_resolutionScale;
+
+ return createBitmapImageAfterScalingIfNeeded(sinkIntoNativeImage(WTF::move(imageBuffer)), internalSize, logicalSize, backingStoreSize, resolutionScale, scaleBehavior);
+}
+
</ins><span class="cx"> BackingStoreCopy ImageBuffer::fastCopyImageMode()
</span><span class="cx"> {
</span><span class="cx"> return DontCopyBackingStore;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RetainPtr<CGImageRef> ImageBuffer::sinkIntoNativeImage(std::unique_ptr<ImageBuffer> imageBuffer)
+{
+#if USE(IOSURFACE_CANVAS_BACKING_STORE)
+ if (!imageBuffer->m_data.surface)
+ return imageBuffer->copyNativeImage(DontCopyBackingStore);
+
+ return IOSurface::sinkIntoImage(IOSurface::createFromImageBuffer(WTF::move(imageBuffer)));
+#else
+ return imageBuffer->copyNativeImage(DontCopyBackingStore);
+#endif
+}
+
</ins><span class="cx"> RetainPtr<CGImageRef> ImageBuffer::copyNativeImage(BackingStoreCopy copyBehavior) const
</span><span class="cx"> {
</span><span class="cx"> RetainPtr<CGImageRef> image;
</span><span class="lines">@@ -228,6 +259,29 @@
</span><span class="cx"> return image;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ImageBuffer::drawConsuming(std::unique_ptr<ImageBuffer> imageBuffer, GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
+{
+#if USE(IOSURFACE_CANVAS_BACKING_STORE)
+ if (!imageBuffer->m_data.surface) {
+ imageBuffer->draw(destContext, destRect, srcRect, op, blendMode, useLowQualityScale);
+ return;
+ }
+
+ ASSERT(destContext.isAcceleratedContext());
+
+ float resolutionScale = imageBuffer->m_resolutionScale;
+ IntSize backingStoreSize = imageBuffer->m_data.backingStoreSize;
+
+ RetainPtr<CGImageRef> image = IOSurface::sinkIntoImage(IOSurface::createFromImageBuffer(WTF::move(imageBuffer)));
+
+ FloatRect adjustedSrcRect = srcRect;
+ adjustedSrcRect.scale(resolutionScale, resolutionScale);
+ destContext.drawNativeImage(image.get(), backingStoreSize, destRect, adjustedSrcRect, op, blendMode);
+#else
+ imageBuffer->draw(destContext, destRect, srcRect, op, blendMode, useLowQualityScale);
+#endif
+}
+
</ins><span class="cx"> void ImageBuffer::draw(GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, bool)
</span><span class="cx"> {
</span><span class="cx"> RetainPtr<CGImageRef> image;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaIOSurfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -50,6 +50,8 @@
</span><span class="cx"> WEBCORE_EXPORT static std::unique_ptr<IOSurface> createFromSendRight(const MachSendRight&, ColorSpace);
</span><span class="cx"> static std::unique_ptr<IOSurface> createFromSurface(IOSurfaceRef, ColorSpace);
</span><span class="cx"> WEBCORE_EXPORT static std::unique_ptr<IOSurface> createFromImage(CGImageRef);
</span><ins>+
+ static std::unique_ptr<IOSurface> createFromImageBuffer(std::unique_ptr<ImageBuffer>);
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT static void moveToPool(std::unique_ptr<IOSurface>&&);
</span><span class="cx">
</span><span class="lines">@@ -60,6 +62,7 @@
</span><span class="cx"> // Any images created from a surface need to be released before releasing
</span><span class="cx"> // the surface, or an expensive GPU readback can result.
</span><span class="cx"> WEBCORE_EXPORT RetainPtr<CGImageRef> createImage();
</span><ins>+ static RetainPtr<CGImageRef> sinkIntoImage(std::unique_ptr<IOSurface>);
</ins><span class="cx">
</span><span class="cx"> IOSurfaceRef surface() const { return m_surface.get(); }
</span><span class="cx"> WEBCORE_EXPORT GraphicsContext& ensureGraphicsContext();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaIOSurfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -31,12 +31,15 @@
</span><span class="cx"> #import "GraphicsContextCG.h"
</span><span class="cx"> #import "IOSurfacePool.h"
</span><span class="cx"> #import "IOSurfaceSPI.h"
</span><ins>+#import "ImageBuffer.h"
+#import "ImageBufferDataCG.h"
</ins><span class="cx"> #import "MachSendRight.h"
</span><span class="cx"> #import <wtf/Assertions.h>
</span><span class="cx">
</span><span class="cx"> extern "C" {
</span><span class="cx"> CGContextRef CGIOSurfaceContextCreate(IOSurfaceRef, size_t, size_t, size_t, size_t, CGColorSpaceRef, CGBitmapInfo);
</span><span class="cx"> CGImageRef CGIOSurfaceContextCreateImage(CGContextRef);
</span><ins>+CGImageRef CGIOSurfaceContextCreateImageReference(CGContextRef);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -98,6 +101,11 @@
</span><span class="cx"> IOSurfacePool::sharedPool().addSurface(WTF::move(surface));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+std::unique_ptr<IOSurface> IOSurface::createFromImageBuffer(std::unique_ptr<ImageBuffer> imageBuffer)
+{
+ return WTF::move(imageBuffer->m_data.surface);
+}
+
</ins><span class="cx"> IOSurface::IOSurface(IntSize size, ColorSpace colorSpace, Format format)
</span><span class="cx"> : m_colorSpace(colorSpace)
</span><span class="cx"> , m_size(size)
</span><span class="lines">@@ -244,6 +252,15 @@
</span><span class="cx"> return adoptCF(CGIOSurfaceContextCreateImage(ensurePlatformContext()));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RetainPtr<CGImageRef> IOSurface::sinkIntoImage(std::unique_ptr<IOSurface> surface)
+{
+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+ return adoptCF(CGIOSurfaceContextCreateImageReference(surface->ensurePlatformContext()));
+#else
+ return surface->createImage();
+#endif
+}
+
</ins><span class="cx"> void IOSurface::setContextSize(IntSize contextSize)
</span><span class="cx"> {
</span><span class="cx"> if (contextSize == m_contextSize)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsfiltersFETilecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/filters/FETile.cpp (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/filters/FETile.cpp        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/platform/graphics/filters/FETile.cpp        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx"> tileImageContext.translate(-inMaxEffectLocation.x(), -inMaxEffectLocation.y());
</span><span class="cx"> tileImageContext.drawImageBuffer(*inBuffer, in->absolutePaintRect().location());
</span><span class="cx">
</span><del>- auto tileImageCopy = tileImage->copyImage(CopyBackingStore);
</del><ins>+ auto tileImageCopy = ImageBuffer::sinkIntoImage(WTF::move(tileImage));
</ins><span class="cx"> if (!tileImageCopy)
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacThemeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/ThemeMac.mm (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/ThemeMac.mm        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.mm        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -692,7 +692,7 @@
</span><span class="cx"> LocalCurrentGraphicsContext localContext(imageBuffer->context());
</span><span class="cx"> needsRepaint = drawCellOrFocusRingIntoRectWithView(cell, imageBufferDrawRect, view, drawButtonCell, drawFocusRing);
</span><span class="cx"> }
</span><del>- context.drawImageBuffer(*imageBuffer, rect.location() - FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth));
</del><ins>+ context.drawConsumingImageBuffer(WTF::move(imageBuffer), rect.location() - FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth));
</ins><span class="cx"> return needsRepaint;
</span><span class="cx"> }
</span><span class="cx"> if (drawButtonCell)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreammacAVVideoCaptureSourcemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -334,7 +334,7 @@
</span><span class="cx">
</span><span class="cx"> paintCurrentFrameInContext(imageBuffer->context(), imageRect);
</span><span class="cx">
</span><del>- return imageBuffer->copyImage();
</del><ins>+ return ImageBuffer::sinkIntoImage(WTF::move(imageBuffer));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RetainPtr<CGImageRef> AVVideoCaptureSource::currentFrameCGImage()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -840,7 +840,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (maskImage && bgLayer->clip() == TextFillBox) {
</span><del>- context.drawImageBuffer(*maskImage, maskRect, CompositeDestinationIn);
</del><ins>+ context.drawConsumingImageBuffer(WTF::move(maskImage), maskRect, CompositeDestinationIn);
</ins><span class="cx"> context.endTransparencyLayer();
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeMac.mm        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -1156,7 +1156,7 @@
</span><span class="cx"> paintInfo.context().scale(FloatSize(-1, 1));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- paintInfo.context().drawImageBuffer(*imageBuffer, inflatedRect.location());
</del><ins>+ paintInfo.context().drawConsumingImageBuffer(WTF::move(imageBuffer), inflatedRect.location());
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGResourcePatterncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -113,7 +113,9 @@
</span><span class="cx"> if (!tileImage)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- RefPtr<Image> copiedImage = tileImage->copyImage(CopyBackingStore);
</del><ins>+ const IntSize tileImageSize = tileImage->logicalSize();
+
+ RefPtr<Image> copiedImage = ImageBuffer::sinkIntoImage(WTF::move(tileImage));
</ins><span class="cx"> if (!copiedImage)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="lines">@@ -122,7 +124,7 @@
</span><span class="cx"> patternData->pattern = Pattern::create(copiedImage, true, true);
</span><span class="cx">
</span><span class="cx"> // Compute pattern space transformation.
</span><del>- const IntSize tileImageSize = tileImage->logicalSize();
</del><ins>+
</ins><span class="cx"> patternData->transform.translate(tileBoundaries.x(), tileBoundaries.y());
</span><span class="cx"> patternData->transform.scale(tileBoundaries.width() / tileImageSize.width(), tileBoundaries.height() / tileImageSize.height());
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoresvggraphicsSVGImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -208,7 +208,7 @@
</span><span class="cx"> if (context.drawLuminanceMask())
</span><span class="cx"> buffer->convertToLuminanceMask();
</span><span class="cx">
</span><del>- RefPtr<Image> image = buffer->copyImage(DontCopyBackingStore, Unscaled);
</del><ins>+ RefPtr<Image> image = ImageBuffer::sinkIntoImage(WTF::move(buffer), Unscaled);
</ins><span class="cx"> if (!image)
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-12-13 Tim Horton <timothy_horton@apple.com>
+
+ Adopt CGIOSurfaceContextCreateImageReference to avoid unnecessary readback
+ https://bugs.webkit.org/show_bug.cgi?id=150988
+ <rdar://problem/18993594>
+
+ Reviewed by Darin Adler.
+
+ * WebCoreSupport/WebContextMenuClient.mm:
+ (WebContextMenuClient::imageForCurrentSharingServicePickerItem):
+ Adopt sinkIntoImage and drawConsumingImageBuffer in a few places.
+
</ins><span class="cx"> 2015-12-11 Eric Carlson <eric.carlson@apple.com>
</span><span class="cx">
</span><span class="cx"> [MediaStream] Add a setting to allow the mock media capture devices to be enabled and disabled
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebContextMenuClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -220,7 +220,7 @@
</span><span class="cx"> frameView->frame().selection().setSelection(oldSelection);
</span><span class="cx"> frameView->setPaintBehavior(oldPaintBehavior);
</span><span class="cx">
</span><del>- RefPtr<Image> image = buffer->copyImage(DontCopyBackingStore);
</del><ins>+ RefPtr<Image> image = ImageBuffer::sinkIntoImage(WTF::move(buffer));
</ins><span class="cx"> if (!image)
</span><span class="cx"> return nil;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebKit2/ChangeLog        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-12-13 Tim Horton <timothy_horton@apple.com>
+
+ Adopt CGIOSurfaceContextCreateImageReference to avoid unnecessary readback
+ https://bugs.webkit.org/show_bug.cgi?id=150988
+ <rdar://problem/18993594>
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::createSelectionSnapshot):
+ Adopt sinkIntoImage and drawConsumingImageBuffer in a few places.
+
</ins><span class="cx"> 2015-12-13 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> Another fix after r194018.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (194024 => 194025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp        2015-12-14 04:30:37 UTC (rev 194024)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp        2015-12-14 05:27:45 UTC (rev 194025)
</span><span class="lines">@@ -826,7 +826,7 @@
</span><span class="cx"> auto graphicsContext = sharedSnapshot->createGraphicsContext();
</span><span class="cx"> float deviceScaleFactor = coreFrame()->page()->deviceScaleFactor();
</span><span class="cx"> graphicsContext->scale(FloatSize(deviceScaleFactor, deviceScaleFactor));
</span><del>- graphicsContext->drawImageBuffer(*snapshot, FloatPoint());
</del><ins>+ graphicsContext->drawConsumingImageBuffer(WTF::move(snapshot), FloatPoint());
</ins><span class="cx">
</span><span class="cx"> return sharedSnapshot.release();
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>