OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WebGL2RenderingContext_h | 5 #ifndef WebGL2RenderingContext_h |
6 #define WebGL2RenderingContext_h | 6 #define WebGL2RenderingContext_h |
7 | 7 |
8 #include "core/html/canvas/CanvasRenderingContextFactory.h" | 8 #include "core/html/canvas/CanvasRenderingContextFactory.h" |
9 #include "modules/webgl/WebGL2RenderingContextBase.h" | 9 #include "modules/webgl/WebGL2RenderingContextBase.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class CanvasContextCreationAttributes; | 13 class CanvasContextCreationAttributes; |
14 | 14 |
15 class WebGL2RenderingContext : public WebGL2RenderingContextBase { | 15 class WebGL2RenderingContext : public WebGL2RenderingContextBase { |
16 DEFINE_WRAPPERTYPEINFO(); | 16 DEFINE_WRAPPERTYPEINFO(); |
17 public: | 17 public: |
18 class Factory : public CanvasRenderingContextFactory { | 18 class Factory : public CanvasRenderingContextFactory { |
19 WTF_MAKE_NONCOPYABLE(Factory); | 19 WTF_MAKE_NONCOPYABLE(Factory); |
20 public: | 20 public: |
21 Factory() {} | 21 Factory() {} |
22 ~Factory() override {} | 22 ~Factory() override {} |
23 | 23 |
24 PassOwnPtrWillBeRawPtr<CanvasRenderingContext> create(HTMLCanvasElement*
, const CanvasContextCreationAttributes&, Document&) override; | 24 PassOwnPtrWillBeRawPtr<CanvasRenderingContext> create(HTMLCanvasElement*
, ScriptState*, const CanvasContextCreationAttributes&, Document&) override; |
25 CanvasRenderingContext::ContextType contextType() const override { retur
n CanvasRenderingContext::ContextWebgl2; } | 25 CanvasRenderingContext::ContextType contextType() const override { retur
n CanvasRenderingContext::ContextWebgl2; } |
26 void onError(HTMLCanvasElement*, const String& error) override; | 26 void onError(HTMLCanvasElement*, const String& error) override; |
27 }; | 27 }; |
28 | 28 |
29 ~WebGL2RenderingContext() override; | 29 ~WebGL2RenderingContext() override; |
30 | 30 |
31 CanvasRenderingContext::ContextType contextType() const override { return Ca
nvasRenderingContext::ContextWebgl2; } | 31 CanvasRenderingContext::ContextType contextType() const override { return Ca
nvasRenderingContext::ContextWebgl2; } |
32 unsigned version() const override { return 2; } | 32 unsigned version() const override { return 2; } |
33 String contextName() const override { return "WebGL2RenderingContext"; } | 33 String contextName() const override { return "WebGL2RenderingContext"; } |
34 void registerContextExtensions() override; | 34 void registerContextExtensions() override; |
35 | 35 |
36 DECLARE_VIRTUAL_TRACE(); | 36 DECLARE_VIRTUAL_TRACE(); |
37 | 37 |
38 protected: | 38 protected: |
39 WebGL2RenderingContext(HTMLCanvasElement* passedCanvas, PassOwnPtr<WebGraphi
csContext3D>, const WebGLContextAttributes& requestedAttributes); | 39 WebGL2RenderingContext(HTMLCanvasElement* passedCanvas, ScriptState*, PassOw
nPtr<WebGraphicsContext3D>, const WebGLContextAttributes& requestedAttributes); |
40 | 40 |
41 PersistentWillBeMember<CHROMIUMSubscribeUniform> m_chromiumSubscribeUniform; | 41 PersistentWillBeMember<CHROMIUMSubscribeUniform> m_chromiumSubscribeUniform; |
42 PersistentWillBeMember<EXTTextureFilterAnisotropic> m_extTextureFilterAnisot
ropic; | 42 PersistentWillBeMember<EXTTextureFilterAnisotropic> m_extTextureFilterAnisot
ropic; |
43 PersistentWillBeMember<OESTextureFloatLinear> m_oesTextureFloatLinear; | 43 PersistentWillBeMember<OESTextureFloatLinear> m_oesTextureFloatLinear; |
44 PersistentWillBeMember<WebGLCompressedTextureASTC> m_webglCompressedTextureA
STC; | 44 PersistentWillBeMember<WebGLCompressedTextureASTC> m_webglCompressedTextureA
STC; |
45 PersistentWillBeMember<WebGLCompressedTextureATC> m_webglCompressedTextureAT
C; | 45 PersistentWillBeMember<WebGLCompressedTextureATC> m_webglCompressedTextureAT
C; |
46 PersistentWillBeMember<WebGLCompressedTextureETC1> m_webglCompressedTextureE
TC1; | 46 PersistentWillBeMember<WebGLCompressedTextureETC1> m_webglCompressedTextureE
TC1; |
47 PersistentWillBeMember<WebGLCompressedTexturePVRTC> m_webglCompressedTexture
PVRTC; | 47 PersistentWillBeMember<WebGLCompressedTexturePVRTC> m_webglCompressedTexture
PVRTC; |
48 PersistentWillBeMember<WebGLCompressedTextureS3TC> m_webglCompressedTextureS
3TC; | 48 PersistentWillBeMember<WebGLCompressedTextureS3TC> m_webglCompressedTextureS
3TC; |
49 PersistentWillBeMember<WebGLDebugRendererInfo> m_webglDebugRendererInfo; | 49 PersistentWillBeMember<WebGLDebugRendererInfo> m_webglDebugRendererInfo; |
50 PersistentWillBeMember<WebGLDebugShaders> m_webglDebugShaders; | 50 PersistentWillBeMember<WebGLDebugShaders> m_webglDebugShaders; |
51 PersistentWillBeMember<WebGLLoseContext> m_webglLoseContext; | 51 PersistentWillBeMember<WebGLLoseContext> m_webglLoseContext; |
52 }; | 52 }; |
53 | 53 |
54 DEFINE_TYPE_CASTS(WebGL2RenderingContext, CanvasRenderingContext, context, | 54 DEFINE_TYPE_CASTS(WebGL2RenderingContext, CanvasRenderingContext, context, |
55 context->is3d() && WebGLRenderingContextBase::getWebGLVersion(context) == 2, | 55 context->is3d() && WebGLRenderingContextBase::getWebGLVersion(context) == 2, |
56 context.is3d() && WebGLRenderingContextBase::getWebGLVersion(&context) == 2)
; | 56 context.is3d() && WebGLRenderingContextBase::getWebGLVersion(&context) == 2)
; |
57 | 57 |
58 } // namespace blink | 58 } // namespace blink |
59 | 59 |
60 #endif | 60 #endif |
OLD | NEW |