Title: [94024] trunk/Source/WebCore
Revision
94024
Author
[email protected]
Date
2011-08-29 15:52:36 -0700 (Mon, 29 Aug 2011)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (94023 => 94024)


--- trunk/Source/WebCore/ChangeLog	2011-08-29 22:51:21 UTC (rev 94023)
+++ trunk/Source/WebCore/ChangeLog	2011-08-29 22:52:36 UTC (rev 94024)
@@ -1,3 +1,16 @@
+2011-08-29  Matthew Delaney  <[email protected]>
+
+        [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):
+
 2011-08-29  Cary Clark  <[email protected]>
 
         Only enable font smoothing as requested (Skia on Mac)

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (94023 => 94024)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2011-08-29 22:51:21 UTC (rev 94023)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2011-08-29 22:52:36 UTC (rev 94024)
@@ -137,6 +137,15 @@
     }
 
     RetainPtr<CGContextRef> cgContext;
+    if (m_accelerateRendering) {
+#if USE(IOSURFACE_CANVAS_BACKING_STORE)
+        m_data.m_surface = createIOSurface(size);
+        cgContext.adoptCF(wkIOSurfaceContextCreate(m_data.m_surface.get(), size.width(), size.height(), m_data.m_colorSpace));
+#endif
+        if (!cgContext)
+            m_accelerateRendering = false; // If allocation fails, fall back to non-accelerated path.
+    }
+
     if (!m_accelerateRendering) {
         if (!tryFastCalloc(size.height(), bytesPerRow).getValue(m_data.m_data))
             return;
@@ -146,13 +155,6 @@
         cgContext.adoptCF(CGBitmapContextCreate(m_data.m_data, size.width(), size.height(), 8, bytesPerRow, m_data.m_colorSpace, m_data.m_bitmapInfo));
         // Create a live image that wraps the data.
         m_data.m_dataProvider.adoptCF(CGDataProviderCreateWithData(0, m_data.m_data, dataSize, releaseImageData));
-    } else {
-#if USE(IOSURFACE_CANVAS_BACKING_STORE)
-        m_data.m_surface = createIOSurface(size);
-        cgContext.adoptCF(wkIOSurfaceContextCreate(m_data.m_surface.get(), size.width(), size.height(), m_data.m_colorSpace));
-#else
-        m_accelerateRendering = false; // Force to false on older platforms
-#endif
     }
 
     if (!cgContext)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to