<!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>[205841] trunk/Source/WebCore</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/205841">205841</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-09-12 16:51:57 -0700 (Mon, 12 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move the pixel data of ImageFrame to a separate class named ImageBackingStore
https://bugs.webkit.org/show_bug.cgi?id=159679

Patch by Said Abou-Hallawa &lt;sabouhallawa@apple.com&gt; on 2016-09-12
Reviewed by Simon Fraser.

Move the pixel data manipulation part in ImageFrame into a separate class
and allocate it on demand.

* PlatformEfl.cmake:
* PlatformGTK.cmake:
* PlatformWinCairo.cmake:
* WebCore.xcodeproj/project.pbxproj:
Add ImageBackingStoreCairo.cpp and remove ImageDecoderCairo.cpp from the
WebKit projects.

* platform/graphics/Color.cpp:
(WebCore::premultipliedChannel): channel = channel * alpha / 255.
(WebCore::unpremultipliedChannel): channel = channel * 255 / alpha.
(WebCore::makePremultipliedRGBA): Un-premultiplied channels to premultiplied RGBA32.
(WebCore::makeUnPremultipliedRGBA): Premultiplied channels to un-premultiplied RGBA32.
(WebCore::colorFromPremultipliedARGB): Use makeUnPremultipliedRGBA.
(WebCore::premultipliedARGBFromColor): Use makePremultipliedRGBA.
* platform/graphics/Color.h:
(WebCore::fastMultiplyBy255): x * 255 = x * 256 - x = x &lt;&lt; 8 - x.

* platform/graphics/ImageBackingStore.h: Added.
(WebCore::ImageBackingStore::create): Creates a new ImageBackingStore.
(WebCore::ImageBackingStore::setSize): Changes the pixels size.
(WebCore::ImageBackingStore::setFrameRect): This will always just be the entire buffer except for GIF and PNG frames.
(WebCore::ImageBackingStore::size): Returns the pixels size.
(WebCore::ImageBackingStore::frameRect): Returns the pixels frame rectangle.
(WebCore::ImageBackingStore::clear): Clears the entire image.
(WebCore::ImageBackingStore::clearRect): Clears a rectangle in the image.
(WebCore::ImageBackingStore::repeatFirstRow): Repeats the first row in a rectangle in the image.
(WebCore::ImageBackingStore::pixelAt): Returns a pointer to a pixel data.
(WebCore::ImageBackingStore::setPixel): Sets the color of a pixel in the image.
(WebCore::ImageBackingStore::blendPixel): Blend a color with a pixel in the image.
(WebCore::ImageBackingStore::inBounds): Checks if a rectangle is in the bounds of the image.
(WebCore::ImageBackingStore::isOverSize): Checks whether a size could not be allocated for an image.
(WebCore::ImageBackingStore::ImageBackingStore):

* platform/graphics/cg/NativeImageCG.cpp:
(WebCore::nativeImageHasAlpha): Implement this function. See comments in https://bugs.webkit.org/show_bug.cgi?id=158684.

* platform/image-decoders/ImageDecoder.cpp:
(WebCore::ImageFrame::operator=): copyBitmapData() now copies the frameRect of the ImageBackingStore.
(WebCore::ImageFrame::clearPixelData): The pixels data and the pointer to these pixels are now included in the ImageBackingStore.
(WebCore::ImageFrame::zeroFillPixelData): Clearing the image pixels are now in ImageBackingStore::clear().
(WebCore::ImageFrame::zeroFillFrameRect): Clearing the image pixels are now in ImageBackingStore::clearRect().
(WebCore::ImageFrame::copyBitmapData): We either need to create a new ImageBackingStore or nullify the current one.
(WebCore::ImageFrame::setSize): ImageFrame::setSize() is supposed to be called once and to create the ImageBackingStore.
(WebCore::ImageFrame::setOriginalFrameRect): Delegate this call to ImageBackingStore::setFrameRect().
(WebCore::ImageDecoder::frameBytesAtIndex): ImageFrame::PixelData can be replaced by RGBA32.

* platform/image-decoders/ImageDecoder.h:
(WebCore::ImageFrame::copyRowNTimes): The implementation was moved to ImageBackingStore::repeatFirstRow().
(WebCore::ImageFrame::size): Gets the size of an image from its ImageBackingStore.
(WebCore::ImageFrame::asNewNativeImage): Gets a NtaiveImagePtr from the ImageBackingStore.
(WebCore::ImageFrame::backingStore): Returns a raw pointer to the ImageBackingStore.
(WebCore::ImageFrame::hasBackingStore): Returns whether the ImageFrame has an ImageBackingStore.
(WebCore::ImageFrame::originalFrameRect): Returns the frameRect of the image from its ImageBackingStore.
(WebCore::ImageFrame::pixelAt): Delegates the call to the ImageBackingStore.
(WebCore::ImageFrame::setPixel): Delegates the call to the ImageBackingStore.
(WebCore::ImageFrame::blendPixel): Delegates the call to the ImageBackingStore.

(WebCore::ImageDecoder::setSize): setSize() now takes an IntSize.
(WebCore::ImageFrame::setOriginalFrameRect): Deleted. Moved to ImageDecoder.cpp.
(WebCore::ImageFrame::setRGBA): Deleted. Renamed to ImageFrame::setPixel().
(WebCore::ImageFrame::getAddr): Deleted. Renamed to ImageFrame::pixelAt().
(WebCore::ImageFrame::hasPixelData): Deleted. Renamed to ImageFrame::hasBackingStore().
(WebCore::ImageFrame::fixPointUnsignedMultiply): Deleted.
(WebCore::ImageFrame::divide255): Deleted. Replaced by fastDivideBy255() from Color.h.
(WebCore::ImageFrame::overRGBA): Deleted. Renamed to ImageFrame::blendPixel().
(WebCore::ImageFrame::width): Deleted.
(WebCore::ImageFrame::height): Deleted.
(WebCore::ImageDecoder::isOverSize): Deleted. Moved to ImageBackingStore::isOverSize().

* platform/image-decoders/bmp/BMPImageReader.cpp:
(WebCore::BMPImageReader::decodeBMP):
(WebCore::BMPImageReader::processInfoHeader):
(WebCore::BMPImageReader::processNonRLEData):
* platform/image-decoders/bmp/BMPImageReader.h:
(WebCore::BMPImageReader::setI):
(WebCore::BMPImageReader::setPixel):
(WebCore::BMPImageReader::fillRGBA):
(WebCore::BMPImageReader::setRGBA): Deleted.
* platform/image-decoders/cairo/ImageBackingStoreCairo.cpp: Added.
(WebCore::ImageBackingStore::image):
* platform/image-decoders/cairo/ImageDecoderCairo.cpp: Removed.
* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::setSize):
(WebCore::GIFImageDecoder::haveDecodedRow):
(WebCore::GIFImageDecoder::initFrameBuffer):
* platform/image-decoders/gif/GIFImageDecoder.h:
* platform/image-decoders/gif/GIFImageReader.cpp:
(GIFImageReader::parse):
* platform/image-decoders/ico/ICOImageDecoder.cpp:
(WebCore::ICOImageDecoder::setSize):
(WebCore::ICOImageDecoder::processDirectoryEntries):
* platform/image-decoders/ico/ICOImageDecoder.h:
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::JPEGImageReader::decode):
(WebCore::JPEGImageDecoder::setSize):
(WebCore::setPixel):
(WebCore::JPEGImageDecoder::outputScanlines):
* platform/image-decoders/jpeg/JPEGImageDecoder.h:
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageDecoder::setSize):
(WebCore::PNGImageDecoder::headerAvailable):
(WebCore::setPixelRGB):
(WebCore::setPixelRGBA):
(WebCore::setPixelPremultipliedRGBA):
(WebCore::PNGImageDecoder::rowAvailable):
(WebCore::PNGImageDecoder::initFrameBuffer):
(WebCore::PNGImageDecoder::frameComplete):
* platform/image-decoders/png/PNGImageDecoder.h:
* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::decode):
- Send an IntSize to ImageFrame::setSize() and ImageDecoder::setSize().
- Replace ImageFrame::PixelData by RGBA32.
- No need to call ImageFrame::setOriginalFrameRect() if this sets the
  frameRect to the entire image rectangle since this is done by default
  in ImageBackingStore::setSize().
