⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 94024 in webkit


Ignore:
Timestamp:
Aug 29, 2011, 3:52:36 PM (15 years ago)
Author:
mdelaney@apple.com
Message:

[CG] ImageBufferCG should handle IOSurface allocation failure gracefully
https://bugs.webkit.org/show_bug.cgi?id=67099

Reviewed by Simon Fraser.

No new tests. Testing the "fallback to old path" behavior is not easily testable.

  • platform/graphics/cg/ImageBufferCG.cpp: Rearranged backing store creation to fall back to old path if IOSurface creation path fails.

(WebCore::ImageBuffer::ImageBuffer):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r94019 r94024  
     12011-08-29  Matthew Delaney  <mdelaney@apple.com>
     2
     3        [CG] ImageBufferCG should handle IOSurface allocation failure gracefully
     4        https://bugs.webkit.org/show_bug.cgi?id=67099
     5
     6        Reviewed by Simon Fraser.
     7
     8        No new tests. Testing the "fallback to old path" behavior is not easily testable.
     9
     10        * platform/graphics/cg/ImageBufferCG.cpp: Rearranged backing store creation to fall back to
     11          old path if IOSurface creation path fails.
     12        (WebCore::ImageBuffer::ImageBuffer):
     13
    1142011-08-29  Cary Clark  <caryclark@google.com>
    215
  • trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp

    r92068 r94024  
    138138
    139139    RetainPtr<CGContextRef> cgContext;
     140    if (m_accelerateRendering) {
     141#if USE(IOSURFACE_CANVAS_BACKING_STORE)
     142        m_data.m_surface = createIOSurface(size);
     143        cgContext.adoptCF(wkIOSurfaceContextCreate(m_data.m_surface.get(), size.width(), size.height(), m_data.m_colorSpace));
     144#endif
     145        if (!cgContext)
     146            m_accelerateRendering = false; // If allocation fails, fall back to non-accelerated path.
     147    }
     148
    140149    if (!m_accelerateRendering) {
    141150        if (!tryFastCalloc(size.height(), bytesPerRow).getValue(m_data.m_data))
     
    147156        // Create a live image that wraps the data.
    148157        m_data.m_dataProvider.adoptCF(CGDataProviderCreateWithData(0, m_data.m_data, dataSize, releaseImageData));
    149     } else {
    150 #if USE(IOSURFACE_CANVAS_BACKING_STORE)
    151         m_data.m_surface = createIOSurface(size);
    152         cgContext.adoptCF(wkIOSurfaceContextCreate(m_data.m_surface.get(), size.width(), size.height(), m_data.m_colorSpace));
    153 #else
    154         m_accelerateRendering = false; // Force to false on older platforms
    155 #endif
    156158    }
    157159
Note: See TracChangeset for help on using the changeset viewer.