SharedPlatformSurfaceTizen should accept PlatformSurface Attributes 73/4073/1
authorKondapally Kalyan <kalyan.kondapally@intel.com>
Tue, 18 Jun 2013 22:36:05 +0000 (01:36 +0300)
committerKondapally Kalyan <kalyan.kondapally@intel.com>
Tue, 18 Jun 2013 22:36:05 +0000 (01:36 +0300)
SharedPlatformSurfaceTizen accepts boolean values of all the
features it needs to support. Instead of using the boolean values,
it would be better to use GLPlatformSurface attributes.
This patch changes the constructor of SharedPlatformSurfaceTizen
to use GLPlatformSurface Attributes instead of boolean values.

Change-Id: Idf91d722251b54ea18b4616c0f4ffa6a09b42138

Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.cpp
Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.h
Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp
Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.h
Source/WebKit2/WebProcess/WebPage/efl/tizen/PlatformSurfacePoolTizen.cpp

index 80af7d0..118f01a 100755 (executable)
@@ -166,7 +166,17 @@ bool GraphicsContext3DOffscreen::initialize(HostWindow* hostWindow)
         return false;
 #if ENABLE(TIZEN_WEBKIT2)
 #if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
-    RefPtr<PlatformSurfaceInfo> newSurface = adoptRef(new PlatformSurfaceInfo(IntSize(1, 1), m_attributes.alpha, m_attributes.depth, m_attributes.stencil));
+    GLPlatformSurface::SurfaceAttributes sharedSurfaceAttributes = GLPlatformSurface::Default;
+    if (m_attributes.alpha)
+        sharedSurfaceAttributes |= GLPlatformSurface::SupportAlpha;
+
+    if (m_attributes.depth)
+        sharedSurfaceAttributes |= GLPlatformSurface::SupportDepth;
+
+    if (m_attributes.stencil)
+        sharedSurfaceAttributes |= GLPlatformSurface::SupportStencil;
+
+    RefPtr<PlatformSurfaceInfo> newSurface = adoptRef(new PlatformSurfaceInfo(IntSize(1, 1), sharedSurfaceAttributes));
     if (!newSurface->m_platformSurface)
         return false;
 
@@ -462,7 +472,17 @@ SharedPlatformSurfaceTizen* GraphicsContext3DOffscreen::getFreePlatformSurface()
     }
     if (!newPlatformSurface) {
         if (m_platformSurfaces.size() < m_maxPlatformSurface) {
-            RefPtr<PlatformSurfaceInfo> newSurface = adoptRef(new PlatformSurfaceInfo(IntSize(m_width, m_height), m_attributes.alpha, m_attributes.depth, m_attributes.stencil));
+            GLPlatformSurface::SurfaceAttributes sharedSurfaceAttributes = GLPlatformSurface::Default;
+            if (m_attributes.alpha)
+                sharedSurfaceAttributes |= GLPlatformSurface::SupportAlpha;
+
+            if (m_attributes.depth)
+                sharedSurfaceAttributes |= GLPlatformSurface::SupportDepth;
+
+            if (m_attributes.stencil)
+                sharedSurfaceAttributes |= GLPlatformSurface::SupportStencil;
+
+            RefPtr<PlatformSurfaceInfo> newSurface = adoptRef(new PlatformSurfaceInfo(IntSize(m_width, m_height), sharedSurfaceAttributes));
             newPlatformSurface = newSurface->m_platformSurface.get();
 
             if (newPlatformSurface)
index 07565aa..857f81a 100755 (executable)
@@ -139,11 +139,11 @@ private:
 #if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
     class PlatformSurfaceInfo : public RefCounted<PlatformSurfaceInfo> {
     public :
-        PlatformSurfaceInfo(const IntSize& size, bool hasAlpha, bool hasDepth, bool hasStencil)
+        PlatformSurfaceInfo(const IntSize& size, GLPlatformSurface::SurfaceAttributes attributes)
             : m_used(false)
             , m_size(size)
         {
-            m_platformSurface = SharedPlatformSurfaceTizen::create(size, false, hasAlpha, hasDepth, hasStencil);
+            m_platformSurface = SharedPlatformSurfaceTizen::create(size, attributes);
         };
 
         ~PlatformSurfaceInfo()
index e5fd601..ce826e4 100755 (executable)
@@ -105,10 +105,10 @@ GLPlatformContext* PixmapContextPool::getContext(GLPlatformSurface* surface)
     return pixmapContext;
 }
 
-PassOwnPtr<SharedPlatformSurfaceTizen> SharedPlatformSurfaceTizen::create(const IntSize& size, bool lockable, bool hasAlpha, bool hasDepth, bool hasStencil)
+PassOwnPtr<SharedPlatformSurfaceTizen> SharedPlatformSurfaceTizen::create(const IntSize& size, GLPlatformSurface::SurfaceAttributes attributes)
 {
-    OwnPtr<SharedPlatformSurfaceTizen> pixmap = adoptPtr(new SharedPlatformSurfaceTizen(size, lockable, hasAlpha, hasDepth, hasStencil));
-    if (!pixmap->initialize())
+    OwnPtr<SharedPlatformSurfaceTizen> pixmap = adoptPtr(new SharedPlatformSurfaceTizen(size));
+    if (!pixmap->initialize(attributes))
         return nullptr;
     return pixmap.release();
 }
@@ -131,25 +131,11 @@ bool SharedPlatformSurfaceTizen::supportsLockSurfaceExtension()
     return supportLockSurfaceExt;
 }
 
-SharedPlatformSurfaceTizen::SharedPlatformSurfaceTizen(const IntSize& size, bool lockable, bool hasAlpha, bool hasDepth, bool hasStencil)
+SharedPlatformSurfaceTizen::SharedPlatformSurfaceTizen(const IntSize& size)
     : m_size(size)
     , m_isUsed(false)
     , m_offScreenContext(0)
 {
-    m_sharedSurfaceAttributes = GLPlatformSurface::Default;
-
-    if (hasAlpha)
-        m_sharedSurfaceAttributes = GLPlatformSurface::SupportAlpha;
-
-    if (lockable)
-        m_sharedSurfaceAttributes = GLPlatformSurface::Lockable;
-    else {
-        if (hasDepth)
-            m_sharedSurfaceAttributes = GLPlatformSurface::SupportDepth;
-
-        if (hasStencil)
-            m_sharedSurfaceAttributes = GLPlatformSurface::SupportStencil;
-    }
 }
 
 SharedPlatformSurfaceTizen::~SharedPlatformSurfaceTizen()
@@ -160,15 +146,15 @@ SharedPlatformSurfaceTizen::~SharedPlatformSurfaceTizen()
     }
 }
 
