Title: [190587] trunk/Source/WebCore
- Revision
- 190587
- Author
- [email protected]
- Date
- 2015-10-05 16:17:42 -0700 (Mon, 05 Oct 2015)
Log Message
WebCore::IOSurface should ask the IOSurface for the pixel format instead of
caching it
https://bugs.webkit.org/show_bug.cgi?id=149820
-and corresponding-
rdar://problem/22976230
Reviewed by Tim Horton.
Also there is no reason to make YUV be iOS only, so this patch removes those
PLATFORM checks.
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
(IOSurface::IOSurface):
(IOSurface::format):
* platform/spi/cocoa/IOSurfaceSPI.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (190586 => 190587)
--- trunk/Source/WebCore/ChangeLog 2015-10-05 23:13:50 UTC (rev 190586)
+++ trunk/Source/WebCore/ChangeLog 2015-10-05 23:17:42 UTC (rev 190587)
@@ -1,3 +1,22 @@
+2015-10-05 Beth Dakin <[email protected]>
+
+ WebCore::IOSurface should ask the IOSurface for the pixel format instead of
+ caching it
+ https://bugs.webkit.org/show_bug.cgi?id=149820
+ -and corresponding-
+ rdar://problem/22976230
+
+ Reviewed by Tim Horton.
+
+ Also there is no reason to make YUV be iOS only, so this patch removes those
+ PLATFORM checks.
+
+ * platform/graphics/cocoa/IOSurface.h:
+ * platform/graphics/cocoa/IOSurface.mm:
+ (IOSurface::IOSurface):
+ (IOSurface::format):
+ * platform/spi/cocoa/IOSurfaceSPI.h:
+
2015-10-02 Ryosuke Niwa <[email protected]>
ShadowRoot with leading or trailing white space cause a crash
Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h (190586 => 190587)
--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h 2015-10-05 23:13:50 UTC (rev 190586)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h 2015-10-05 23:17:42 UTC (rev 190587)
@@ -40,9 +40,7 @@
public:
enum class Format {
RGBA,
-#if PLATFORM(IOS)
YUV422
-#endif
};
WEBCORE_EXPORT static std::unique_ptr<IOSurface> create(IntSize, ColorSpace, Format = Format::RGBA);
@@ -80,7 +78,7 @@
IntSize size() const { return m_size; }
size_t totalBytes() const { return m_totalBytes; }
ColorSpace colorSpace() const { return m_colorSpace; }
- Format format() const { return m_format; }
+ Format format() const;
WEBCORE_EXPORT bool isInUse() const;
@@ -102,7 +100,6 @@
void setContextSize(IntSize);
ColorSpace m_colorSpace;
- Format m_format;
IntSize m_size;
IntSize m_contextSize;
size_t m_totalBytes;
Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (190586 => 190587)
--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm 2015-10-05 23:13:50 UTC (rev 190586)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm 2015-10-05 23:17:42 UTC (rev 190587)
@@ -98,23 +98,26 @@
IOSurface::IOSurface(IntSize size, ColorSpace colorSpace, Format format)
: m_colorSpace(colorSpace)
- , m_format(format)
, m_size(size)
, m_contextSize(size)
{
- unsigned pixelFormat = 'BGRA';
- unsigned bytesPerPixel = 4;
- unsigned bytesPerElement = 4;
- unsigned elementWidth = 1;
+ unsigned pixelFormat;
+ unsigned bytesPerPixel;
+ unsigned bytesPerElement;
+ unsigned elementWidth;
-#if PLATFORM(IOS)
- if (format == Format::YUV422) {
+ if (format == Format::RGBA) {
+ pixelFormat = 'BGRA';
+ bytesPerPixel = 4;
+ bytesPerElement = 4;
+ elementWidth = 1;
+ } else {
+ ASSERT(format == Format::YUV422);
pixelFormat = 'yuvf';
bytesPerPixel = 2;
elementWidth = 2;
bytesPerElement = 4;
}
-#endif
int width = size.width();
int height = size.height();
@@ -152,7 +155,6 @@
IOSurface::IOSurface(IOSurfaceRef surface, ColorSpace colorSpace)
: m_colorSpace(colorSpace)
- , m_format(Format::RGBA)
, m_surface(surface)
{
m_size = IntSize(IOSurfaceGetWidth(surface), IOSurfaceGetHeight(surface));
@@ -237,6 +239,18 @@
return IOSurface::SurfaceState::Valid;
}
+IOSurface::Format IOSurface::format() const
+{
+ unsigned pixelFormat = IOSurfaceGetPixelFormat(m_surface.get());
+ if (pixelFormat == 'BGRA')
+ return Format::RGBA;
+ if (pixelFormat == 'yuvf')
+ return Format::YUV422;
+
+ ASSERT_NOT_REACHED();
+ return Format::RGBA;
+}
+
bool IOSurface::isInUse() const
{
return IOSurfaceIsInUse(m_surface.get());
Modified: trunk/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h (190586 => 190587)
--- trunk/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h 2015-10-05 23:13:50 UTC (rev 190586)
+++ trunk/Source/WebCore/platform/spi/cocoa/IOSurfaceSPI.h 2015-10-05 23:17:42 UTC (rev 190587)
@@ -68,6 +68,7 @@
size_t IOSurfaceGetHeight(IOSurfaceRef buffer);
size_t IOSurfaceGetPropertyMaximum(CFStringRef property);
size_t IOSurfaceGetWidth(IOSurfaceRef buffer);
+OSType IOSurfaceGetPixelFormat(IOSurfaceRef buffer);
Boolean IOSurfaceIsInUse(IOSurfaceRef buffer);
IOReturn IOSurfaceLock(IOSurfaceRef buffer, uint32_t options, uint32_t *seed);
IOSurfaceRef IOSurfaceLookupFromMachPort(mach_port_t);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes