| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef WebGLRenderingContext_h | 26 #ifndef WebGLRenderingContext_h |
| 27 #define WebGLRenderingContext_h | 27 #define WebGLRenderingContext_h |
| 28 | 28 |
| 29 #include "core/html/canvas/CanvasRenderingContextFactory.h" | 29 #include "core/html/canvas/CanvasRenderingContextFactory.h" |
| 30 #include "modules/offscreencanvas/OffscreenCanvasRenderingContext.h" |
| 31 #include "modules/offscreencanvas/OffscreenCanvasRenderingContextFactory.h" |
| 30 #include "modules/webgl/WebGLRenderingContextBase.h" | 32 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 31 | 33 |
| 32 namespace blink { | 34 namespace blink { |
| 33 | 35 |
| 34 class CanvasContextCreationAttributes; | 36 class CanvasContextCreationAttributes; |
| 35 | 37 |
| 36 class WebGLRenderingContext final : public WebGLRenderingContextBase { | 38 class WebGLRenderingContext final : public WebGLRenderingContextBase { |
| 37 DEFINE_WRAPPERTYPEINFO(); | 39 DEFINE_WRAPPERTYPEINFO(); |
| 38 public: | 40 public: |
| 39 class Factory : public CanvasRenderingContextFactory { | 41 class Factory : public CanvasRenderingContextFactory { |
| 40 WTF_MAKE_NONCOPYABLE(Factory); | 42 WTF_MAKE_NONCOPYABLE(Factory); |
| 41 public: | 43 public: |
| 42 Factory() {} | 44 Factory() {} |
| 43 ~Factory() override {} | 45 ~Factory() override {} |
| 44 | 46 |
| 45 CanvasRenderingContext* create(HTMLCanvasElement*, const CanvasContextCr
eationAttributes&, Document&) override; | 47 CanvasRenderingContext* create(HTMLCanvasElement*, const CanvasContextCr
eationAttributes&, Document&) override; |
| 46 CanvasRenderingContext::ContextType getContextType() const override { re
turn CanvasRenderingContext::ContextWebgl; } | 48 CanvasRenderingContext::ContextType getContextType() const override { re
turn CanvasRenderingContext::ContextWebgl; } |
| 47 void onError(HTMLCanvasElement*, const String& error) override; | 49 void onError(HTMLCanvasElement*, const String& error) override; |
| 48 }; | 50 }; |
| 49 | 51 |
| 52 class OffscreenCanvasFactory : public OffscreenCanvasRenderingContextFactory
{ |
| 53 WTF_MAKE_NONCOPYABLE(OffscreenCanvasFactory); |
| 54 public: |
| 55 OffscreenCanvasFactory() {} |
| 56 ~OffscreenCanvasFactory() override {} |
| 57 |
| 58 OffscreenCanvasRenderingContext* create(ScriptState*, OffscreenCanvas*,
const CanvasContextCreationAttributes& attrs) override; |
| 59 OffscreenCanvasRenderingContext::ContextType getContextType() const over
ride { return OffscreenCanvasRenderingContext::ContextWebgl; } |
| 60 void onError(OffscreenCanvas* canvas, const String& error) override {} |
| 61 }; |
| 62 |
| 50 ~WebGLRenderingContext() override; | 63 ~WebGLRenderingContext() override; |
| 51 | 64 |
| 52 CanvasRenderingContext::ContextType getContextType() const override { return
CanvasRenderingContext::ContextWebgl; } | 65 CanvasRenderingContext::ContextType getContextType() const override { return
CanvasRenderingContext::ContextWebgl; } |
| 66 OffscreenCanvasRenderingContext::ContextType getOffscreenCanvasRenderingCont
extType() const override { return OffscreenCanvasRenderingContext::ContextWebgl;
} |
| 67 ImageBitmap* transferToImageBitmap(ExceptionState&) final; |
| 53 unsigned version() const override { return 1; } | 68 unsigned version() const override { return 1; } |
| 54 String contextName() const override { return "WebGLRenderingContext"; } | 69 String contextName() const override { return "WebGLRenderingContext"; } |
| 55 void registerContextExtensions() override; | 70 void registerContextExtensions() override; |
| 56 void setCanvasGetContextResult(RenderingContext&) final; | 71 void setCanvasGetContextResult(RenderingContext&) final; |
| 72 void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) final; |
| 57 | 73 |
| 58 EAGERLY_FINALIZE(); | 74 EAGERLY_FINALIZE(); |
| 59 DECLARE_VIRTUAL_TRACE(); | 75 DECLARE_VIRTUAL_TRACE(); |
| 60 | 76 |
| 61 private: | 77 private: |
| 62 WebGLRenderingContext(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3DPro
vider>, const WebGLContextAttributes&); | 78 WebGLRenderingContext(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3DPro
vider>, const WebGLContextAttributes&); |
| 79 WebGLRenderingContext(OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DProvi
der>, const WebGLContextAttributes&); |
| 63 | 80 |
| 64 // Enabled extension objects. | 81 // Enabled extension objects. |
| 65 Member<ANGLEInstancedArrays> m_angleInstancedArrays; | 82 Member<ANGLEInstancedArrays> m_angleInstancedArrays; |
| 66 Member<CHROMIUMSubscribeUniform> m_chromiumSubscribeUniform; | 83 Member<CHROMIUMSubscribeUniform> m_chromiumSubscribeUniform; |
| 67 Member<EXTBlendMinMax> m_extBlendMinMax; | 84 Member<EXTBlendMinMax> m_extBlendMinMax; |
| 68 Member<EXTDisjointTimerQuery> m_extDisjointTimerQuery; | 85 Member<EXTDisjointTimerQuery> m_extDisjointTimerQuery; |
| 69 Member<EXTFragDepth> m_extFragDepth; | 86 Member<EXTFragDepth> m_extFragDepth; |
| 70 Member<EXTShaderTextureLOD> m_extShaderTextureLOD; | 87 Member<EXTShaderTextureLOD> m_extShaderTextureLOD; |
| 71 Member<EXTsRGB> m_extsRGB; | 88 Member<EXTsRGB> m_extsRGB; |
| 72 Member<EXTTextureFilterAnisotropic> m_extTextureFilterAnisotropic; | 89 Member<EXTTextureFilterAnisotropic> m_extTextureFilterAnisotropic; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 89 Member<WebGLDepthTexture> m_webglDepthTexture; | 106 Member<WebGLDepthTexture> m_webglDepthTexture; |
| 90 }; | 107 }; |
| 91 | 108 |
| 92 DEFINE_TYPE_CASTS(WebGLRenderingContext, CanvasRenderingContext, context, | 109 DEFINE_TYPE_CASTS(WebGLRenderingContext, CanvasRenderingContext, context, |
| 93 context->is3d() && WebGLRenderingContextBase::getWebGLVersion(context) == 1, | 110 context->is3d() && WebGLRenderingContextBase::getWebGLVersion(context) == 1, |
| 94 context.is3d() && WebGLRenderingContextBase::getWebGLVersion(&context) == 1)
; | 111 context.is3d() && WebGLRenderingContextBase::getWebGLVersion(&context) == 1)
; |
| 95 | 112 |
| 96 } // namespace blink | 113 } // namespace blink |
| 97 | 114 |
| 98 #endif // WebGLRenderingContext_h | 115 #endif // WebGLRenderingContext_h |
| OLD | NEW |