Commit 63b06ae8 authored by simon.fraser@apple.com's avatar simon.fraser@apple.com
Browse files

2010-04-02 Simon Fraser <simon.fraser@apple.com>

        Reviewed by Darin Adler.

        Very bad scrolling-performance with the Trackpad at http://www.apple.com/ipad/app-store/
        https://bugs.webkit.org/show_bug.cgi?id=36978

        When we update compositing layers (which can happen on scrolling, when there are fixed position elements
        on the page), we can end up redundantly setting images as layer contents if we have to color-correct
        the image. This is because we call CGImageCreateCopyWithColorSpace(), which hands back a new image
        every time.

        Avoid this by storing a reference to the original uncorrected image, which is used to then
        avoid work if the image does not change.

        * platform/graphics/mac/GraphicsLayerCA.h:
        * platform/graphics/mac/GraphicsLayerCA.mm:
        (WebCore::GraphicsLayerCA::setContentsToImage):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@57039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 26ef9bee
......@@ -333,6 +333,25 @@
(WebCore::HTMLInputElement::saveFormControlState):
Remove the autoComplete() check. Document::formElementsState() does equivalent check.
 
2010-04-02 Simon Fraser <simon.fraser@apple.com>
Reviewed by Darin Adler.
Very bad scrolling-performance with the Trackpad at http://www.apple.com/ipad/app-store/
https://bugs.webkit.org/show_bug.cgi?id=36978
When we update compositing layers (which can happen on scrolling, when there are fixed position elements
on the page), we can end up redundantly setting images as layer contents if we have to color-correct
the image. This is because we call CGImageCreateCopyWithColorSpace(), which hands back a new image
every time.
Avoid this by storing a reference to the original uncorrected image, which is used to then
avoid work if the image does not change.
* platform/graphics/mac/GraphicsLayerCA.h:
* platform/graphics/mac/GraphicsLayerCA.mm:
(WebCore::GraphicsLayerCA::setContentsToImage):
2010-04-02 Simon Fraser <simon.fraser@apple.com>
 
Reviewed by Darin Adler.
......@@ -340,6 +340,7 @@ private:
RetainPtr<WebAnimationDelegate> m_animationDelegate;
RetainPtr<CGImageRef> m_uncorrectedContentsImage;
RetainPtr<CGImageRef> m_pendingContentsImage;
struct LayerAnimation {
......
......@@ -768,7 +768,17 @@ void GraphicsLayerCA::pauseAnimation(const String& keyframesName, double timeOff
void GraphicsLayerCA::setContentsToImage(Image* image)
{
if (image) {
m_pendingContentsImage = image->nativeImageForCurrentFrame();
CGImageRef newImage = image->nativeImageForCurrentFrame();
if (!newImage)
return;
// Check to see if the image changed; we have to do this because the call to
// CGImageCreateCopyWithColorSpace() below can create a new image every time.
if (m_uncorrectedContentsImage && m_uncorrectedContentsImage.get() == newImage)
return;
m_uncorrectedContentsImage = newImage;
m_pendingContentsImage = newImage;
CGColorSpaceRef colorSpace = CGImageGetColorSpace(m_pendingContentsImage.get());
static CGColorSpaceRef deviceRGB = CGColorSpaceCreateDeviceRGB();
......@@ -782,6 +792,7 @@ void GraphicsLayerCA::setContentsToImage(Image* image)
if (!m_contentsLayer)
noteSublayersChanged();
} else {
m_uncorrectedContentsImage = 0;
m_pendingContentsImage = 0;
m_contentsLayerPurpose = NoContentsLayer;
if (m_contentsLayer)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment