@@ -17,22 +17,6 @@ namespace WebCore {
1717
1818WTF_MAKE_ISO_ALLOCATED_IMPL (ImageBufferCairoGLSurfaceBackend);
1919
20- static cairo_device_t * cairoDevice ()
21- {
22- static cairo_device_t * s_device { nullptr };
23-
24- static std::once_flag s_flag;
25- std::call_once (s_flag,
26- [&] {
27- auto & platformDisplay = PlatformDisplay::sharedDisplayForCompositing ();
28- auto * context = platformDisplay.sharingGLContext ();
29- if (is<GLContextEGL>(context))
30- s_device = cairo_egl_device_create (platformDisplay.eglDisplay (), downcast<GLContextEGL>(context)->context ());
31- });
32-
33- return s_device;
34- }
35-
3620static RefPtr<cairo_surface_t >
3721cairoGLSurfaceCopyToImageSurface (cairo_surface_t * surface)
3822{
@@ -97,7 +81,7 @@ std::unique_ptr<ImageBufferCairoGLSurfaceBackend> ImageBufferCairoGLSurfaceBacke
9781 glPixelStorei (GL_UNPACK_ALIGNMENT, 1 );
9882 glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA, backendSize.width (), backendSize.height (), 0 , GL_RGBA, GL_UNSIGNED_BYTE, 0 );
9983
100- auto * device = cairoDevice ();
84+ auto * device = PlatformDisplay::sharedDisplayForCompositing (). cairoGLDevice ();
10185 if (!device) {
10286 glDeleteTextures (1 , &textures[0 ]);
10387 return { };
@@ -162,7 +146,7 @@ void ImageBufferCairoGLSurfaceBackend::swapBuffersIfNeeded()
162146 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
163147 glPixelStorei (GL_UNPACK_ALIGNMENT, 1 );
164148 glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA, backendSize.width (), backendSize.height (), 0 , GL_RGBA, GL_UNSIGNED_BYTE, 0 );
165- m_surfaces[1 ] = adoptRef (cairo_gl_surface_create_for_texture (cairoDevice (), CAIRO_CONTENT_COLOR_ALPHA, m_textures[1 ], backendSize.width (), backendSize.height ()));
149+ m_surfaces[1 ] = adoptRef (cairo_gl_surface_create_for_texture (PlatformDisplay::sharedDisplayForCompositing (). cairoGLDevice (), CAIRO_CONTENT_COLOR_ALPHA, m_textures[1 ], backendSize.width (), backendSize.height ()));
166150 m_compositorContext = adoptRef (cairo_create (m_surfaces[1 ].get ()));
167151 }
168152
0 commit comments