1 | /* |
2 | * Copyright (C) 2011, 2012, 2017 Igalia S.L. |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser 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. |
8 | * |
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 | * Lesser General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General Public |
15 | * License along with this library; if not, write to the Free |
16 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | * Boston, MA 02110-1301 USA |
18 | */ |
19 | |
20 | #pragma once |
21 | |
22 | #if ENABLE(GRAPHICS_CONTEXT_3D) && USE(TEXTURE_MAPPER) && !USE(NICOSIA) |
23 | |
24 | #include "GraphicsContext3D.h" |
25 | #include "PlatformLayer.h" |
26 | #include "TextureMapperPlatformLayer.h" |
27 | #include "TextureMapperPlatformLayerProxyProvider.h" |
28 | |
29 | namespace WebCore { |
30 | |
31 | class GLContext; |
32 | class TextureMapperPlatformLayerProxy; |
33 | |
34 | class TextureMapperGC3DPlatformLayer : public PlatformLayer { |
35 | public: |
36 | TextureMapperGC3DPlatformLayer(GraphicsContext3D&, GraphicsContext3D::RenderStyle); |
37 | virtual ~TextureMapperGC3DPlatformLayer(); |
38 | |
39 | bool makeContextCurrent(); |
40 | PlatformGraphicsContext3D platformContext(); |
41 | |
42 | #if USE(COORDINATED_GRAPHICS) |
43 | RefPtr<TextureMapperPlatformLayerProxy> proxy() const override; |
44 | void swapBuffersIfNeeded() override; |
45 | #else |
46 | virtual void paintToTextureMapper(TextureMapper&, const FloatRect& target, const TransformationMatrix&, float opacity); |
47 | #endif |
48 | |
49 | private: |
50 | GraphicsContext3D& m_context; |
51 | std::unique_ptr<GLContext> m_glContext; |
52 | |
53 | #if USE(COORDINATED_GRAPHICS) |
54 | RefPtr<TextureMapperPlatformLayerProxy> m_platformLayerProxy; |
55 | #endif |
56 | }; |
57 | |
58 | } // namespace WebCore |
59 | |
60 | #endif // ENABLE(GRAPHICS_CONTEXT_3D) && USE(TEXTURE_MAPPER) |
61 | |