2
Copyright (C) 2012 Samsung Electronics
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
Boston, MA 02110-1301, USA.
22
#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)
24
#include "AcceleratedCompositingContextEfl.h"
26
#include "FrameView.h"
27
#include "GraphicsContext3D.h"
28
#include "HostWindow.h"
29
#include "PageClientEfl.h"
30
#include "TextureMapperGL.h"
31
#include "TextureMapperLayer.h"
32
#include "ewk_view_private.h"
36
PassOwnPtr<AcceleratedCompositingContext> AcceleratedCompositingContext::create(HostWindow* hostWindow)
38
OwnPtr<AcceleratedCompositingContext> context = adoptPtr(new AcceleratedCompositingContext);
39
if (!context->initialize(hostWindow))
42
return context.release();
45
AcceleratedCompositingContext::AcceleratedCompositingContext()
47
, m_rootTextureMapperLayer(0)
51
AcceleratedCompositingContext::~AcceleratedCompositingContext()
55
bool AcceleratedCompositingContext::initialize(HostWindow* hostWindow)
57
m_view = hostWindow->platformPageClient()->view();
61
m_context3D = GraphicsContext3D::create(GraphicsContext3D::Attributes(), hostWindow, WebCore::GraphicsContext3D::RenderDirectlyToHostWindow);
68
void AcceleratedCompositingContext::syncLayersNow()
70
if (m_rootGraphicsLayer)
71
m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly();
73
EWKPrivate::corePage(m_view)->mainFrame()->view()->flushCompositingStateIncludingSubframes();
76
void AcceleratedCompositingContext::renderLayers()
78
if (!m_rootGraphicsLayer)
81
if (!m_context3D->makeContextCurrent())
86
evas_object_geometry_get(m_view, 0, 0, &width, &height);
87
m_context3D->viewport(0, 0, width, height);
89
m_textureMapper->beginPainting();
90
m_rootTextureMapperLayer->paint();
91
m_textureMapper->endPainting();
94
void AcceleratedCompositingContext::attachRootGraphicsLayer(GraphicsLayer* rootLayer)
97
m_rootGraphicsLayer.clear();
98
m_rootTextureMapperLayer = 0;
102
m_rootGraphicsLayer = WebCore::GraphicsLayer::create(0);
103
m_rootTextureMapperLayer = toTextureMapperLayer(m_rootGraphicsLayer.get());
104
m_rootGraphicsLayer->addChild(rootLayer);
105
m_rootGraphicsLayer->setDrawsContent(false);
106
m_rootGraphicsLayer->setMasksToBounds(false);
107
m_rootGraphicsLayer->setSize(WebCore::IntSize(1, 1));
109
m_textureMapper = TextureMapperGL::create();
110
m_rootTextureMapperLayer->setTextureMapper(m_textureMapper.get());
112
m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly();
115
GraphicsContext3D* AcceleratedCompositingContext::context()
117
return m_context3D.get();
120
} // namespace WebCore
122
#endif // USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)