Title: [213044] trunk/Source/WebCore
Revision
213044
Author
[email protected]
Date
2017-02-27 03:29:57 -0800 (Mon, 27 Feb 2017)

Log Message

[TextureMapper] Clean up BitmapTextureGL construction
https://bugs.webkit.org/show_bug.cgi?id=168909

Reviewed by Carlos Garcia Campos.

Have the BitmapTextureGL constructor accept an rvalue reference pointer
to the GraphicsContext3D object. A static create() method is also added
to help with constructing these objects. Construction sites are updated
appropriately.

The BitmapTextureGL constructor is further cleaned up by moving default
member initializations together with the member declarations.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
* platform/graphics/texmap/BitmapTextureGL.cpp:
(WebCore::BitmapTextureGL::BitmapTextureGL):
* platform/graphics/texmap/BitmapTextureGL.h:
* platform/graphics/texmap/BitmapTexturePool.cpp:
(WebCore::BitmapTexturePool::createTexture):
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::createTexture):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (213043 => 213044)


--- trunk/Source/WebCore/ChangeLog	2017-02-27 10:06:28 UTC (rev 213043)
+++ trunk/Source/WebCore/ChangeLog	2017-02-27 11:29:57 UTC (rev 213044)
@@ -1,5 +1,30 @@
 2017-02-27  Zan Dobersek  <[email protected]>
 
+        [TextureMapper] Clean up BitmapTextureGL construction
+        https://bugs.webkit.org/show_bug.cgi?id=168909
+
+        Reviewed by Carlos Garcia Campos.
+
+        Have the BitmapTextureGL constructor accept an rvalue reference pointer
+        to the GraphicsContext3D object. A static create() method is also added
+        to help with constructing these objects. Construction sites are updated
+        appropriately.
+
+        The BitmapTextureGL constructor is further cleaned up by moving default
+        member initializations together with the member declarations.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
+        * platform/graphics/texmap/BitmapTextureGL.cpp:
+        (WebCore::BitmapTextureGL::BitmapTextureGL):
+        * platform/graphics/texmap/BitmapTextureGL.h:
+        * platform/graphics/texmap/BitmapTexturePool.cpp:
+        (WebCore::BitmapTexturePool::createTexture):
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGL::createTexture):
+
+2017-02-27  Zan Dobersek  <[email protected]>
+
         [TextureMapper] Remove InterpolationQuality, TextDrawingModeFlags member variables
         https://bugs.webkit.org/show_bug.cgi?id=168906
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (213043 => 213044)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2017-02-27 10:06:28 UTC (rev 213043)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2017-02-27 11:29:57 UTC (rev 213044)
@@ -704,7 +704,7 @@
         if (UNLIKELY(!m_context3D))
             m_context3D = GraphicsContext3D::create(GraphicsContext3DAttributes(), nullptr, GraphicsContext3D::RenderToCurrentGLContext);
 
-        RefPtr<BitmapTexture> texture = adoptRef(new BitmapTextureGL(m_context3D));
+        auto texture = BitmapTextureGL::create(*m_context3D);
         texture->reset(size, GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
         buffer = std::make_unique<TextureMapperPlatformLayerBuffer>(WTFMove(texture));
     }

Modified: trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp (213043 => 213044)


--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp	2017-02-27 10:06:28 UTC (rev 213043)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp	2017-02-27 11:29:57 UTC (rev 213044)
@@ -57,18 +57,8 @@
     return static_cast<BitmapTextureGL*>(texture);
 }
 
-BitmapTextureGL::BitmapTextureGL(PassRefPtr<GraphicsContext3D> context3D, const Flags flags)
-    : m_id(0)
-    , m_fbo(0)
-    , m_rbo(0)
-    , m_depthBufferObject(0)
-    , m_shouldClear(true)
-    , m_context3D(context3D)
-#if OS(DARWIN)
-    , m_type(GL_UNSIGNED_INT_8_8_8_8_REV)
-#else
-    , m_type(GraphicsContext3D::UNSIGNED_BYTE)
-#endif
+BitmapTextureGL::BitmapTextureGL(RefPtr<GraphicsContext3D>&& context3D, const Flags flags)
+    : m_context3D(WTFMove(context3D))
 {
     if (flags & FBOAttachment)
         m_internalFormat = m_format = GraphicsContext3D::RGBA;

Modified: trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h (213043 => 213044)


--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h	2017-02-27 10:06:28 UTC (rev 213043)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h	2017-02-27 11:29:57 UTC (rev 213044)
@@ -38,7 +38,11 @@
 
 class BitmapTextureGL : public BitmapTexture {
 public:
-    BitmapTextureGL(PassRefPtr<GraphicsContext3D>, const Flags = NoFlag);
+    static Ref<BitmapTexture> create(Ref<GraphicsContext3D>&& context3D, const Flags flags = NoFlag)
+    {
+        return adoptRef(*new BitmapTextureGL(WTFMove(context3D), flags));
+    }
+
     virtual ~BitmapTextureGL();
 
     IntSize size() const override;
@@ -73,19 +77,18 @@
     GC3Dint internalFormat() const { return m_internalFormat; }
 
 private:
+    BitmapTextureGL(RefPtr<GraphicsContext3D>&&, const Flags);
 
-    Platform3DObject m_id;
+    Platform3DObject m_id { 0 };
     IntSize m_textureSize;
     IntRect m_dirtyRect;
-    Platform3DObject m_fbo;
-    Platform3DObject m_rbo;
-    Platform3DObject m_depthBufferObject;
-    bool m_shouldClear;
+    Platform3DObject m_fbo { 0 };
+    Platform3DObject m_rbo { 0 };
+    Platform3DObject m_depthBufferObject { 0 };
+    bool m_shouldClear { true };
     ClipStack m_clipStack;
     RefPtr<GraphicsContext3D> m_context3D;
 
-    BitmapTextureGL();
-
     void clearIfNeeded();
     void createFboIfNeeded();
 
@@ -93,7 +96,13 @@
 
     GC3Dint m_internalFormat;
     GC3Denum m_format;
-    GC3Denum m_type;
+    GC3Denum m_type {
+#if OS(DARWIN)
+        GL_UNSIGNED_INT_8_8_8_8_REV
+#else
+        GraphicsContext3D::UNSIGNED_BYTE
+#endif
+    };
 };
 
 BitmapTextureGL* toBitmapTextureGL(BitmapTexture*);

Modified: trunk/Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp (213043 => 213044)


--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp	2017-02-27 10:06:28 UTC (rev 213043)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTexturePool.cpp	2017-02-27 11:29:57 UTC (rev 213044)
@@ -105,7 +105,7 @@
 RefPtr<BitmapTexture> BitmapTexturePool::createTexture(const BitmapTexture::Flags flags)
 {
 #if USE(TEXTURE_MAPPER_GL)
-    return adoptRef(new BitmapTextureGL(m_context3D, flags));
+    return BitmapTextureGL::create(*m_context3D, flags);
 #else
     return nullptr;
 #endif

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (213043 => 213044)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2017-02-27 10:06:28 UTC (rev 213043)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2017-02-27 11:29:57 UTC (rev 213044)
@@ -748,8 +748,7 @@
 
 PassRefPtr<BitmapTexture> TextureMapperGL::createTexture()
 {
-    BitmapTextureGL* texture = new BitmapTextureGL(m_context3D);
-    return adoptRef(texture);
+    return BitmapTextureGL::create(*m_context3D);
 }
 
 std::unique_ptr<TextureMapper> TextureMapper::platformCreateAccelerated()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to