| 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 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return true; | 82 return true; |
| 83 } | 83 } |
| 84 | 84 |
| 85 CanvasRenderingContext* WebGLRenderingContext::Factory::create(ScriptState* scri
ptState, OffscreenCanvas* offscreenCanvas, const CanvasContextCreationAttributes
& attrs) | 85 CanvasRenderingContext* WebGLRenderingContext::Factory::create(ScriptState* scri
ptState, OffscreenCanvas* offscreenCanvas, const CanvasContextCreationAttributes
& attrs) |
| 86 { | 86 { |
| 87 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); | 87 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); |
| 88 OwnPtr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContex
t3DProvider(scriptState, attributes, 1)); | 88 OwnPtr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContex
t3DProvider(scriptState, attributes, 1)); |
| 89 if (!shouldCreateContext(contextProvider.get())) | 89 if (!shouldCreateContext(contextProvider.get())) |
| 90 return nullptr; | 90 return nullptr; |
| 91 | 91 |
| 92 WebGLRenderingContext* renderingContext = new WebGLRenderingContext(offscree
nCanvas, contextProvider.release(), attributes); | 92 WebGLRenderingContext* renderingContext = new WebGLRenderingContext(offscree
nCanvas, std::move(contextProvider), attributes); |
| 93 if (!renderingContext->drawingBuffer()) | 93 if (!renderingContext->drawingBuffer()) |
| 94 return nullptr; | 94 return nullptr; |
| 95 renderingContext->initializeNewContext(); | 95 renderingContext->initializeNewContext(); |
| 96 renderingContext->registerContextExtensions(); | 96 renderingContext->registerContextExtensions(); |
| 97 | 97 |
| 98 return renderingContext; | 98 return renderingContext; |
| 99 } | 99 } |
| 100 | 100 |
| 101 CanvasRenderingContext* WebGLRenderingContext::Factory::create(HTMLCanvasElement
* canvas, const CanvasContextCreationAttributes& attrs, Document&) | 101 CanvasRenderingContext* WebGLRenderingContext::Factory::create(HTMLCanvasElement
* canvas, const CanvasContextCreationAttributes& attrs, Document&) |
| 102 { | 102 { |
| 103 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); | 103 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); |
| 104 OwnPtr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContex
t3DProvider(canvas, attributes, 1)); | 104 OwnPtr<WebGraphicsContext3DProvider> contextProvider(createWebGraphicsContex
t3DProvider(canvas, attributes, 1)); |
| 105 if (!shouldCreateContext(contextProvider.get())) | 105 if (!shouldCreateContext(contextProvider.get())) |
| 106 return nullptr; | 106 return nullptr; |
| 107 | 107 |
| 108 WebGLRenderingContext* renderingContext = new WebGLRenderingContext(canvas,
contextProvider.release(), attributes); | 108 WebGLRenderingContext* renderingContext = new WebGLRenderingContext(canvas,
std::move(contextProvider), attributes); |
| 109 if (!renderingContext->drawingBuffer()) { | 109 if (!renderingContext->drawingBuffer()) { |
| 110 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); | 110 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); |
| 111 return nullptr; | 111 return nullptr; |
| 112 } | 112 } |
| 113 renderingContext->initializeNewContext(); | 113 renderingContext->initializeNewContext(); |
| 114 renderingContext->registerContextExtensions(); | 114 renderingContext->registerContextExtensions(); |
| 115 | 115 |
| 116 return renderingContext; | 116 return renderingContext; |
| 117 } | 117 } |
| 118 | 118 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 visitor->traceWrappers(m_webglDebugShaders); | 232 visitor->traceWrappers(m_webglDebugShaders); |
| 233 visitor->traceWrappers(m_webglDrawBuffers); | 233 visitor->traceWrappers(m_webglDrawBuffers); |
| 234 visitor->traceWrappers(m_webglCompressedTextureASTC); | 234 visitor->traceWrappers(m_webglCompressedTextureASTC); |
| 235 visitor->traceWrappers(m_webglCompressedTextureATC); | 235 visitor->traceWrappers(m_webglCompressedTextureATC); |
| 236 visitor->traceWrappers(m_webglCompressedTextureETC1); | 236 visitor->traceWrappers(m_webglCompressedTextureETC1); |
| 237 visitor->traceWrappers(m_webglCompressedTexturePVRTC); | 237 visitor->traceWrappers(m_webglCompressedTexturePVRTC); |
| 238 visitor->traceWrappers(m_webglCompressedTextureS3TC); | 238 visitor->traceWrappers(m_webglCompressedTextureS3TC); |
| 239 visitor->traceWrappers(m_webglDepthTexture); | 239 visitor->traceWrappers(m_webglDepthTexture); |
| 240 } | 240 } |
| 241 } // namespace blink | 241 } // namespace blink |
| OLD | NEW |