Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContext.h

Issue 2509193002: Correct the OffscreenCanvas.getContext API (Closed)
Patch Set: support webgl2 Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include <memory> 10 #include <memory>
(...skipping 14 matching lines...) Expand all
25 class Factory : public CanvasRenderingContextFactory { 25 class Factory : public CanvasRenderingContextFactory {
26 WTF_MAKE_NONCOPYABLE(Factory); 26 WTF_MAKE_NONCOPYABLE(Factory);
27 27
28 public: 28 public:
29 Factory() {} 29 Factory() {}
30 ~Factory() override {} 30 ~Factory() override {}
31 31
32 CanvasRenderingContext* create(HTMLCanvasElement*, 32 CanvasRenderingContext* create(HTMLCanvasElement*,
33 const CanvasContextCreationAttributes&, 33 const CanvasContextCreationAttributes&,
34 Document&) override; 34 Document&) override;
35 CanvasRenderingContext* create(
36 ScriptState*,
37 OffscreenCanvas*,
38 const CanvasContextCreationAttributes&) override;
35 CanvasRenderingContext::ContextType getContextType() const override { 39 CanvasRenderingContext::ContextType getContextType() const override {
36 return CanvasRenderingContext::ContextWebgl2; 40 return CanvasRenderingContext::ContextWebgl2;
37 } 41 }
38 void onError(HTMLCanvasElement*, const String& error) override; 42 void onError(HTMLCanvasElement*, const String& error) override;
39 }; 43 };
40 44
41 ~WebGL2RenderingContext() override; 45 ~WebGL2RenderingContext() override;
42 46
43 CanvasRenderingContext::ContextType getContextType() const override { 47 CanvasRenderingContext::ContextType getContextType() const override {
44 return CanvasRenderingContext::ContextWebgl2; 48 return CanvasRenderingContext::ContextWebgl2;
45 } 49 }
46 ImageBitmap* transferToImageBitmap(ScriptState*) final; 50 ImageBitmap* transferToImageBitmap(ScriptState*) final;
47 String contextName() const override { return "WebGL2RenderingContext"; } 51 String contextName() const override { return "WebGL2RenderingContext"; }
48 void registerContextExtensions() override; 52 void registerContextExtensions() override;
49 void setCanvasGetContextResult(RenderingContext&) final; 53 void setCanvasGetContextResult(RenderingContext&) final;
50 void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) final; 54 void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) final;
51 55
52 DECLARE_VIRTUAL_TRACE(); 56 DECLARE_VIRTUAL_TRACE();
53 57
54 DECLARE_VIRTUAL_TRACE_WRAPPERS(); 58 DECLARE_VIRTUAL_TRACE_WRAPPERS();
55 59
56 protected: 60 protected:
57 WebGL2RenderingContext( 61 WebGL2RenderingContext(
58 HTMLCanvasElement* passedCanvas, 62 HTMLCanvasElement* passedCanvas,
59 std::unique_ptr<WebGraphicsContext3DProvider>, 63 std::unique_ptr<WebGraphicsContext3DProvider>,
60 const CanvasContextCreationAttributes& requestedAttributes); 64 const CanvasContextCreationAttributes& requestedAttributes);
61 65
66 WebGL2RenderingContext(
67 OffscreenCanvas* passedOffscreenCanvas,
68 std::unique_ptr<WebGraphicsContext3DProvider>,
69 const CanvasContextCreationAttributes& requestedAttributes);
70
62 Member<EXTColorBufferFloat> m_extColorBufferFloat; 71 Member<EXTColorBufferFloat> m_extColorBufferFloat;
63 Member<EXTDisjointTimerQueryWebGL2> m_extDisjointTimerQueryWebGL2; 72 Member<EXTDisjointTimerQueryWebGL2> m_extDisjointTimerQueryWebGL2;
64 Member<EXTTextureFilterAnisotropic> m_extTextureFilterAnisotropic; 73 Member<EXTTextureFilterAnisotropic> m_extTextureFilterAnisotropic;
65 Member<OESTextureFloatLinear> m_oesTextureFloatLinear; 74 Member<OESTextureFloatLinear> m_oesTextureFloatLinear;
66 Member<WebGLCompressedTextureASTC> m_webglCompressedTextureASTC; 75 Member<WebGLCompressedTextureASTC> m_webglCompressedTextureASTC;
67 Member<WebGLCompressedTextureATC> m_webglCompressedTextureATC; 76 Member<WebGLCompressedTextureATC> m_webglCompressedTextureATC;
68 Member<WebGLCompressedTextureETC> m_webglCompressedTextureETC; 77 Member<WebGLCompressedTextureETC> m_webglCompressedTextureETC;
69 Member<WebGLCompressedTextureETC1> m_webglCompressedTextureETC1; 78 Member<WebGLCompressedTextureETC1> m_webglCompressedTextureETC1;
70 Member<WebGLCompressedTexturePVRTC> m_webglCompressedTexturePVRTC; 79 Member<WebGLCompressedTexturePVRTC> m_webglCompressedTexturePVRTC;
71 Member<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC; 80 Member<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC;
72 Member<WebGLCompressedTextureS3TCsRGB> m_webglCompressedTextureS3TCsRGB; 81 Member<WebGLCompressedTextureS3TCsRGB> m_webglCompressedTextureS3TCsRGB;
73 Member<WebGLDebugRendererInfo> m_webglDebugRendererInfo; 82 Member<WebGLDebugRendererInfo> m_webglDebugRendererInfo;
74 Member<WebGLDebugShaders> m_webglDebugShaders; 83 Member<WebGLDebugShaders> m_webglDebugShaders;
75 Member<WebGLLoseContext> m_webglLoseContext; 84 Member<WebGLLoseContext> m_webglLoseContext;
76 }; 85 };
77 86
78 DEFINE_TYPE_CASTS(WebGL2RenderingContext, 87 DEFINE_TYPE_CASTS(WebGL2RenderingContext,
79 CanvasRenderingContext, 88 CanvasRenderingContext,
80 context, 89 context,
81 context->is3d() && 90 context->is3d() &&
82 WebGLRenderingContextBase::getWebGLVersion(context) == 2, 91 WebGLRenderingContextBase::getWebGLVersion(context) == 2,
83 context.is3d() && 92 context.is3d() &&
84 WebGLRenderingContextBase::getWebGLVersion(&context) == 93 WebGLRenderingContextBase::getWebGLVersion(&context) ==
85 2); 94 2);
86 95
87 } // namespace blink 96 } // namespace blink
88 97
89 #endif 98 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698