-bool SharedPlatformSurfaceTizen::initialize()
+bool SharedPlatformSurfaceTizen::initialize(GLPlatformSurface::SurfaceAttributes attributes)
 {
     if (m_size.isEmpty())
         return false;
 
-    if ((m_sharedSurfaceAttributes & GLPlatformSurface::Lockable) && !supportsLockSurfaceExtension())
+    if ((attributes & GLPlatformSurface::Lockable) && !supportsLockSurfaceExtension())
         return false;
 
-    m_offScreenSurface = GLPlatformSurface::createOffScreenSurface(m_sharedSurfaceAttributes, m_size);
+    m_offScreenSurface = GLPlatformSurface::createOffScreenSurface(attributes, m_size);
 
     if (!m_offScreenSurface)
         return false;
index 5217cf2..9f2ec00 100755 (executable)
@@ -39,7 +39,7 @@ namespace WebCore {
 class GLPlatformContext;
 class SharedPlatformSurfaceTizen {
 public:
-    static PassOwnPtr<SharedPlatformSurfaceTizen> create(const IntSize&, bool lockable, bool hasAlpha = true, bool hasDepth = true, bool hasStencil = false);
+    static PassOwnPtr<SharedPlatformSurfaceTizen> create(const IntSize&, GLPlatformSurface::SurfaceAttributes);
     static bool supportsLockSurfaceExtension();
     virtual ~SharedPlatformSurfaceTizen();
     bool makeContextCurrent();
@@ -54,14 +54,13 @@ public:
     bool used() { return m_isUsed; }
     void setUsed(bool isUsed) { m_isUsed = isUsed; }
 private:
-    SharedPlatformSurfaceTizen(const IntSize&, bool lockable, bool hasAlpha, bool hasDepth, bool hasStencil);
+    SharedPlatformSurfaceTizen(const IntSize&);
 
-    bool initialize();
+    bool initialize(GLPlatformSurface::SurfaceAttributes);
     IntSize m_size;
     bool m_isUsed;
     OwnPtr<GLPlatformSurface> m_offScreenSurface;
     GLPlatformContext* m_offScreenContext;
-    GLPlatformSurface::SurfaceAttributes m_sharedSurfaceAttributes;
 };
 
 }
index c6ce2a4..001bf84 100644 (file)
@@ -55,7 +55,8 @@ PlatformSurfacePoolTizen::PlatformSurfaceInfo::PlatformSurfaceInfo(const IntSize
     , m_age(0)
     , m_tileID(0)
 {
-    m_SharedPlatformSurfaceTizen =  WebCore::SharedPlatformSurfaceTizen::create(size, true);
+    WebCore::GLPlatformSurface::SurfaceAttributes sharedSurfaceAttributes = WebCore::GLPlatformSurface::Lockable | WebCore::GLPlatformSurface::SupportAlpha;
+    m_SharedPlatformSurfaceTizen =  WebCore::SharedPlatformSurfaceTizen::create(size, sharedSurfaceAttributes);
 }
 
 PlatformSurfacePoolTizen::PlatformSurfacePoolTizen()