From c26f36cafe9d7f3b7a9c8a0ef464b7e03dc0bf46 Mon Sep 17 00:00:00 2001 From: Kondapally Kalyan Date: Wed, 19 Jun 2013 01:36:05 +0300 Subject: [PATCH] SharedPlatformSurfaceTizen should accept PlatformSurface Attributes 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 --- .../efl/tizen/GraphicsContext3DOffscreen.cpp | 24 +++++++++++++++++-- .../efl/tizen/GraphicsContext3DOffscreen.h | 4 ++-- .../efl/tizen/SharedPlatformSurfaceTizen.cpp | 28 ++++++---------------- .../efl/tizen/SharedPlatformSurfaceTizen.h | 7 +++--- .../WebPage/efl/tizen/PlatformSurfacePoolTizen.cpp | 3 ++- 5 files changed, 36 insertions(+), 30 deletions(-) diff --git a/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.cpp b/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.cpp index 80af7d0..118f01a 100755 --- a/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.cpp +++ b/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.cpp @@ -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 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 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 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 newSurface = adoptRef(new PlatformSurfaceInfo(IntSize(m_width, m_height), sharedSurfaceAttributes)); newPlatformSurface = newSurface->m_platformSurface.get(); if (newPlatformSurface) diff --git a/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.h b/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.h index 07565aa..857f81a 100755 --- a/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.h +++ b/Source/WebCore/platform/graphics/efl/tizen/GraphicsContext3DOffscreen.h @@ -139,11 +139,11 @@ private: #if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE) class PlatformSurfaceInfo : public RefCounted { 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() diff --git a/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp b/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp index e5fd601..ce826e4 100755 --- a/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp +++ b/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.cpp @@ -105,10 +105,10 @@ GLPlatformContext* PixmapContextPool::getContext(GLPlatformSurface* surface) return pixmapContext; } -PassOwnPtr SharedPlatformSurfaceTizen::create(const IntSize& size, bool lockable, bool hasAlpha, bool hasDepth, bool hasStencil) +PassOwnPtr SharedPlatformSurfaceTizen::create(const IntSize& size, GLPlatformSurface::SurfaceAttributes attributes) { - OwnPtr pixmap = adoptPtr(new SharedPlatformSurfaceTizen(size, lockable, hasAlpha, hasDepth, hasStencil)); - if (!pixmap->initialize()) + OwnPtr 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; diff --git a/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.h b/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.h index 5217cf2..9f2ec00f0 100755 --- a/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.h +++ b/Source/WebCore/platform/graphics/efl/tizen/SharedPlatformSurfaceTizen.h @@ -39,7 +39,7 @@ namespace WebCore { class GLPlatformContext; class SharedPlatformSurfaceTizen { public: - static PassOwnPtr create(const IntSize&, bool lockable, bool hasAlpha = true, bool hasDepth = true, bool hasStencil = false); + static PassOwnPtr 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 m_offScreenSurface; GLPlatformContext* m_offScreenContext; - GLPlatformSurface::SurfaceAttributes m_sharedSurfaceAttributes; }; } diff --git a/Source/WebKit2/WebProcess/WebPage/efl/tizen/PlatformSurfacePoolTizen.cpp b/Source/WebKit2/WebProcess/WebPage/efl/tizen/PlatformSurfacePoolTizen.cpp index c6ce2a4..001bf84 100644 --- a/Source/WebKit2/WebProcess/WebPage/efl/tizen/PlatformSurfacePoolTizen.cpp +++ b/Source/WebKit2/WebProcess/WebPage/efl/tizen/PlatformSurfacePoolTizen.cpp @@ -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() -- 2.7.4