- ImageBackingStore::image() now replaces ImageFrame::asNewNativeImage().
- ImageFrame::setPixel() now replaces ImageFrame::setRGBA().
- ImageFrame::blendPixel() now replaces ImageFrame::overRGBA().
- ImageFrame::pixelAt() now replaces ImageFrame::getAddr().</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformEflcmake">trunk/Source/WebCore/PlatformEfl.cmake</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebCorePlatformWinCairocmake">trunk/Source/WebCore/PlatformWinCairo.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsColorcpp">trunk/Source/WebCore/platform/graphics/Color.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsColorh">trunk/Source/WebCore/platform/graphics/Color.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgNativeImageCGcpp">trunk/Source/WebCore/platform/graphics/cg/NativeImageCG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersImageDecodercpp">trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersImageDecoderh">trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersbmpBMPImageReadercpp">trunk/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersbmpBMPImageReaderh">trunk/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.h</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersgifGIFImageDecodercpp">trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersgifGIFImageDecoderh">trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersgifGIFImageReadercpp">trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersicoICOImageDecodercpp">trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersicoICOImageDecoderh">trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersjpegJPEGImageDecodercpp">trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersjpegJPEGImageDecoderh">trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecoderspngPNGImageDecodercpp">trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecoderspngPNGImageDecoderh">trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecoderswebpWEBPImageDecodercpp">trunk/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicsImageBackingStoreh">trunk/Source/WebCore/platform/graphics/ImageBackingStore.h</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecoderscairoImageBackingStoreCairocpp">trunk/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformimagedecoderscairoImageDecoderCairocpp">trunk/Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/ChangeLog        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -1,3 +1,133 @@
</span><ins>+2016-09-12  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
+
+        Move the pixel data of ImageFrame to a separate class named ImageBackingStore
+        https://bugs.webkit.org/show_bug.cgi?id=159679
+
+        Reviewed by Simon Fraser.
+
+        Move the pixel data manipulation part in ImageFrame into a separate class
+        and allocate it on demand.
+
+        * PlatformEfl.cmake:
+        * PlatformGTK.cmake:
+        * PlatformWinCairo.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        Add ImageBackingStoreCairo.cpp and remove ImageDecoderCairo.cpp from the
+        WebKit projects.
+
+        * platform/graphics/Color.cpp:
+        (WebCore::premultipliedChannel): channel = channel * alpha / 255.
+        (WebCore::unpremultipliedChannel): channel = channel * 255 / alpha.
+        (WebCore::makePremultipliedRGBA): Un-premultiplied channels to premultiplied RGBA32.
+        (WebCore::makeUnPremultipliedRGBA): Premultiplied channels to un-premultiplied RGBA32.
+        (WebCore::colorFromPremultipliedARGB): Use makeUnPremultipliedRGBA.
+        (WebCore::premultipliedARGBFromColor): Use makePremultipliedRGBA.
+        * platform/graphics/Color.h:
+        (WebCore::fastMultiplyBy255): x * 255 = x * 256 - x = x &lt;&lt; 8 - x.
+
+        * platform/graphics/ImageBackingStore.h: Added.
+        (WebCore::ImageBackingStore::create): Creates a new ImageBackingStore.
+        (WebCore::ImageBackingStore::setSize): Changes the pixels size.
+        (WebCore::ImageBackingStore::setFrameRect): This will always just be the entire buffer except for GIF and PNG frames.
+        (WebCore::ImageBackingStore::size): Returns the pixels size.
+        (WebCore::ImageBackingStore::frameRect): Returns the pixels frame rectangle.
+        (WebCore::ImageBackingStore::clear): Clears the entire image.
+        (WebCore::ImageBackingStore::clearRect): Clears a rectangle in the image.
+        (WebCore::ImageBackingStore::repeatFirstRow): Repeats the first row in a rectangle in the image.
+        (WebCore::ImageBackingStore::pixelAt): Returns a pointer to a pixel data.
+        (WebCore::ImageBackingStore::setPixel): Sets the color of a pixel in the image.
+        (WebCore::ImageBackingStore::blendPixel): Blend a color with a pixel in the image.
+        (WebCore::ImageBackingStore::inBounds): Checks if a rectangle is in the bounds of the image.
+        (WebCore::ImageBackingStore::isOverSize): Checks whether a size could not be allocated for an image.
+        (WebCore::ImageBackingStore::ImageBackingStore):
+
+        * platform/graphics/cg/NativeImageCG.cpp:
+        (WebCore::nativeImageHasAlpha): Implement this function. See comments in https://bugs.webkit.org/show_bug.cgi?id=158684.
+
+        * platform/image-decoders/ImageDecoder.cpp:
+        (WebCore::ImageFrame::operator=): copyBitmapData() now copies the frameRect of the ImageBackingStore.
+        (WebCore::ImageFrame::clearPixelData): The pixels data and the pointer to these pixels are now included in the ImageBackingStore.
+        (WebCore::ImageFrame::zeroFillPixelData): Clearing the image pixels are now in ImageBackingStore::clear().
+        (WebCore::ImageFrame::zeroFillFrameRect): Clearing the image pixels are now in ImageBackingStore::clearRect().
+        (WebCore::ImageFrame::copyBitmapData): We either need to create a new ImageBackingStore or nullify the current one.
+        (WebCore::ImageFrame::setSize): ImageFrame::setSize() is supposed to be called once and to create the ImageBackingStore.
+        (WebCore::ImageFrame::setOriginalFrameRect): Delegate this call to ImageBackingStore::setFrameRect().
+        (WebCore::ImageDecoder::frameBytesAtIndex): ImageFrame::PixelData can be replaced by RGBA32.
+
+        * platform/image-decoders/ImageDecoder.h:
+        (WebCore::ImageFrame::copyRowNTimes): The implementation was moved to ImageBackingStore::repeatFirstRow().
+        (WebCore::ImageFrame::size): Gets the size of an image from its ImageBackingStore.
+        (WebCore::ImageFrame::asNewNativeImage): Gets a NtaiveImagePtr from the ImageBackingStore.
+        (WebCore::ImageFrame::backingStore): Returns a raw pointer to the ImageBackingStore.
+        (WebCore::ImageFrame::hasBackingStore): Returns whether the ImageFrame has an ImageBackingStore.
+        (WebCore::ImageFrame::originalFrameRect): Returns the frameRect of the image from its ImageBackingStore.
+        (WebCore::ImageFrame::pixelAt): Delegates the call to the ImageBackingStore.
+        (WebCore::ImageFrame::setPixel): Delegates the call to the ImageBackingStore.
+        (WebCore::ImageFrame::blendPixel): Delegates the call to the ImageBackingStore.
+        
+        (WebCore::ImageDecoder::setSize): setSize() now takes an IntSize.
+        (WebCore::ImageFrame::setOriginalFrameRect): Deleted. Moved to ImageDecoder.cpp.
+        (WebCore::ImageFrame::setRGBA): Deleted. Renamed to ImageFrame::setPixel().
+        (WebCore::ImageFrame::getAddr): Deleted. Renamed to ImageFrame::pixelAt().
+        (WebCore::ImageFrame::hasPixelData): Deleted. Renamed to ImageFrame::hasBackingStore().
+        (WebCore::ImageFrame::fixPointUnsignedMultiply): Deleted.
+        (WebCore::ImageFrame::divide255): Deleted. Replaced by fastDivideBy255() from Color.h.
+        (WebCore::ImageFrame::overRGBA): Deleted. Renamed to ImageFrame::blendPixel().
+        (WebCore::ImageFrame::width): Deleted.
+        (WebCore::ImageFrame::height): Deleted.
+        (WebCore::ImageDecoder::isOverSize): Deleted. Moved to ImageBackingStore::isOverSize().
+
+        * platform/image-decoders/bmp/BMPImageReader.cpp:
+        (WebCore::BMPImageReader::decodeBMP):
+        (WebCore::BMPImageReader::processInfoHeader):
+        (WebCore::BMPImageReader::processNonRLEData):
+        * platform/image-decoders/bmp/BMPImageReader.h:
+        (WebCore::BMPImageReader::setI):
+        (WebCore::BMPImageReader::setPixel):
+        (WebCore::BMPImageReader::fillRGBA):
+        (WebCore::BMPImageReader::setRGBA): Deleted.
+        * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp: Added.
+        (WebCore::ImageBackingStore::image):
+        * platform/image-decoders/cairo/ImageDecoderCairo.cpp: Removed.
+        * platform/image-decoders/gif/GIFImageDecoder.cpp:
+        (WebCore::GIFImageDecoder::setSize):
+        (WebCore::GIFImageDecoder::haveDecodedRow):
+        (WebCore::GIFImageDecoder::initFrameBuffer):
+        * platform/image-decoders/gif/GIFImageDecoder.h:
+        * platform/image-decoders/gif/GIFImageReader.cpp:
+        (GIFImageReader::parse):
+        * platform/image-decoders/ico/ICOImageDecoder.cpp:
+        (WebCore::ICOImageDecoder::setSize):
+        (WebCore::ICOImageDecoder::processDirectoryEntries):
+        * platform/image-decoders/ico/ICOImageDecoder.h:
+        * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
+        (WebCore::JPEGImageReader::decode):
+        (WebCore::JPEGImageDecoder::setSize):
+        (WebCore::setPixel):
+        (WebCore::JPEGImageDecoder::outputScanlines):
+        * platform/image-decoders/jpeg/JPEGImageDecoder.h:
+        * platform/image-decoders/png/PNGImageDecoder.cpp:
+        (WebCore::PNGImageDecoder::setSize):
+        (WebCore::PNGImageDecoder::headerAvailable):
+        (WebCore::setPixelRGB):
+        (WebCore::setPixelRGBA):
+        (WebCore::setPixelPremultipliedRGBA):
+        (WebCore::PNGImageDecoder::rowAvailable):
+        (WebCore::PNGImageDecoder::initFrameBuffer):
+        (WebCore::PNGImageDecoder::frameComplete):
+        * platform/image-decoders/png/PNGImageDecoder.h:
+        * platform/image-decoders/webp/WEBPImageDecoder.cpp:
+        (WebCore::WEBPImageDecoder::decode):
+        - Send an IntSize to ImageFrame::setSize() and ImageDecoder::setSize().
+        - Replace ImageFrame::PixelData by RGBA32.
+        - No need to call ImageFrame::setOriginalFrameRect() if this sets the
+          frameRect to the entire image rectangle since this is done by default
+          in ImageBackingStore::setSize().
+        - ImageBackingStore::image() now replaces ImageFrame::asNewNativeImage().
+        - ImageFrame::setPixel() now replaces ImageFrame::setRGBA().
+        - ImageFrame::blendPixel() now replaces ImageFrame::overRGBA().
+        - ImageFrame::pixelAt() now replaces ImageFrame::getAddr().
+
</ins><span class="cx"> 2016-09-12  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         HTMLButtonElement.prototype.click should be HTMLElement.prototype.click
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformEflcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformEfl.cmake (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformEfl.cmake        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/PlatformEfl.cmake        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -183,10 +183,9 @@
</span><span class="cx">     platform/graphics/x11/PlatformDisplayX11.cpp
</span><span class="cx">     platform/graphics/x11/XUniqueResource.cpp
</span><span class="cx"> 
</span><ins>+    platform/image-decoders/cairo/ImageBackingStoreCairo.cpp
</ins><span class="cx">     platform/image-encoders/JPEGImageEncoder.cpp
</span><span class="cx"> 
</span><del>-    platform/image-decoders/cairo/ImageDecoderCairo.cpp
-
</del><span class="cx">     platform/network/efl/NetworkStateNotifierEfl.cpp
</span><span class="cx"> 
</span><span class="cx">     platform/network/soup/AuthenticationChallengeSoup.cpp
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx">     platform/gtk/TemporaryLinkStubs.cpp
</span><span class="cx">     platform/gtk/UserAgentGtk.cpp
</span><span class="cx"> 
</span><del>-    platform/image-decoders/cairo/ImageDecoderCairo.cpp
</del><ins>+    platform/image-decoders/cairo/ImageBackingStoreCairo.cpp
</ins><span class="cx"> 
</span><span class="cx">     platform/mediastream/gtk/SDPProcessorScriptResourceGtk.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformWinCairocmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformWinCairo.cmake (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformWinCairo.cmake        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/PlatformWinCairo.cmake        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">     platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
</span><span class="cx">     platform/graphics/win/SimpleFontDataCairoWin.cpp
</span><span class="cx"> 
</span><del>-    platform/image-decoders/cairo/ImageDecoderCairo.cpp
</del><ins>+    platform/image-decoders/cairo/ImageBackingStoreCairo.cpp
</ins><span class="cx"> 
</span><span class="cx">     platform/network/NetworkStorageSessionStub.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -2275,6 +2275,7 @@
</span><span class="cx">                 555B87EC1CAAF0AB00349425 /* ImageDecoderCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */; };
</span><span class="cx">                 555B87ED1CAAF0AB00349425 /* ImageDecoderCG.h in Headers */ = {isa = PBXBuildFile; fileRef = 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */; };
</span><span class="cx">                 55A336F71D8209F40022C4C7 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F61D8209F40022C4C7 /* NativeImage.h */; };
</span><ins>+                55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 5709E8CD1D413D47003244AC /* WebKitSubtleCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5709E8CA1D413CE3003244AC /* WebKitSubtleCrypto.cpp */; };
</span><span class="cx">                 5709E8CE1D413D5B003244AC /* JSWebKitSubtleCryptoCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF8F661807460800132674 /* JSWebKitSubtleCryptoCustom.cpp */; };
</span><span class="cx">                 5709E8CF1D413D9A003244AC /* WebKitSubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 5709E8CB1D413CE3003244AC /* WebKitSubtleCrypto.h */; };
</span><span class="lines">@@ -9298,6 +9299,7 @@
</span><span class="cx">                 555B87EA1CAAF0AB00349425 /* ImageDecoderCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDecoderCG.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDecoderCG.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 55A336F61D8209F40022C4C7 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBackingStore.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5709E8CA1D413CE3003244AC /* WebKitSubtleCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitSubtleCrypto.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5709E8CB1D413CE3003244AC /* WebKitSubtleCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitSubtleCrypto.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -20791,6 +20793,7 @@
</span><span class="cx">                                 379919941200DDF400EA041C /* WOFFFileFormat.cpp */,
</span><span class="cx">                                 379919951200DDF400EA041C /* WOFFFileFormat.h */,
</span><span class="cx">                                 55A336F61D8209F40022C4C7 /* NativeImage.h */,
</span><ins>+                                55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = graphics;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -26364,6 +26367,7 @@
</span><span class="cx">                                 582CB0531A78A14B00AFFCC4 /* SimpleLineLayoutTextFragmentIterator.h in Headers */,
</span><span class="cx">                                 C5A1EA7D152BCF08004D00B6 /* SimplifyMarkupCommand.h in Headers */,
</span><span class="cx">                                 572A7F211C6E5719009C6149 /* SimulatedClick.h in Headers */,
</span><ins>+                                55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */,
</ins><span class="cx">                                 31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */,
</span><span class="cx">                                 FD00D7A514A3F61900734011 /* SincResampler.h in Headers */,
</span><span class="cx">                                 51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsColorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Color.cpp (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Color.cpp        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/graphics/Color.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -49,6 +49,16 @@
</span><span class="cx"> static const RGBA32 lightenedBlack = 0xFF545454;
</span><span class="cx"> static const RGBA32 darkenedWhite = 0xFFABABAB;
</span><span class="cx"> 
</span><ins>+static inline unsigned premultipliedChannel(unsigned c, unsigned a)
+{
+    return fastDivideBy255(c * a + 254);
+}
+
+static inline unsigned unpremultipliedChannel(unsigned c, unsigned a)
+{
+    return (fastMultiplyBy255(c) + a - 1) / a;
+}
+
</ins><span class="cx"> RGBA32 makeRGB(int r, int g, int b)
</span><span class="cx"> {
</span><span class="cx">     return 0xFF000000 | std::max(0, std::min(r, 255)) &lt;&lt; 16 | std::max(0, std::min(g, 255)) &lt;&lt; 8 | std::max(0, std::min(b, 255));
</span><span class="lines">@@ -59,6 +69,16 @@
</span><span class="cx">     return std::max(0, std::min(a, 255)) &lt;&lt; 24 | std::max(0, std::min(r, 255)) &lt;&lt; 16 | std::max(0, std::min(g, 255)) &lt;&lt; 8 | std::max(0, std::min(b, 255));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+RGBA32 makePremultipliedRGBA(int r, int g, int b, int a)
+{
+    return makeRGBA(premultipliedChannel(r, a), premultipliedChannel(g, a), premultipliedChannel(b, a), a);
+}
+
+RGBA32 makeUnPremultipliedRGBA(int r, int g, int b, int a)
+{
+    return makeRGBA(unpremultipliedChannel(r, a), unpremultipliedChannel(g, a), unpremultipliedChannel(b, a), a);
+}
+
</ins><span class="cx"> static int colorFloatToRGBAByte(float f)
</span><span class="cx"> {
</span><span class="cx">     // We use lroundf and 255 instead of nextafterf(256, 0) to match CG's rounding
</span><span class="lines">@@ -482,14 +502,9 @@
</span><span class="cx"> Color colorFromPremultipliedARGB(RGBA32 pixelColor)
</span><span class="cx"> {
</span><span class="cx">     int alpha = alphaChannel(pixelColor);
</span><del>-    if (alpha &amp;&amp; alpha &lt; 255) {
-        return Color::createUnchecked(
-            redChannel(pixelColor) * 255 / alpha,
-            greenChannel(pixelColor) * 255 / alpha,
-            blueChannel(pixelColor) * 255 / alpha,
-            alpha);
-    } else
-        return Color(pixelColor);
</del><ins>+    if (alpha &amp;&amp; alpha &lt; 255)
+        pixelColor = makeUnPremultipliedRGBA(redChannel(pixelColor), greenChannel(pixelColor), blueChannel(pixelColor), alpha);
+    return Color(pixelColor);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RGBA32 premultipliedARGBFromColor(const Color&amp; color)
</span><span class="lines">@@ -497,14 +512,10 @@
</span><span class="cx">     unsigned pixelColor;
</span><span class="cx"> 
</span><span class="cx">     unsigned alpha = color.alpha();
</span><del>-    if (alpha &lt; 255) {
-        pixelColor = Color::createUnchecked(
-            fastDivideBy255(color.red() * alpha + 254),
-            fastDivideBy255(color.green() * alpha + 254),
-            fastDivideBy255(color.blue() * alpha + 254),
-            alpha).rgb();
-    } else
-         pixelColor = color.rgb();
</del><ins>+    if (alpha &lt; 255)
+        pixelColor = makePremultipliedRGBA(color.red(), color.green(), color.blue(), alpha);
+    else
+        pixelColor = color.rgb();
</ins><span class="cx"> 
</span><span class="cx">     return pixelColor;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsColorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Color.h (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Color.h        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/graphics/Color.h        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -55,6 +55,9 @@
</span><span class="cx"> WEBCORE_EXPORT RGBA32 makeRGB(int r, int g, int b);
</span><span class="cx"> WEBCORE_EXPORT RGBA32 makeRGBA(int r, int g, int b, int a);
</span><span class="cx"> 
</span><ins>+RGBA32 makePremultipliedRGBA(int r, int g, int b, int a);
+RGBA32 makeUnPremultipliedRGBA(int r, int g, int b, int a);
+
</ins><span class="cx"> WEBCORE_EXPORT RGBA32 colorWithOverrideAlpha(RGBA32 color, float overrideAlpha);
</span><span class="cx"> WEBCORE_EXPORT RGBA32 colorWithOverrideAlpha(RGBA32 color, Optional&lt;float&gt; overrideAlpha);
</span><span class="cx"> 
</span><span class="lines">@@ -204,6 +207,7 @@
</span><span class="cx"> 
</span><span class="cx"> int differenceSquared(const Color&amp;, const Color&amp;);
</span><span class="cx"> 
</span><ins>+uint16_t fastMultiplyBy255(uint16_t value);
</ins><span class="cx"> uint16_t fastDivideBy255(uint16_t);
</span><span class="cx"> 
</span><span class="cx"> #if USE(CG)
</span><span class="lines">@@ -276,6 +280,11 @@
</span><span class="cx">     return std::max(0.f, std::min(255.f, std::round(value)));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline uint16_t fastMultiplyBy255(uint16_t value)
+{
+    return (value &lt;&lt; 8) - value;
+}
+
</ins><span class="cx"> inline uint16_t fastDivideBy255(uint16_t value)
</span><span class="cx"> {
</span><span class="cx">     // While this is an approximate algorithm for division by 255, it gives perfectly accurate results for 16-bit values.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsImageBackingStoreh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/graphics/ImageBackingStore.h (0 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ImageBackingStore.h                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/ImageBackingStore.h        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -0,0 +1,189 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include &quot;Color.h&quot;
+#include &quot;IntRect.h&quot;
+#include &quot;IntSize.h&quot;
+#include &quot;NativeImage.h&quot;
+
+#include &lt;wtf/Vector.h&gt;
+
+namespace WebCore {
+
+class ImageBackingStore {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    static std::unique_ptr&lt;ImageBackingStore&gt; create(const IntSize&amp; size, bool premultiplyAlpha = true)
+    {
+        return std::unique_ptr&lt;ImageBackingStore&gt;(new ImageBackingStore(size, premultiplyAlpha));
+    }
+
+    static std::unique_ptr&lt;ImageBackingStore&gt; create(const ImageBackingStore&amp; other)
+    {
+        return std::unique_ptr&lt;ImageBackingStore&gt;(new ImageBackingStore(other));
+    }
+
+    NativeImagePtr image() const;
+
+    bool setSize(const IntSize&amp; size)
+    {
+        if (size.isEmpty() || !m_pixels.tryReserveCapacity(size.area()))
+            return false;
+
+        m_pixels.resize(size.area());
+        m_pixelsPtr = m_pixels.data();
+        m_size = size;
+        m_frameRect = IntRect(IntPoint(), m_size);
+        clear();
+        return true;
+    }
+
+    void setFrameRect(const IntRect&amp; frameRect)
+    {
+        ASSERT(!m_size.isEmpty());
+        ASSERT(inBounds(frameRect));
+        m_frameRect = frameRect;
+    }
+
+    const IntSize&amp; size() const { return m_size; }
+    const IntRect&amp; frameRect() const { return m_frameRect; }
+
+    void clear()
+    {
+        memset(m_pixelsPtr, 0, m_size.area() * sizeof(RGBA32));
+    }
+
+    void clearRect(const IntRect&amp; rect)
+    {
+        if (rect.isEmpty() || !inBounds(rect))
+            return;
+
+        size_t rowBytes = rect.width() * sizeof(RGBA32);
+        RGBA32* start = pixelAt(rect.x(), rect.y());
+        for (int i = 0; i &lt; rect.height(); ++i) {
+            memset(start, 0, rowBytes);
+            start += m_size.width();
+        }
+    }
+
+    void repeatFirstRow(const IntRect&amp; rect)
+    {
+        if (rect.isEmpty() || !inBounds(rect))
+            return;
+
+        size_t rowBytes = rect.width() * sizeof(RGBA32);
+        RGBA32* src = pixelAt(rect.x(), rect.y());
+        RGBA32* dest = src + m_size.width();
+        for (int i = 1; i &lt; rect.height(); ++i) {
+            memcpy(dest, src, rowBytes);
+            dest += m_size.width();
+        }
+    }
+
+    RGBA32* pixelAt(int x, int y) const
+    {
+        return m_pixelsPtr + y * m_size.width() + x;
+    }
+
+    void setPixel(int x, int y, unsigned r, unsigned g, unsigned b, unsigned a)
+    {
+        setPixel(pixelAt(x, y), r, g, b, a);
+    }
+
+    void setPixel(RGBA32* dest, unsigned r, unsigned g, unsigned b, unsigned a)
+    {
+        if (m_premultiplyAlpha &amp;&amp; !a)
+            *dest = 0;
+        else if (m_premultiplyAlpha &amp;&amp; a &lt; 255)
+            *dest = makePremultipliedRGBA(r, g, b, a);
+        else
+            *dest = makeRGBA(r, g, b, a);
+    }
+
+    void blendPixel(RGBA32* dest, unsigned r, unsigned g, unsigned b, unsigned a)
+    {
+        if (!a)
+            return;
+
+        if (a &gt;= 255 || !alphaChannel(*dest)) {
+            setPixel(dest, r, g, b, a);
+            return;
+        }
+
+        if (!m_premultiplyAlpha)
+            *dest = makePremultipliedRGBA(redChannel(*dest), greenChannel(*dest), blueChannel(*dest), alphaChannel(*dest));
+
+        unsigned d = 255 - a;
+
+        r = fastDivideBy255(r * a + redChannel(*dest) * d);
+        g = fastDivideBy255(g * a + greenChannel(*dest) * d);
+        b = fastDivideBy255(b * a + blueChannel(*dest) * d);
+        a += fastDivideBy255(d * alphaChannel(*dest));
+
+        if (m_premultiplyAlpha)
+            *dest = makeRGBA(r, g, b, a);
+        else
+            *dest = makeUnPremultipliedRGBA(r, g, b, a);
+    }
+
+    bool inBounds(const IntRect&amp; rect) const
+    {
+        return IntRect(IntPoint(), m_size).contains(rect);
+    }
+
+    static bool isOverSize(const IntSize&amp; size)
+    {
+        static unsigned long long MaxPixels = ((1 &lt;&lt; 29) - 1);
+        unsigned long long pixels = static_cast&lt;unsigned long long&gt;(size.width()) * static_cast&lt;unsigned long long&gt;(size.height());
+        return pixels &gt; MaxPixels;
+    }
+
+private:
+    ImageBackingStore(const IntSize&amp; size, bool premultiplyAlpha = true)
+        : m_premultiplyAlpha(premultiplyAlpha)
+    {
+        ASSERT(!size.isEmpty() &amp;&amp; !isOverSize(size));
+        setSize(size);
+    }
+
+    ImageBackingStore(const ImageBackingStore&amp; other)
+        : m_pixels(other.m_pixels)
+        , m_size(other.m_size)
+        , m_premultiplyAlpha(other.m_premultiplyAlpha)
+    {
+        ASSERT(!m_size.isEmpty() &amp;&amp; !isOverSize(m_size));
+        m_pixelsPtr = m_pixels.data();
+    }
+
+    Vector&lt;RGBA32&gt; m_pixels;
+    RGBA32* m_pixelsPtr { nullptr };
+    IntSize m_size;
+    IntRect m_frameRect; // This will always just be the entire buffer except for GIF and PNG frames
+    bool m_premultiplyAlpha { true };
+};
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgNativeImageCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/NativeImageCG.cpp (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/NativeImageCG.cpp        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/graphics/cg/NativeImageCG.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -47,10 +47,10 @@
</span><span class="cx">     return image ? IntSize(CGImageGetWidth(image.get()), CGImageGetHeight(image.get())) : IntSize();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool nativeImageHasAlpha(const NativeImagePtr&amp;)
</del><ins>+bool nativeImageHasAlpha(const NativeImagePtr&amp; image)
</ins><span class="cx"> {
</span><del>-    // FIXME: Answer correctly the question: does the CGImageRef have alpha channnel?
-    return true;
</del><ins>+    CGImageAlphaInfo info = CGImageGetAlphaInfo(image.get());
+    return (info &gt;= kCGImageAlphaPremultipliedLast) &amp;&amp; (info &lt;= kCGImageAlphaFirst);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Color nativeImageSinglePixelSolidColor(const NativeImagePtr&amp; image)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersImageDecodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/ImageDecoder.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -142,7 +142,7 @@
</span><span class="cx">         return *this;
</span><span class="cx"> 
</span><span class="cx">     copyBitmapData(other);
</span><del>-    setOriginalFrameRect(other.originalFrameRect());
</del><ins>+    setHasAlpha(other.m_hasAlpha);
</ins><span class="cx">     setStatus(other.status());
</span><span class="cx">     setDuration(other.duration());
</span><span class="cx">     setDisposalMethod(other.disposalMethod());
</span><span class="lines">@@ -152,8 +152,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ImageFrame::clearPixelData()
</span><span class="cx"> {
</span><del>-    m_backingStore.clear();
-    m_bytes = 0;
</del><ins>+    m_backingStore = nullptr;
</ins><span class="cx">     m_status = FrameEmpty;
</span><span class="cx">     // NOTE: Do not reset other members here; clearFrameBufferCache() calls this
</span><span class="cx">     // to free the bitmap data, but other functions like initFrameBuffer() and
</span><span class="lines">@@ -163,24 +162,16 @@
</span><span class="cx"> 
</span><span class="cx"> void ImageFrame::zeroFillPixelData()
</span><span class="cx"> {
</span><del>-    memset(m_bytes, 0, m_size.width() * m_size.height() * sizeof(PixelData));
</del><ins>+    m_backingStore-&gt;clear();
</ins><span class="cx">     m_hasAlpha = true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ImageFrame::zeroFillFrameRect(const IntRect&amp; rect)
</span><span class="cx"> {
</span><del>-    ASSERT(IntRect(IntPoint(), m_size).contains(rect));
-
</del><span class="cx">     if (rect.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    size_t rectWidthInBytes = rect.width() * sizeof(PixelData);
-    PixelData* start = m_bytes + (rect.y() * width()) + rect.x();
-    for (int i = 0; i &lt; rect.height(); ++i) {
-        memset(start, 0, rectWidthInBytes);
-        start += width();
-    }
-
</del><ins>+    m_backingStore-&gt;clearRect(rect);
</ins><span class="cx">     setHasAlpha(true);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -189,25 +180,19 @@
</span><span class="cx">     if (this == &amp;other)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    m_backingStore = other.m_backingStore;
-    m_bytes = m_backingStore.data();
-    m_size = other.m_size;
-    setHasAlpha(other.m_hasAlpha);
</del><ins>+    if (other.m_backingStore)
+        m_backingStore = ImageBackingStore::create(*other.m_backingStore.get());
+    else
+        m_backingStore = nullptr;
+    
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ImageFrame::setSize(int newWidth, int newHeight)
</del><ins>+bool ImageFrame::setSize(const IntSize&amp; size)
</ins><span class="cx"> {
</span><del>-    ASSERT(!width() &amp;&amp; !height());
-    size_t backingStoreSize = newWidth * newHeight;
-    if (!m_backingStore.tryReserveCapacity(backingStoreSize))
-        return false;
-    m_backingStore.resize(backingStoreSize);
-    m_bytes = m_backingStore.data();
-    m_size = IntSize(newWidth, newHeight);
-
-    zeroFillPixelData();
-    return true;
</del><ins>+    ASSERT(!m_backingStore);
+    m_backingStore = ImageBackingStore::create(size, m_premultiplyAlpha);
+    return m_backingStore != nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool ImageFrame::hasAlpha() const
</span><span class="lines">@@ -220,6 +205,12 @@
</span><span class="cx">     m_hasAlpha = alpha;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ImageFrame::setOriginalFrameRect(const IntRect&amp; frameRect)
+{
+    if (m_backingStore)
+        m_backingStore-&gt;setFrameRect(frameRect);
+}
+
</ins><span class="cx"> void ImageFrame::setStatus(FrameStatus status)
</span><span class="cx"> {
</span><span class="cx">     m_status = status;
</span><span class="lines">@@ -286,7 +277,7 @@
</span><span class="cx">     if (m_frameBufferCache.size() &lt;= index)
</span><span class="cx">         return 0;
</span><span class="cx">     // FIXME: Use the dimension of the requested frame.
</span><del>-    return m_size.area() * sizeof(ImageFrame::PixelData);
</del><ins>+    return m_size.area() * sizeof(RGBA32);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> float ImageDecoder::frameDurationAtIndex(size_t index)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersImageDecoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -28,8 +28,10 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include &quot;ImageBackingStore.h&quot;
+#include &quot;ImageSource.h&quot;
</ins><span class="cx"> #include &quot;IntRect.h&quot;
</span><del>-#include &quot;ImageSource.h&quot;
</del><ins>+#include &quot;IntSize.h&quot;
</ins><span class="cx"> #include &quot;PlatformScreen.h&quot;
</span><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="cx"> #include &lt;wtf/Assertions.h&gt;
</span><span class="lines">@@ -57,7 +59,6 @@
</span><span class="cx">             DisposeOverwritePrevious  // Clear frame to previous framebuffer
</span><span class="cx">                                       // contents
</span><span class="cx">         };
</span><del>-        typedef unsigned PixelData;
</del><span class="cx"> 
</span><span class="cx">         ImageFrame();
</span><span class="cx"> 
</span><span class="lines">@@ -82,28 +83,25 @@
</span><span class="cx">         // endY.
</span><span class="cx">         void copyRowNTimes(int startX, int endX, int startY, int endY)
</span><span class="cx">         {
</span><del>-            ASSERT(startX &lt; width());
-            ASSERT(endX &lt;= width());
-            ASSERT(startY &lt; height());
-            ASSERT(endY &lt;= height());
-            const int rowBytes = (endX - startX) * sizeof(PixelData);
-            const PixelData* const startAddr = getAddr(startX, startY);
-            for (int destY = startY + 1; destY &lt; endY; ++destY)
-                memcpy(getAddr(startX, destY), startAddr, rowBytes);
</del><ins>+            m_backingStore-&gt;repeatFirstRow(IntRect(startX, startY, endX -startX , endY - startY));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Allocates space for the pixel data.  Must be called before any pixels
</span><span class="cx">         // are written.  Must only be called once.  Returns whether allocation
</span><span class="cx">         // succeeded.
</span><del>-        bool setSize(int newWidth, int newHeight);
</del><ins>+        bool setSize(const IntSize&amp;);
+        IntSize size() const { return m_backingStore ? m_backingStore-&gt;size() : IntSize(); }
</ins><span class="cx"> 
</span><span class="cx">         // Returns a caller-owned pointer to the underlying native image data.
</span><span class="cx">         // (Actual use: This pointer will be owned by BitmapImage and freed in
</span><span class="cx">         // FrameData::clear()).
</span><del>-        NativeImagePtr asNewNativeImage() const;
</del><ins>+        NativeImagePtr asNewNativeImage() const { return m_backingStore ? m_backingStore-&gt;image() : nullptr; }
</ins><span class="cx"> 
</span><ins>+        inline ImageBackingStore* backingStore() const { return m_backingStore ? m_backingStore.get() : nullptr; }
+        inline bool hasBackingStore() const { return backingStore(); }
+        
</ins><span class="cx">         bool hasAlpha() const;
</span><del>-        const IntRect&amp; originalFrameRect() const { return m_originalFrameRect; }
</del><ins>+        IntRect originalFrameRect() const { return m_backingStore ? m_backingStore-&gt;frameRect() : IntRect(); }
</ins><span class="cx">         FrameStatus status() const { return m_status; }
</span><span class="cx">         unsigned duration() const { return m_duration; }
</span><span class="cx">         FrameDisposalMethod disposalMethod() const { return m_disposalMethod; }
</span><span class="lines">@@ -110,114 +108,41 @@
</span><span class="cx">         bool premultiplyAlpha() const { return m_premultiplyAlpha; }
</span><span class="cx"> 
</span><span class="cx">         void setHasAlpha(bool alpha);
</span><del>-        void setOriginalFrameRect(const IntRect&amp; r) { m_originalFrameRect = r; }
</del><ins>+        void setOriginalFrameRect(const IntRect&amp;);
</ins><span class="cx">         void setStatus(FrameStatus status);
</span><span class="cx">         void setDuration(unsigned duration) { m_duration = duration; }
</span><span class="cx">         void setDisposalMethod(FrameDisposalMethod method) { m_disposalMethod = method; }
</span><span class="cx">         void setPremultiplyAlpha(bool premultiplyAlpha) { m_premultiplyAlpha = premultiplyAlpha; }
</span><span class="cx"> 
</span><del>-        inline void setRGBA(int x, int y, unsigned r, unsigned g, unsigned b, unsigned a)
</del><ins>+        inline RGBA32* pixelAt(int x, int y)
</ins><span class="cx">         {
</span><del>-            setRGBA(getAddr(x, y), r, g, b, a);
</del><ins>+            ASSERT(m_backingStore);
+            return m_backingStore-&gt;pixelAt(x, y);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        inline PixelData* getAddr(int x, int y)
</del><ins>+        inline void setPixel(int x, int y, unsigned r, unsigned g, unsigned b, unsigned a)
</ins><span class="cx">         {
</span><del>-            return m_bytes + (y * width()) + x;
</del><ins>+            ASSERT(m_backingStore);
+            m_backingStore-&gt;setPixel(x, y, r, g, b, a);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        inline bool hasPixelData() const
</del><ins>+        inline void setPixel(RGBA32* dest, unsigned r, unsigned g, unsigned b, unsigned a)
</ins><span class="cx">         {
</span><del>-            return m_bytes;
</del><ins>+            ASSERT(m_backingStore);
+            m_backingStore-&gt;setPixel(dest, r, g, b, a);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        // Use fix point multiplier instead of integer division or floating point math.
-        // This multipler produces exactly the same result for all values in range 0 - 255.
-        static const unsigned fixPointShift = 24;
-        static const unsigned fixPointMult = static_cast&lt;unsigned&gt;(1.0 / 255.0 * (1 &lt;&lt; fixPointShift)) + 1;
-        // Multiplies unsigned value by fixpoint value and converts back to unsigned.
-        static unsigned fixPointUnsignedMultiply(unsigned fixed, unsigned v)
-        {
-            return  (fixed * v) &gt;&gt; fixPointShift;
-        }
-
-        inline void setRGBA(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a)
-        {
-            if (m_premultiplyAlpha &amp;&amp; a &lt; 255) {
-                if (!a) {
-                    *dest = 0;
-                    return;
-                }
-
-                unsigned alphaMult = a * fixPointMult;
-                r = fixPointUnsignedMultiply(r, alphaMult);
-                g = fixPointUnsignedMultiply(g, alphaMult);
-                b = fixPointUnsignedMultiply(b, alphaMult);
-            }
-            *dest = (a &lt;&lt; 24 | r &lt;&lt; 16 | g &lt;&lt; 8 | b);
-        }
-
</del><span class="cx"> #if ENABLE(APNG)
</span><del>-        static inline unsigned divide255(unsigned a)
</del><ins>+        inline void blendPixel(RGBA32* dest, unsigned r, unsigned g, unsigned b, unsigned a)
</ins><span class="cx">         {
</span><del>-            return (a + (a &gt;&gt; 8) + 1) &gt;&gt; 8;
</del><ins>+            ASSERT(m_backingStore);
+            m_backingStore-&gt;blendPixel(dest, r, g, b, a);
</ins><span class="cx">         }
</span><del>-
-        inline void overRGBA(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a)
-        {
-            if (!a)
-                return;
-
-            if (a &lt; 255) {
-                unsigned aDest = ((*dest) &gt;&gt; 24) &amp; 255;
-                if (aDest) {
-                    unsigned rDest = ((*dest) &gt;&gt; 16) &amp; 255;
-                    unsigned gDest = ((*dest) &gt;&gt; 8) &amp; 255;
-                    unsigned bDest = (*dest) &amp; 255;
-                    unsigned aAux = 255 - a;
-                    if (!m_premultiplyAlpha) {
-                        rDest = divide255(rDest * aDest);
-                        gDest = divide255(gDest * aDest);
-                        bDest = divide255(bDest * aDest);
-                    }
-                    r = divide255(r * a + rDest * aAux);
-                    g = divide255(g * a + gDest * aAux);
-                    b = divide255(b * a + bDest * aAux);
-                    a += divide255(aDest * aAux);
-                    if (!m_premultiplyAlpha) {
-                        r = (r * 255 + a - 1) / a;
-                        g = (g * 255 + a - 1) / a;
-                        b = (b * 255 + a - 1) / a;
-                    }
-                } else if (m_premultiplyAlpha) {
-                    r = divide255(r * a);
-                    g = divide255(g * a);
-                    b = divide255(b * a);
-                }
-            }
-            *dest = (a &lt;&lt; 24 | r &lt;&lt; 16 | g &lt;&lt; 8 | b);
-        }
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-        int width() const
-        {
-            return m_size.width();
-        }
-
-        int height() const
-        {
-            return m_size.height();
-        }
-
-        Vector&lt;PixelData&gt; m_backingStore;
-        PixelData* m_bytes; // The memory is backed by m_backingStore.
-        IntSize m_size;
</del><ins>+        std::unique_ptr&lt;ImageBackingStore&gt; m_backingStore;
</ins><span class="cx">         bool m_hasAlpha;
</span><del>-        IntRect m_originalFrameRect; // This will always just be the entire
-                                     // buffer except for GIF frames whose
-                                     // original rect was smaller than the
-                                     // overall image size.
</del><span class="cx">         FrameStatus m_status;
</span><span class="cx">         unsigned m_duration;
</span><span class="cx">         FrameDisposalMethod m_disposalMethod;
</span><span class="lines">@@ -287,11 +212,11 @@
</span><span class="cx"> 
</span><span class="cx">         // Returns whether the size is legal (i.e. not going to result in
</span><span class="cx">         // overflow elsewhere).  If not, marks decoding as failed.
</span><del>-        virtual bool setSize(unsigned width, unsigned height)
</del><ins>+        virtual bool setSize(const IntSize&amp; size)
</ins><span class="cx">         {
</span><del>-            if (isOverSize(width, height))
</del><ins>+            if (ImageBackingStore::isOverSize(size))
</ins><span class="cx">                 return setFailed();
</span><del>-            m_size = IntSize(width, height);
</del><ins>+            m_size = size;
</ins><span class="cx">             m_sizeAvailable = true;
</span><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="lines">@@ -386,15 +311,6 @@
</span><span class="cx">         ImageOrientation m_orientation;
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-        // Some code paths compute the size of the image as &quot;width * height * 4&quot;
-        // and return it as a (signed) int.  Avoid overflow.
-        static bool isOverSize(unsigned width, unsigned height)
-        {
-            unsigned long long total_size = static_cast&lt;unsigned long long&gt;(width)
-                                          * static_cast&lt;unsigned long long&gt;(height);
-            return total_size &gt; ((1 &lt;&lt; 29) - 1);
-        }
-
</del><span class="cx">         IntSize m_size;
</span><span class="cx">         bool m_sizeAvailable { false };
</span><span class="cx"> #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersbmpBMPImageReadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx">     // Initialize the framebuffer if needed.
</span><span class="cx">     ASSERT(m_buffer);  // Parent should set this before asking us to decode!
</span><span class="cx">     if (m_buffer-&gt;status() == ImageFrame::FrameEmpty) {
</span><del>-        if (!m_buffer-&gt;setSize(m_parent-&gt;size().width(), m_parent-&gt;size().height()))
</del><ins>+        if (!m_buffer-&gt;setSize(m_parent-&gt;size()))
</ins><span class="cx">             return m_parent-&gt;setFailed(); // Unable to allocate.
</span><span class="cx">         m_buffer-&gt;setStatus(ImageFrame::FramePartial);
</span><span class="cx">         // setSize() calls eraseARGB(), which resets the alpha flag, so we force
</span><span class="lines">@@ -86,9 +86,6 @@
</span><span class="cx">         // these 0s could actually show through.
</span><span class="cx">         m_buffer-&gt;setHasAlpha(false);
</span><span class="cx"> 
</span><del>-        // For BMPs, the frame always fills the entire image.
-        m_buffer-&gt;setOriginalFrameRect(IntRect(IntPoint(), m_parent-&gt;size()));
-
</del><span class="cx">         if (!m_isTopDown)
</span><span class="cx">             m_coord.setY(m_parent-&gt;size().height() - 1);
</span><span class="cx">     }
</span><span class="lines">@@ -171,7 +168,7 @@
</span><span class="cx">         return m_parent-&gt;setFailed();
</span><span class="cx"> 
</span><span class="cx">     // Set our size.
</span><del>-    if (!m_parent-&gt;setSize(m_infoHeader.biWidth, m_infoHeader.biHeight))
</del><ins>+    if (!m_parent-&gt;setSize(IntSize(m_infoHeader.biWidth, m_infoHeader.biHeight)))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     // For paletted images, bitmaps can set biClrUsed to 0 to mean &quot;all
</span><span class="lines">@@ -674,7 +671,7 @@
</span><span class="cx">                         // transparent, on the assumption that most ICOs on the
</span><span class="cx">                         // web will not be doing a lot of inverting.
</span><span class="cx">                         if (colorIndex) {
</span><del>-                            setRGBA(0, 0, 0, 0);
</del><ins>+                            setPixel(0, 0, 0, 0);
</ins><span class="cx">                             m_buffer-&gt;setHasAlpha(true);
</span><span class="cx">                         } else
</span><span class="cx">                             m_coord.move(1, 0);
</span><span class="lines">@@ -713,7 +710,7 @@
</span><span class="cx">                         m_buffer-&gt;setHasAlpha(true);
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                setRGBA(getComponent(pixel, 0), getComponent(pixel, 1),
</del><ins>+                setPixel(getComponent(pixel, 0), getComponent(pixel, 1),
</ins><span class="cx">                         getComponent(pixel, 2), alpha);
</span><span class="cx">             }
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersbmpBMPImageReaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.h (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.h        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.h        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -239,16 +239,16 @@
</span><span class="cx">         // right by one.
</span><span class="cx">         inline void setI(size_t colorIndex)
</span><span class="cx">         {
</span><del>-            setRGBA(m_colorTable[colorIndex].rgbRed, m_colorTable[colorIndex].rgbGreen, m_colorTable[colorIndex].rgbBlue, 0xff);
</del><ins>+            setPixel(m_colorTable[colorIndex].rgbRed, m_colorTable[colorIndex].rgbGreen, m_colorTable[colorIndex].rgbBlue, 0xff);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Like setI(), but with the individual component values specified.
</span><del>-        inline void setRGBA(unsigned red,
</del><ins>+        inline void setPixel(unsigned red,
</ins><span class="cx">                             unsigned green,
</span><span class="cx">                             unsigned blue,
</span><span class="cx">                             unsigned alpha)
</span><span class="cx">         {
</span><del>-            m_buffer-&gt;setRGBA(m_coord.x(), m_coord.y(), red, green, blue, alpha);
</del><ins>+            m_buffer-&gt;setPixel(m_coord.x(), m_coord.y(), red, green, blue, alpha);
</ins><span class="cx">             m_coord.move(1, 0);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -263,7 +263,7 @@
</span><span class="cx">                              unsigned alpha)
</span><span class="cx">         {
</span><span class="cx">             while (m_coord.x() &lt; endCoord)
</span><del>-                setRGBA(red, green, blue, alpha);
</del><ins>+                setPixel(red, green, blue, alpha);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Resets the relevant local variables to start drawing at the left edge
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecoderscairoImageBackingStoreCairocppfromrev205839trunkSourceWebCoreplatformimagedecoderscairoImageDecoderCairocpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp (from rev 205839, trunk/Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp) (0 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/image-decoders/cairo/ImageBackingStoreCairo.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ImageBackingStore.h&quot;
+
+#include &lt;cairo.h&gt;
+
+namespace WebCore {
+
+NativeImagePtr ImageBackingStore::image() const
+{
+    return adoptRef(cairo_image_surface_create_for_data(
+        reinterpret_cast&lt;unsigned char*&gt;(const_cast&lt;RGBA32*&gt;(m_pixelsPtr)),
+        CAIRO_FORMAT_ARGB32, size().width(), size().height(), size().width() * sizeof(RGBA32)));
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecoderscairoImageDecoderCairocpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -1,40 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include &quot;config.h&quot;
-#include &quot;ImageDecoder.h&quot;
-
-#include &lt;cairo.h&gt;
-
-namespace WebCore {
-
-NativeImagePtr ImageFrame::asNewNativeImage() const
-{
-    return adoptRef(cairo_image_surface_create_for_data(
-        reinterpret_cast&lt;unsigned char*&gt;(const_cast&lt;PixelData*&gt;(m_bytes)),
-        CAIRO_FORMAT_ARGB32, width(), height(), width() * sizeof(PixelData)));
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersgifGIFImageDecodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -60,12 +60,12 @@
</span><span class="cx">     return ImageDecoder::isSizeAvailable();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool GIFImageDecoder::setSize(unsigned width, unsigned height)
</del><ins>+bool GIFImageDecoder::setSize(const IntSize&amp; size)
</ins><span class="cx"> {
</span><del>-    if (ImageDecoder::isSizeAvailable() &amp;&amp; size() == IntSize(width, height))
</del><ins>+    if (ImageDecoder::isSizeAvailable() &amp;&amp; this-&gt;size() == size)
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    if (!ImageDecoder::setSize(width, height))
</del><ins>+    if (!ImageDecoder::setSize(size))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     prepareScaleDataIfNecessary();
</span><span class="lines">@@ -213,16 +213,16 @@
</span><span class="cx"> 
</span><span class="cx">     // Initialize the frame if necessary.
</span><span class="cx">     ImageFrame&amp; buffer = m_frameBufferCache[frameIndex];
</span><del>-    if (((buffer.status() == ImageFrame::FrameEmpty) &amp;&amp; !initFrameBuffer(frameIndex)) || !buffer.hasPixelData())
</del><ins>+    if (((buffer.status() == ImageFrame::FrameEmpty) &amp;&amp; !initFrameBuffer(frameIndex)) || !buffer.hasBackingStore())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    ImageFrame::PixelData* currentAddress = buffer.getAddr(xBegin, yBegin);
</del><ins>+    RGBA32* currentAddress = buffer.pixelAt(xBegin, yBegin);
</ins><span class="cx">     // Write one row's worth of data into the frame.  
</span><span class="cx">     for (int x = xBegin; x &lt; xEnd; ++x) {
</span><span class="cx">         const unsigned char sourceValue = rowBuffer[(m_scaled ? m_scaledColumns[x] : x) - frameContext-&gt;xOffset];
</span><span class="cx">         if ((!frameContext-&gt;isTransparent || (sourceValue != frameContext-&gt;tpixel)) &amp;&amp; (sourceValue &lt; colorMapSize)) {
</span><span class="cx">             const size_t colorIndex = static_cast&lt;size_t&gt;(sourceValue) * 3;
</span><del>-            buffer.setRGBA(currentAddress, colorMap[colorIndex], colorMap[colorIndex + 1], colorMap[colorIndex + 2], 255);
</del><ins>+            buffer.setPixel(currentAddress, colorMap[colorIndex], colorMap[colorIndex + 1], colorMap[colorIndex + 2], 255);
</ins><span class="cx">         } else {
</span><span class="cx">             m_currentBufferSawAlpha = true;
</span><span class="cx">             // We may or may not need to write transparent pixels to the buffer.
</span><span class="lines">@@ -233,7 +233,7 @@
</span><span class="cx">             // beyond the first, or the initial passes will &quot;show through&quot; the
</span><span class="cx">             // later ones.
</span><span class="cx">             if (writeTransparentPixels)
</span><del>-                buffer.setRGBA(currentAddress, 0, 0, 0, 0);
</del><ins>+                buffer.setPixel(currentAddress, 0, 0, 0, 0);
</ins><span class="cx">         }
</span><span class="cx">         ++currentAddress;
</span><span class="cx">     }
</span><span class="lines">@@ -361,7 +361,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!frameIndex) {
</span><span class="cx">         // This is the first frame, so we're not relying on any previous data.
</span><del>-        if (!buffer-&gt;setSize(scaledSize().width(), scaledSize().height()))
</del><ins>+        if (!buffer-&gt;setSize(scaledSize()))
</ins><span class="cx">             return setFailed();
</span><span class="cx">     } else {
</span><span class="cx">         // The starting state for this frame depends on the previous frame's
</span><span class="lines">@@ -387,12 +387,12 @@
</span><span class="cx">         } else {
</span><span class="cx">             // We want to clear the previous frame to transparent, without
</span><span class="cx">             // affecting pixels in the image outside of the frame.
</span><del>-            const IntRect&amp; prevRect = prevBuffer-&gt;originalFrameRect();
</del><ins>+            IntRect prevRect = prevBuffer-&gt;originalFrameRect();
</ins><span class="cx">             const IntSize&amp; bufferSize = scaledSize();
</span><span class="cx">             if (!frameIndex || prevRect.contains(IntRect(IntPoint(), scaledSize()))) {
</span><span class="cx">                 // Clearing the first frame, or a frame the size of the whole
</span><span class="cx">                 // image, results in a completely empty image.
</span><del>-                if (!buffer-&gt;setSize(bufferSize.width(), bufferSize.height()))
</del><ins>+                if (!buffer-&gt;setSize(bufferSize))
</ins><span class="cx">                     return setFailed();
</span><span class="cx">             } else {
</span><span class="cx">                 // Copy the whole previous buffer, then clear just its frame.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersgifGIFImageDecoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.h (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.h        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.h        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">         String filenameExtension() const override { return &quot;gif&quot;; }
</span><span class="cx">         void setData(SharedBuffer&amp; data, bool allDataReceived) override;
</span><span class="cx">         bool isSizeAvailable() override;
</span><del>-        bool setSize(unsigned width, unsigned height) override;
</del><ins>+        bool setSize(const IntSize&amp;) override;
</ins><span class="cx">         size_t frameCount() override;
</span><span class="cx">         int repetitionCount() const override;
</span><span class="cx">         ImageFrame* frameBufferAtIndex(size_t index) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersgifGIFImageReadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/gif/GIFImageReader.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -447,7 +447,7 @@
</span><span class="cx"> 
</span><span class="cx">             // CALLBACK: Inform the decoderplugin of our size.
</span><span class="cx">             // Note: A subsequent frame might have dimensions larger than the &quot;screen&quot; dimensions.
</span><del>-            if (m_client &amp;&amp; !m_client-&gt;setSize(m_screenWidth, m_screenHeight))
</del><ins>+            if (m_client &amp;&amp; !m_client-&gt;setSize(WebCore::IntSize(m_screenWidth, m_screenHeight)))
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">             m_screenBgcolor = currentComponent[5];
</span><span class="lines">@@ -664,7 +664,7 @@
</span><span class="cx">                 yOffset = 0;
</span><span class="cx"> 
</span><span class="cx">                 // CALLBACK: Inform the decoderplugin of our size.
</span><del>-                if (m_client &amp;&amp; !m_client-&gt;setSize(m_screenWidth, m_screenHeight))
</del><ins>+                if (m_client &amp;&amp; !m_client-&gt;setSize(WebCore::IntSize(m_screenWidth, m_screenHeight)))
</ins><span class="cx">                     return false;
</span><span class="cx">             }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersicoICOImageDecodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -88,11 +88,11 @@
</span><span class="cx">     return (index &amp;&amp; (index &lt; m_dirEntries.size())) ? m_dirEntries[index].m_size : size();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ICOImageDecoder::setSize(unsigned width, unsigned height)
</del><ins>+bool ICOImageDecoder::setSize(const IntSize&amp; size)
</ins><span class="cx"> {
</span><span class="cx">     // The size calculated inside the BMPImageReader had better match the one in
</span><span class="cx">     // the icon directory.
</span><del>-    return m_frameSize.isEmpty() ? ImageDecoder::setSize(width, height) : ((IntSize(width, height) == m_frameSize) || setFailed());
</del><ins>+    return m_frameSize.isEmpty() ? ImageDecoder::setSize(size) : ((size == m_frameSize) || setFailed());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> size_t ICOImageDecoder::frameCount()
</span><span class="lines">@@ -279,7 +279,7 @@
</span><span class="cx">     const IconDirectoryEntry&amp; dirEntry = m_dirEntries.first();
</span><span class="cx">     // Technically, this next call shouldn't be able to fail, since the width
</span><span class="cx">     // and height here are each &lt;= 256, and |m_frameSize| is empty.
</span><del>-    return setSize(dirEntry.m_size.width(), dirEntry.m_size.height());
</del><ins>+    return setSize(dirEntry.m_size);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ICOImageDecoder::IconDirectoryEntry ICOImageDecoder::readDirectoryEntry()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersicoICOImageDecoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.h (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.h        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/ico/ICOImageDecoder.h        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">         bool isSizeAvailable() override;
</span><span class="cx">         IntSize size() override;
</span><span class="cx">         IntSize frameSizeAtIndex(size_t, SubsamplingLevel) override;
</span><del>-        bool setSize(unsigned width, unsigned height) override;
</del><ins>+        bool setSize(const IntSize&amp;) override;
</ins><span class="cx">         size_t frameCount() override;
</span><span class="cx">         ImageFrame* frameBufferAtIndex(size_t) override;
</span><span class="cx">         // CAUTION: setFailed() deletes all readers and decoders.  Be careful to
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersjpegJPEGImageDecodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -322,7 +322,7 @@
</span><span class="cx">             m_state = JPEG_START_DECOMPRESS;
</span><span class="cx"> 
</span><span class="cx">             // We can fill in the size now that the header is available.
</span><del>-            if (!m_decoder-&gt;setSize(m_info.image_width, m_info.image_height))
</del><ins>+            if (!m_decoder-&gt;setSize(IntSize(m_info.image_width, m_info.image_height)))
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">             m_decoder-&gt;setOrientation(readImageOrientation(info()));
</span><span class="lines">@@ -519,9 +519,9 @@
</span><span class="cx">     return ImageDecoder::isSizeAvailable();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool JPEGImageDecoder::setSize(unsigned width, unsigned height)
</del><ins>+bool JPEGImageDecoder::setSize(const IntSize&amp; size)
</ins><span class="cx"> {
</span><del>-    if (!ImageDecoder::setSize(width, height))
</del><ins>+    if (!ImageDecoder::setSize(size))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     prepareScaleDataIfNecessary();
</span><span class="lines">@@ -551,13 +551,13 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template &lt;J_COLOR_SPACE colorSpace&gt;
</span><del>-void setPixel(ImageFrame&amp; buffer, ImageFrame::PixelData* currentAddress, JSAMPARRAY samples, int column)
</del><ins>+void setPixel(ImageFrame&amp; buffer, RGBA32* currentAddress, JSAMPARRAY samples, int column)
</ins><span class="cx"> {
</span><span class="cx">     JSAMPLE* jsample = *samples + column * (colorSpace == JCS_RGB ? 3 : 4);
</span><span class="cx"> 
</span><span class="cx">     switch (colorSpace) {
</span><span class="cx">     case JCS_RGB:
</span><del>-        buffer.setRGBA(currentAddress, jsample[0], jsample[1], jsample[2], 0xFF);
</del><ins>+        buffer.setPixel(currentAddress, jsample[0], jsample[1], jsample[2], 0xFF);
</ins><span class="cx">         break;
</span><span class="cx">     case JCS_CMYK:
</span><span class="cx">         // Source is 'Inverted CMYK', output is RGB.
</span><span class="lines">@@ -570,7 +570,7 @@
</span><span class="cx">         // From CMY (0..1) to RGB (0..1):
</span><span class="cx">         // R = 1 - C =&gt; 1 - (1 - iC*iK) =&gt; iC*iK  [G and B similar]
</span><span class="cx">         unsigned k = jsample[3];
</span><del>-        buffer.setRGBA(currentAddress, jsample[0] * k / 255, jsample[1] * k / 255, jsample[2] * k / 255, 0xFF);
</del><ins>+        buffer.setPixel(currentAddress, jsample[0] * k / 255, jsample[1] * k / 255, jsample[2] * k / 255, 0xFF);
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -594,7 +594,7 @@
</span><span class="cx">         if (destY &lt; 0)
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        ImageFrame::PixelData* currentAddress = buffer.getAddr(0, destY);
</del><ins>+        RGBA32* currentAddress = buffer.pixelAt(0, destY);
</ins><span class="cx">         for (int x = 0; x &lt; width; ++x) {
</span><span class="cx">             setPixel&lt;colorSpace&gt;(buffer, currentAddress, samples, isScaled ? m_scaledColumns[x] : x);
</span><span class="cx">             ++currentAddress;
</span><span class="lines">@@ -617,15 +617,12 @@
</span><span class="cx">     // Initialize the framebuffer if needed.
</span><span class="cx">     ImageFrame&amp; buffer = m_frameBufferCache[0];
</span><span class="cx">     if (buffer.status() == ImageFrame::FrameEmpty) {
</span><del>-        if (!buffer.setSize(scaledSize().width(), scaledSize().height()))
</del><ins>+        if (!buffer.setSize(scaledSize()))
</ins><span class="cx">             return setFailed();
</span><span class="cx">         buffer.setStatus(ImageFrame::FramePartial);
</span><span class="cx">         // The buffer is transparent outside the decoded area while the image is
</span><span class="cx">         // loading. The completed image will be marked fully opaque in jpegComplete().
</span><span class="cx">         buffer.setHasAlpha(true);
</span><del>-
-        // For JPEGs, the frame always fills the entire image.
-        buffer.setOriginalFrameRect(IntRect(IntPoint(), size()));
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     jpeg_decompress_struct* info = m_reader-&gt;info();
</span><span class="lines">@@ -633,7 +630,7 @@
</span><span class="cx"> #if defined(TURBO_JPEG_RGB_SWIZZLE)
</span><span class="cx">     if (!m_scaled &amp;&amp; turboSwizzled(info-&gt;out_color_space)) {
</span><span class="cx">         while (info-&gt;output_scanline &lt; info-&gt;output_height) {
</span><del>-            unsigned char* row = reinterpret_cast&lt;unsigned char*&gt;(buffer.getAddr(0, info-&gt;output_scanline));
</del><ins>+            unsigned char* row = reinterpret_cast&lt;unsigned char*&gt;(buffer.pixelAt(0, info-&gt;output_scanline));
</ins><span class="cx">             if (jpeg_read_scanlines(info, &amp;row, 1) != 1)
</span><span class="cx">                 return false;
</span><span class="cx">          }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersjpegJPEGImageDecoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">         // ImageDecoder
</span><span class="cx">         String filenameExtension() const override { return &quot;jpg&quot;; }
</span><span class="cx">         bool isSizeAvailable() override;
</span><del>-        bool setSize(unsigned width, unsigned height) override;
</del><ins>+        bool setSize(const IntSize&amp;) override;
</ins><span class="cx">         ImageFrame* frameBufferAtIndex(size_t index) override;
</span><span class="cx">         // CAUTION: setFailed() deletes |m_reader|.  Be careful to avoid
</span><span class="cx">         // accessing deleted memory, especially when calling this from inside
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecoderspngPNGImageDecodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -235,9 +235,9 @@
</span><span class="cx">     return ImageDecoder::isSizeAvailable();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool PNGImageDecoder::setSize(unsigned width, unsigned height)
</del><ins>+bool PNGImageDecoder::setSize(const IntSize&amp; size)
</ins><span class="cx"> {
</span><del>-    if (!ImageDecoder::setSize(width, height))
</del><ins>+    if (!ImageDecoder::setSize(size))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     prepareScaleDataIfNecessary();
</span><span class="lines">@@ -295,7 +295,7 @@
</span><span class="cx">     // will cease to exist.  Note that we'll still properly set the failure flag
</span><span class="cx">     // in this case as soon as we longjmp().
</span><span class="cx">     m_doNothingOnFailure = true;
</span><del>-    bool result = setSize(width, height);
</del><ins>+    bool result = setSize(IntSize(width, height));
</ins><span class="cx">     m_doNothingOnFailure = false;
</span><span class="cx">     if (!result) {
</span><span class="cx">         longjmp(JMPBUF(png), 1);
</span><span class="lines">@@ -411,12 +411,12 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline void setPixelRGB(ImageFrame::PixelData* dest, png_bytep pixel)
</del><ins>+static inline void setPixelRGB(RGBA32* dest, png_bytep pixel)
</ins><span class="cx"> {
</span><span class="cx">     *dest = 0xFF000000U | pixel[0] &lt;&lt; 16 | pixel[1] &lt;&lt; 8 | pixel[2];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline void setPixelRGBA(ImageFrame::PixelData* dest, png_bytep pixel, unsigned char&amp; nonTrivialAlphaMask)
</del><ins>+static inline void setPixelRGBA(RGBA32* dest, png_bytep pixel, unsigned char&amp; nonTrivialAlphaMask)
</ins><span class="cx"> {
</span><span class="cx">     unsigned char a = pixel[3];
</span><span class="cx">     *dest = a &lt;&lt; 24 | pixel[0] &lt;&lt; 16 | pixel[1] &lt;&lt; 8 | pixel[2];
</span><span class="lines">@@ -423,7 +423,7 @@
</span><span class="cx">     nonTrivialAlphaMask |= (255 - a);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline void setPixelPremultipliedRGBA(ImageFrame::PixelData* dest, png_bytep pixel, unsigned char&amp; nonTrivialAlphaMask)
</del><ins>+static inline void setPixelPremultipliedRGBA(RGBA32* dest, png_bytep pixel, unsigned char&amp; nonTrivialAlphaMask)
</ins><span class="cx"> {
</span><span class="cx">     unsigned char a = pixel[3];
</span><span class="cx">     unsigned char r = fastDivideBy255(pixel[0] * a);
</span><span class="lines">@@ -447,7 +447,7 @@
</span><span class="cx">     ImageFrame&amp; buffer = m_frameBufferCache[m_currentFrame];
</span><span class="cx">     if (buffer.status() == ImageFrame::FrameEmpty) {
</span><span class="cx">         png_structp png = m_reader-&gt;pngPtr();
</span><del>-        if (!buffer.setSize(scaledSize().width(), scaledSize().height())) {
</del><ins>+        if (!buffer.setSize(scaledSize())) {
</ins><span class="cx">             longjmp(JMPBUF(png), 1);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -469,10 +469,7 @@
</span><span class="cx"> #if ENABLE(APNG)
</span><span class="cx">         if (m_currentFrame)
</span><span class="cx">             initFrameBuffer(m_currentFrame);
</span><del>-        else
</del><span class="cx"> #endif
</span><del>-        // For PNGs, the frame always fills the entire image.
-        buffer.setOriginalFrameRect(IntRect(IntPoint(), size()));
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     /* libpng comments (here to explain what follows).
</span><span class="lines">@@ -531,7 +528,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Write the decoded row pixels to the frame buffer.
</span><del>-    ImageFrame::PixelData* address = buffer.getAddr(0, y);
</del><ins>+    RGBA32* address = buffer.pixelAt(0, y);
</ins><span class="cx">     int width = scaledSize().width();
</span><span class="cx">     unsigned char nonTrivialAlphaMask = 0;
</span><span class="cx"> 
</span><span class="lines">@@ -540,7 +537,7 @@
</span><span class="cx">         for (int x = 0; x &lt; width; ++x) {
</span><span class="cx">             png_bytep pixel = row + m_scaledColumns[x] * colorChannels;
</span><span class="cx">             unsigned alpha = hasAlpha ? pixel[3] : 255;
</span><del>-            buffer.setRGBA(address++, pixel[0], pixel[1], pixel[2], alpha);
</del><ins>+            buffer.setPixel(address++, pixel[0], pixel[1], pixel[2], alpha);
</ins><span class="cx">             nonTrivialAlphaMask |= (255 - alpha);
</span><span class="cx">         }
</span><span class="cx">     } else
</span><span class="lines">@@ -820,7 +817,7 @@
</span><span class="cx">     } else {
</span><span class="cx">         // We want to clear the previous frame to transparent, without
</span><span class="cx">         // affecting pixels in the image outside of the frame.
</span><del>-        const IntRect&amp; prevRect = prevBuffer-&gt;originalFrameRect();
</del><ins>+        IntRect prevRect = prevBuffer-&gt;originalFrameRect();
</ins><span class="cx">         if (!frameIndex || prevRect.contains(IntRect(IntPoint(), scaledSize()))) {
</span><span class="cx">             // Clearing the first frame, or a frame the size of the whole
</span><span class="cx">             // image, results in a completely empty image.
</span><span class="lines">@@ -844,7 +841,7 @@
</span><span class="cx">     png_bytep interlaceBuffer = m_reader-&gt;interlaceBuffer();
</span><span class="cx"> 
</span><span class="cx">     if (m_currentFrame &amp;&amp; interlaceBuffer) {
</span><del>-        const IntRect&amp; rect = buffer.originalFrameRect();
</del><ins>+        IntRect rect = buffer.originalFrameRect();
</ins><span class="cx">         bool hasAlpha = m_reader-&gt;hasAlpha();
</span><span class="cx">         unsigned colorChannels = hasAlpha ? 4 : 3;
</span><span class="cx">         bool nonTrivialAlpha = false;
</span><span class="lines">@@ -854,15 +851,15 @@
</span><span class="cx"> #if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
</span><span class="cx">         for (int y = 0; y &lt; rect.maxY() - rect.y(); ++y) {
</span><span class="cx">             png_bytep row = interlaceBuffer + (m_scaled ? m_scaledRows[y] : y) * colorChannels * size().width();
</span><del>-            ImageFrame::PixelData* address = buffer.getAddr(rect.x(), y + rect.y());
</del><ins>+            RGBA32* address = buffer.pixelAt(rect.x(), y + rect.y());
</ins><span class="cx">             for (int x = 0; x &lt; rect.maxX() - rect.x(); ++x) {
</span><span class="cx">                 png_bytep pixel = row + (m_scaled ? m_scaledColumns[x] : x) * colorChannels;
</span><span class="cx">                 unsigned alpha = hasAlpha ? pixel[3] : 255;
</span><span class="cx">                 nonTrivialAlpha |= alpha &lt; 255;
</span><span class="cx">                 if (!m_blend)
</span><del>-                    buffer.setRGBA(address++, pixel[0], pixel[1], pixel[2], alpha);
</del><ins>+                    buffer.setPixel(address++, pixel[0], pixel[1], pixel[2], alpha);
</ins><span class="cx">                 else
</span><del>-                    buffer.overRGBA(address++, pixel[0], pixel[1], pixel[2], alpha);
</del><ins>+                    buffer.blendPixel(address++, pixel[0], pixel[1], pixel[2], alpha);
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> #else
</span><span class="lines">@@ -870,14 +867,14 @@
</span><span class="cx">         png_bytep row = interlaceBuffer;
</span><span class="cx">         for (int y = rect.y(); y &lt; rect.maxY(); ++y, row += colorChannels * size().width()) {
</span><span class="cx">             png_bytep pixel = row;
</span><del>-            ImageFrame::PixelData* address = buffer.getAddr(rect.x(), y);
</del><ins>+            RGBA32* address = buffer.pixelAt(rect.x(), y);
</ins><span class="cx">             for (int x = rect.x(); x &lt; rect.maxX(); ++x, pixel += colorChannels) {
</span><span class="cx">                 unsigned alpha = hasAlpha ? pixel[3] : 255;
</span><span class="cx">                 nonTrivialAlpha |= alpha &lt; 255;
</span><span class="cx">                 if (!m_blend)
</span><del>-                    buffer.setRGBA(address++, pixel[0], pixel[1], pixel[2], alpha);
</del><ins>+                    buffer.setPixel(address++, pixel[0], pixel[1], pixel[2], alpha);
</ins><span class="cx">                 else
</span><del>-                    buffer.overRGBA(address++, pixel[0], pixel[1], pixel[2], alpha);
</del><ins>+                    buffer.blendPixel(address++, pixel[0], pixel[1], pixel[2], alpha);
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecoderspngPNGImageDecoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/png/PNGImageDecoder.h        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">         int repetitionCount() const override { return m_playCount-1; }
</span><span class="cx"> #endif
</span><span class="cx">         bool isSizeAvailable() override;
</span><del>-        bool setSize(unsigned width, unsigned height) override;
</del><ins>+        bool setSize(const IntSize&amp;) override;
</ins><span class="cx">         ImageFrame* frameBufferAtIndex(size_t index) override;
</span><span class="cx">         // CAUTION: setFailed() deletes |m_reader|.  Be careful to avoid
</span><span class="cx">         // accessing deleted memory, especially when calling this from inside
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecoderswebpWEBPImageDecodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp (205840 => 205841)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp        2016-09-12 23:34:24 UTC (rev 205840)
+++ trunk/Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp        2016-09-12 23:51:57 UTC (rev 205841)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx">             return setFailed();
</span><span class="cx">         m_hasAlpha = false;
</span><span class="cx"> #endif
</span><del>-        if (!setSize(width, height))
</del><ins>+        if (!setSize(IntSize(width, height)))
</ins><span class="cx">             return setFailed();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -128,11 +128,10 @@
</span><span class="cx">     ASSERT(buffer.status() != ImageFrame::FrameComplete);
</span><span class="cx"> 
</span><span class="cx">     if (buffer.status() == ImageFrame::FrameEmpty) {
</span><del>-        if (!buffer.setSize(size().width(), size().height()))
</del><ins>+        if (!buffer.setSize(size()))
</ins><span class="cx">             return setFailed();
</span><span class="cx">         buffer.setStatus(ImageFrame::FramePartial);
</span><span class="cx">         buffer.setHasAlpha(m_hasAlpha);
</span><del>-        buffer.setOriginalFrameRect(IntRect(IntPoint(), size()));
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!m_decoder) {
</span><span class="lines">@@ -139,8 +138,8 @@
</span><span class="cx">         WEBP_CSP_MODE mode = outputMode(m_hasAlpha);
</span><span class="cx">         if (!m_premultiplyAlpha)
</span><span class="cx">             mode = outputMode(false);
</span><del>-        int rowStride = size().width() * sizeof(ImageFrame::PixelData);
-        uint8_t* output = reinterpret_cast&lt;uint8_t*&gt;(buffer.getAddr(0, 0));
</del><ins>+        int rowStride = size().width() * sizeof(RGBA32);
+        uint8_t* output = reinterpret_cast&lt;uint8_t*&gt;(buffer.pixelAt(0, 0));
</ins><span class="cx">         int outputSize = size().height() * rowStride;
</span><span class="cx">         m_decoder = WebPINewRGB(mode, output, outputSize, rowStride);
</span><span class="cx">         if (!m_decoder)
</span></span></pre>
</div>
</div>

</body>
</html>