Changeset 116365 in webkit


Ignore:
Timestamp:
May 7, 2012 4:07:54 PM (12 years ago)
Author:
Martin Robinson
Message:

[Cairo] Implement ImageBuffer::copyImage for BackingStoreCopy == DontCopyBackingStore
https://bugs.webkit.org/show_bug.cgi?id=85728

Reviewed by Alejandro G. Castro.

No new tests. This should not change functionality, only increase performance.

  • platform/graphics/cairo/ImageBufferCairo.cpp:

(WebCore::ImageBuffer::copyImage): Add an implementation that knows how to avoid copying the backing store.
(WebCore::ImageBuffer::draw): Use the copyImage constructor now that it knows how to
avoid copying the backing store.
(WebCore::ImageBuffer::drawPattern): Ditto.

  • platform/graphics/texmap/TextureMapperLayer.cpp:

(WebCore::TextureMapperLayer::updateBackingStore): Use DontCopyBackingStore for Cairo
as well.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116364 r116365  
     12012-05-06  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [Cairo] Implement ImageBuffer::copyImage for BackingStoreCopy == DontCopyBackingStore
     4        https://bugs.webkit.org/show_bug.cgi?id=85728
     5
     6        Reviewed by Alejandro G. Castro.
     7
     8        No new tests. This should not change functionality, only increase performance.
     9
     10        * platform/graphics/cairo/ImageBufferCairo.cpp:
     11        (WebCore::ImageBuffer::copyImage): Add an implementation that knows how to avoid copying the backing store.
     12        (WebCore::ImageBuffer::draw): Use the copyImage constructor now that it knows how to
     13        avoid copying the backing store.
     14        (WebCore::ImageBuffer::drawPattern): Ditto.
     15        * platform/graphics/texmap/TextureMapperLayer.cpp:
     16        (WebCore::TextureMapperLayer::updateBackingStore): Use DontCopyBackingStore for Cairo
     17        as well.
     18
    1192012-05-07  Noel Gordon  <noel.gordon@gmail.com>
    220
  • trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp

    r114992 r116365  
    8585PassRefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior) const
    8686{
    87     ASSERT(copyBehavior == CopyBackingStore);
     87    if (copyBehavior == CopyBackingStore)
     88        return BitmapImage::create(copyCairoImageSurface(m_data.m_surface).leakRef());
     89
    8890    // BitmapImage will release the passed in surface on destruction
    89     return BitmapImage::create(copyCairoImageSurface(m_data.m_surface).leakRef());
     91    return BitmapImage::create(cairo_surface_reference(m_data.m_surface));
    9092}
    9193
     
    98100                       CompositeOperator op , bool useLowQualityScale)
    99101{
    100     // BitmapImage will release the passed in surface on destruction
    101     RefPtr<Image> image = BitmapImage::create(cairo_surface_reference(m_data.m_surface));
     102    RefPtr<Image> image = copyImage(DontCopyBackingStore);
    102103    context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, DoNotRespectImageOrientation, useLowQualityScale);
    103104}
     
    106107                              const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
    107108{
    108     // BitmapImage will release the passed in surface on destruction
    109     RefPtr<Image> image = BitmapImage::create(cairo_surface_reference(m_data.m_surface));
     109    RefPtr<Image> image = copyImage(DontCopyBackingStore);
    110110    image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
    111111}
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

    r116247 r116365  
    123123    layer->paintGraphicsLayerContents(*context, dirtyRect);
    124124
    125     RefPtr<Image> image;
    126 
    127 #if PLATFORM(QT)
    128     image = imageBuffer->copyImage(DontCopyBackingStore);
    129 #else
    130     // FIXME: support DontCopyBackingStore in non-Qt ports that use TextureMapper.
    131     image = imageBuffer->copyImage(CopyBackingStore);
    132 #endif
    133 
     125    RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
    134126    static_cast<TextureMapperTiledBackingStore*>(m_backingStore.get())->updateContents(textureMapper, image.get(), m_size, dirtyRect);
    135127    m_state.needsDisplay = false;
Note: See TracChangeset for help on using the changeset viewer.